News: 1753306770

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

How to host a Linux-powered local dev site in Windows

(2025/07/23)


hands on If you're building a website that will eventually be hosted on a Linux server (as so many are), you have a couple of choices about where you do your development work. You can create a beta version of the site at your web host and upload all of the files there or you can create a local test server that sits in your home or office.

The test server could be a separate Linux machine such as a Raspberry Pi or it could be your main PC if you run Linux as your desktop OS. If you're doing your coding in Windows, you could run a local Windows web server, but that's not the best simulation of your production environment.

Instead, I recommend using Windows Subsystem for Linux to run a local Linux web server within Microsoft's OS. That way you can write your code in Windows while running it on the same platform it's destined for, no second computer or remote server required. Here's how.

[1]

Start by installing Windows Subsystem for Linux 2 (WSL 2). Launch PowerShell (any version) and enter the following: wsl --install --no-distribution

Next, we'll install AlmaLinux 9 to use as our Linux distribution. By default, if you don't install WSL with the --no-distribution option, it will install Ubuntu, but most web hosting platforms use CentOS or AlmaLinux (which is similar to CentOS) so we're going with that. Find AlmaLinux 9 in the Microsoft Store and click install.

[2]

AlmaLinux OS 9 in Microsoft Store - Click to enlarge

Launch the AlmaLinux environment by finding its shortcut icon in Windows Search. Note that the first time you open it, AlmaLinux will ask you to set a username and password.

[3]

Set username for AlmaLinux - Click to enlarge

Since you just installed a new Linux instance, it's time to run an update to get everything up to the latest specs. You do that by entering the following in AlmaLinux: sudo dnf update

Next, you'll need to set a password for the root user. Make sure you keep it handy. sudo passwd root

After that, it's time to install a control panel app for the web server. Many hosting services use cPanel, but that comes with a licensing fee, so we're going to use Virtualmin and its companion Webmin (Virtualmin controls the server while Webmin controls each account), which is a free alternative. If you already own cPanel or another app, use that. To install Virtualmin / Webmin, enter: sudo sh -c "$(curl -fsSL https://software.virtualmin.com/gpl/scripts/virtualmin-install.sh)" -- --bundle LAMP

If, during the process, you are asked for a fully-qualified domain name, you can enter something like host.example.com just to move the process along. We'll be using the IP address to get to Virtualmin, Webmin, and our local site.

[4]

Enter fully-qualified domain name for Virtualmin - Click to enlarge

When the installation is complete, the script will give you an IP address with :10000 at the end. Copy that and paste it into a browser.

[5]

Installing Virtualmin - Click to enlarge

The browser will give you a "Your connection is not private" error. Proceed anyway.

[6]

"Your connection is not private" error - Click to enlarge

Enter root as the username and the password you assigned to root into the Webmin dialog box. Then sign in.

[7]

Webmin login screen - Click to enlarge

Click Next to continue with the Post-Installation Wizard.

[8]

Webmin Post-installation wizard - Click to enlarge

Continue to click Next and accept the default settings until you get to the MariaDB password page. Here you might want to change the password to something more memorable. Or, at least, copy the password down.

[9]

Set MariaDB password - Click to enlarge

Check "Skip check for resolvability" on the nameserver page. This will ensure that, even if you use a bogus domain name like host.example.com, you can still get into Webmin using the IP address.

[10]

Skip check for resolvability - Click to enlarge

Click Add new virtual server.

[11]

click add new virtual server - Click to enlarge

Give your new virtual server an admin password and a domain name that doesn't have any top-level domain (no .com, .edu, etc). I used the domain name "mysite" for this purpose. Then click Create Server.

[12]

give your site a name and click Create Server - Click to enlarge

Now, it's time to install some applications you may need for your website. Navigate to Virtualmin->Manage Web Apps for a list of available apps. I recommend installing phpMyAdmin for database management and WordPress (if you are running a WordPress site).

[13]

Navigate to Manage Web Apps in Virtualmin - Click to enlarge

You should now be able to view the home page of your site by navigating to http://YOUR_IP_ADDRESS (in my case this was http://172.26.88.73) and manage the database by going to http://YOUR_IP_ADDRESS/phpmyadmin.

At this point, you may want to make it easier to access the local site by giving it a plain-language name you can use in lieu of its IP. Do this by editing the C:\Windows\System32\drivers\etc\hosts file and including the name you want (ex: mysite) and the IP address.

[14]

add your site name to the hosts file - Click to enlarge

Remember that you'll have to add the http in front of the name (ex: http://mysite) to view the local site in your browser.

Next, you'll want to locate and set permissions for the public_html directory, which represents the root of your website. Virtualmin creates a user with the domain name of the site you entered when you created a virtual server and, in our case, that's mysite. So the relevant folder is located at /home/mysite/public_html.

[15]

[16]

Grant yourself permissions to this folder by entering the following at the Linux command line: sudo chmod -R 777 /home/mysite

Now, you should be able to access the site's files in File Explorer by navigating to Linux->AlmaLinux-9->home->mysite->public_html

[17]

File Explorer open to public_html folder - Click to enlarge

With the correct permissions in place, you can do the development work for your site and then view what it looks like by going to http://YOUR_IP_ADDRESS or http://mysite. Just make sure to keep an AlmaLinux WSL terminal window open or the webserver won't run. ®

Get our [18]Tech Resources



[1] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/virtualization&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2aIZNOzAeBIxAZGLNCQQx2AAAAFM&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0

[2] https://regmedia.co.uk/2025/07/23/webserver1.jpg

[3] https://regmedia.co.uk/2025/07/23/webserver2.png

[4] https://regmedia.co.uk/2025/07/23/webserver3.png

[5] https://regmedia.co.uk/2025/07/23/webserver4.jpg

[6] https://regmedia.co.uk/2025/07/23/webserver5.jpg

[7] https://regmedia.co.uk/2025/07/23/webserver6.png

[8] https://regmedia.co.uk/2025/07/23/webserver7.png

[9] https://regmedia.co.uk/2025/07/23/webserver8.png

[10] https://regmedia.co.uk/2025/07/23/webserver9.png

[11] https://regmedia.co.uk/2025/07/23/webserver10.png

[12] https://regmedia.co.uk/2025/07/23/webserver11.jpg

[13] https://regmedia.co.uk/2025/07/23/webserver12.jpg

[14] https://regmedia.co.uk/2025/07/23/webserver13.png

[15] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/virtualization&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44aIZNOzAeBIxAZGLNCQQx2AAAAFM&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[16] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/virtualization&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33aIZNOzAeBIxAZGLNCQQx2AAAAFM&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[17] https://regmedia.co.uk/2025/07/23/webserver14.jpg

[18] https://whitepapers.theregister.com/



Brad Ackerman

wsl install AlmaLinux-10 will directly download and install that distribution.

WSL Works Amazingly Well

bazza

I'm using it a lot. It's good.

I'm still using a separate x-server for graphical programmes, rather than the built in wayland server. But that's barely an issue - Mobaxterm is excellent.

Why on earth would I want to do that?

jake

Adding layers of complexity for no reason at all is contraindicated. To say nothing of the security implications.

Consider: By your definition, I'm a Linux guy. I have Linux machines. I'll do my Linux development on Linux, TYVM.

To be fair, I do some of my Linux development on BSD, but then I do some of my BSD development on Linux, so ...

Re: Why on earth would I want to do that?

ComputerSays_noAbsolutelyNo

I guess, you as the Linux guy, create a dev environment for the website devs, who might not be Linux people.

Re: Why on earth would I want to do that?

Rich 2

I totally agree. It’s a ridiculous idea. Just like forcing software people to use windows machines (because….f%#* knows) so they then have to run Linux in a VM just so they can do the bloody job they’re being paid to do. But because windows already chews through so much processing resource for reasons nobody seems to have any answer for, you’re lucky if you can assign more than a couple of the zillion cores your cpu has to Linux. So it runs like an arthritic slug. And then you have to make sure the VM is shut down every night just in case windows decides to f&@%ing reboot in the meantime, trashing your VM. And you also have to spend the first few weeks tweaking shit you really shouldn’t have to just so the VM runs acceptably - like killing-off f%#+ing Hyper-V (that’s a challenge in itself).

Windows is a shite platform for running windows programs. Why using it to run a whole Linux OS seems a good idea is totally beyond the mind of any sane person. I don’t even consider myself sane and I can’t fathom it either!

Blackjack

Yeah cause running something Linux inside Windows screams stability. To start with Windows not only willl force updates but may also reboot without permission.

Spank me daddy

elsergiovolador

It's like you have a fetish for being surveilled, but you also like Linux.

Windows brings your personal Stasi, sorry Copilot handler to breath down your neck as you navigate through perilous abyss of Linux terminal.

DrewPH

Surely better in 99.99% of scenarios just to eliminate Windows from the picture completely. If you develop on a laptop then lots of good ones run Linux easily. If you need a separate web server on your local network, a pure Linux box can be commissioned for bobbins - think Raspberry Pi or an Intel NUC.

FirstTangoInParis

Indeed if you’re into this stuff anyway you will somehow amass a large collection of perfectly serviceable hardware that will do just fine for loading up Linux and doing whatever. With the great W10 chuck out coming soon, free hardware will be throwing itself upon you if you even slightly hint that you can fix a computer, including wiping disks before it hits landfill (use Boot and Nuke). Take the disk out before you throw the rest out, it WILL come in handy someday (honest). I’m gonna have to cull my computer graveyard soon as I’m struggling to get my feet under my desk!

or just stick to Linux

Michael

Unless you have some insane corporate policy stating you have to use windows. In every situation just develop in Linux to run on a Linux server. You free up most of the computer memory and resources, only need to run what is required, and testing on your local machine can match the deployment.

If you have to use windows, question why you are still working in a company that mandates you develop in one operating system to deploy in another?

Alternatively, just run everything in docker containers and deploy an equivalent setup as your production system? At least this complexity would be scripted, repeatable and deployable on your test and production systems. With the bonus that all Devs would be working in the same manner.

The sooner Microsoft concede and Windows becomes a Linux desktop environment with a wine alternative to support legacy systems the better.

A windows sub system for Linux to let us get over the short term hurdle of porting code to Linux would be more useful.

Re: or just stick to Linux

FirstTangoInParis

I’m getting vibes that MS office apps are going web, like Google apps. Only they will suck because Google wrote their apps from scratch for web and MS didn’t. And then there’s nothing to stop Windows becoming a web first OS like ChromeOS.

Or we can all ditch Windows and go Linux. Yay!

pkiff

Hey, I think there are better ways to run a Linux-based local web development environment in Windows using WSL 2.!

Super smart folks have been working on docker-based container systems for Windows for over a decade, and the options that WSL 2 makes possible are now really, really good.

Whether you want to write code directly in WSL, or code in Windows and have the files served up to your browser via WSL, the latest tools will set it all up for you. And they have tons of documentation, and support forums or Slack channels for help.

For example, I use Lando. Other folks swear by DDEV. Both of these are excellent tools with simple installation instructions: sometimes just a single line run in a Terminal. And they offer specific configuration options intended to help WordPress users get a local environment set up and synchronized with a remote server.

Folks who are determined to stick with Windows, but want the best of what Linux has to offer, might want to check those out.

MatthewSt

Dev Containers (https://containers.dev/) is a more straightforward set of these instructions. Declare what you want your environment to have in it (Web server, language SDKs etc) and then that config is also in your source code. Runs isolated from other sites you're building too so less chance of version mismatches.

Linus Torvalds (Original from Dilbert?)

Tim99

[1]"Here's a nickel kid" . Mine has "UNIX Power Utilities" in the pocket >>====>

[1] https://github.com/torvalds/linux/blob/master/include/math-emu/double.h#L29

Re: Linus Torvalds (Original from Dilbert?)

Anonymous Coward

"Original from Dilbert?"

June 1995 pretty early in the life of Linux so refers to Unix.

Archive.org copy of the [1]Dilbert Cartoon

Rather amusing that Scott Adams transgressions now seem inconsequential compared the current US shit show which decidedly does have consequences.

Only amusing if you don't reside in the US, I suppose.

[1] https://ia601605.us.archive.org/view_archive.php?archive=/23/items/dilbert-1989-2023-complete.-7z_202303/Dilbert_1989-2023_complete.7z&file=1995%2F1995-06-24_computer%20holy%20wars_scruffy%20beard_suspenders_smug%20expression_unix%20computer%20user_nickel_better%20computer_holy%20wars.gif

sammystag

This is a strange article for the reg. There are thousands of blog postings, etc out there for anyone who needs help getting code running locally, regardless of OS, and most of them would give simpler advice than this - for example, use Docker rather than creating a pet environment manually

m4r35n357

A telling insight into the world of Windoze clicky-clicky, point 'n' grunt. Pretty sure the sequence was shortened anyway ;)

Author Should Really Google Docker and Virtual Machines

raindog

Why on Earth would anyone go through this instead of doing their dev work with Docker?

Or failing that, run a VM using something like Virtualbox, which is free?

Re: Author Should Really Google Docker and Virtual Machines

Anonymous Coward

I think Docker on Windows actually runs under a minimal virtual machine (Hyper-V?) pretty much as WSL-2 does if I am not mistaken.

So not a great difference either way I suppose.

If you were deploying to a container in production you might attempt to run the same container environment on your PC even Docker or Podman under Linux under WSL. ;)

I guess the idea was for web dev types that aren't exactly the full bottle † on Linux distributions or system admin tasks generally, to follow a set of steps to setup an AL9 environment on their Windows PC where they can test their deployment before screwing up production.

Any of the commentards here would just run replicas of the production environments on an old box or as VMs on their Proxmox server. ;)

† and that's being generous in my experience.

Re: Author Should Really Google Docker and Virtual Machines

Richard 12

WSL2 is a virtual machine, it's an interface to the hypervisor that's already built-in to Windows 10 onwards. So no extra licensing required - unlike VirtualBox which is a mix of free and (optional) expensive licence required parts.

It simply automates installation and mounting of your Windows partition and Linux virtual hard disk(s) in both directions.

It has a few limitations, main one that hit me was that by default it gets a black box NAT network connection in 172.23 that only supports TCP.

It does appear to be possible to replace that NAT with something configurable, though at that point it's starting to lose its shine and perhaps no longer a good solution.

Re: Author Should Really Google Docker and Virtual Machines

BanburyBill

The other limitation is that you are stuck with the Windows UI. On this corporate Windows desktop I've retreated to running in Hyper-V so I can have a KDE desktop. Would like the WSL network mirroring.

Paul Herber

I think this is a bit OTT for many situations. Wampserver is possibly good enough for many devs.

Groo The Wanderer - A Canuck

Much easier option: wipe Windblows from the box and install a real OS like Ubuntu, Redhat, LMDE 6, or Debian.

As an added bonus you won't have "Recall" sending screenshots of everything you do to Microsquishy for law enforcement perusal.

Life is a POPULARITY CONTEST! I'm REFRESHINGLY CANDID!!