The Windows Subsystem for Linux (WSL) lets you run a real Linux system, such as Ubuntu, inside Windows 10 or 11 without a second computer or dual booting. This guide is for anyone who looks after a website or server and wants a safe place on their own PC to learn and test Linux commands.
WSL is a Windows feature that runs Linux alongside Windows, with a full Linux terminal and its own files. To install it, open PowerShell as administrator, run **wsl --install, restart, then choose a Linux user name and password. You need Windows 10 version 2004 (build 19041) or later, or Windows 11, and it installs Ubuntu** by default.
What WSL actually is
Most web serversWeb server The program that answers visitors’ browsers and sends them your website. Also used for the computer it runs on. More about Web server → run Linux. If your own computer runs Windows, practising server work used to mean renting a server or setting up a virtual machine by hand. WSL removes that step.
There are two versions:
| Version | How it works | When you meet it |
|---|---|---|
| WSL 2 | Runs a real Linux kernel in a small, managed virtual machine | The default for new installs. Use this. |
| WSL 1 | Translates Linux system calls into Windows ones, with no real kernel | Older installs and a few special cases |
With WSL 2 you get the same apt, systemctl and configuration files you would find on an Ubuntu server, so commands you learn here work the same way on a real one. The Linux system is called a distribution (or distro), and you can install more than one side by side.
What WSL is good for:
- Learning Linux commands before you touch a live server.
- Running
ssh,rsync,digand other server tools from a proper Linux shell. - Testing an NginxNginx A fast, popular program that sends web pages to visitors and can pass requests on to apps behind it. More about Nginx → or PHP configuration before you copy it to production.
What it is not for: hosting a public website. WSL is built for development on your own machine, it stops when Windows shuts down, and it is not reachable from the internet in its default setup.
How to install WSL
1. Check your Windows version
Press Windows key + R, type winver and press Enter. Windows 11 of any version is fine. On Windows 10 you need version 2004 or later (build 19041 or higher). If yours is older, run Windows Update first.
2. Run the install command
Right-click the Start button, choose Terminal (Admin) or Windows PowerShell (Admin), and run:
wsl --install
This turns on the Windows features WSL needs, downloads the Linux kernel and installs Ubuntu. When it finishes, restart your computer.
To install a different distribution instead, list what is available and name the one you want:
wsl --list --online
wsl --install -d Debian
3. Create your Linux user
After the restart, Ubuntu opens and finishes setting up. It asks for a user name and password. These belong to Linux only and have nothing to do with your Windows login. Pick a simple lowercase name such as exampleco.
The password is what sudo asks for when you run a command with administrator rights (the Linux equivalent of root access). Nothing appears on screen while you type it. That is normal.
4. Update the system
Just as on a new server, update the package lists and installed software first:
sudo apt update
sudo apt upgrade
5. Confirm it is WSL 2
Back in PowerShell, run:
wsl -l -v
You should see your distribution with 2 in the VERSION column. If it says 1, convert it:
wsl --set-version Ubuntu 2
Using WSL day to day
Opening it
Type wsl in any PowerShell window, or pick Ubuntu from the Start menu or from the drop-down in Windows Terminal. You land in your Linux home folder, /home/exampleco.
Moving between Windows and Linux files
The two systems can see each other’s files:
| You are in | To reach the other side |
|---|---|
| Linux | Your C: drive is at /mnt/c, for example /mnt/c/Users/ |
| Windows | Type \\wsl.localhost\Ubuntu into File Explorer’s address bar |
| Linux, wanting a window | Run explorer.exe . to open the current Linux folder in File Explorer |
Keep project files inside the Linux file system (under your home folder), not under /mnt/c. Working across the boundary is much slower, and Linux tools behave more predictably on their own file system.
Connecting to a real server
From the Ubuntu terminal you can log in to a server exactly as you would from a Linux machine:
ssh exampleco@203.0.113.10
SSHSSH A secure way to type commands on a server from your own computer, as if you were sitting at it. More about SSH → keys you create inside WSL live in ~/.ssh in Linux, separate from any keys in your Windows user folder.
Practising with a web server
Installing Nginx is a good first exercise because you can see the result in your Windows browser:
sudo apt install nginx
sudo systemctl start nginx
Then open http://localhost in Edge or Chrome on Windows. By default WSL 2 forwards localhost from Windows into Linux, so you should see the Nginx welcome page.
Turning on systemd
Servers use systemd to start and manage services, and systemctl depends on it. Recent Ubuntu installs in WSL usually have it switched on already. Check with:
ps -p 1 -o comm=
If the answer is systemd, you are set. If it says init, open the WSL configuration file:
sudo nano /etc/wsl.conf
Add these lines and save:
[boot]
systemd=true
Then restart WSL from PowerShell, so the change takes effect:
wsl --shutdown
Wait a few seconds and open Ubuntu again. /etc/wsl.conf holds settings for one distribution. Settings for WSL as a whole, such as memory limits and networking mode, go in a file called .wslconfig in your Windows user folder.
Useful WSL commands
Run these in PowerShell, not inside Linux:
| Command | What it does |
|---|---|
wsl -l -v | Lists installed distributions, whether each is running, and its WSL version |
wsl --update | Updates WSL and its Linux kernel |
wsl --shutdown | Stops every running distribution, needed after configuration changes |
wsl -d Debian | Opens a specific distribution |
wsl --set-default Ubuntu | Chooses which distribution wsl opens by default |
wsl --unregister Debian | Deletes a distribution and all of its files, so copy anything you need first |
Common problems
| Symptom | Cause | Fix |
|---|---|---|
| Error 0x80370102 during install | Hardware virtualisation is switched off | Turn on Intel VT-x or AMD-V (sometimes called SVM) in your computer’s firmware settings, then try again |
wsl is not recognised | Windows is too old or the install did not finish | Run Windows Update, then run wsl --install again as administrator |
| “System has not been booted with systemd” | systemd is not enabled | Add the [boot] section shown above, then run wsl --shutdown |
http://localhost does not load | The service is not running, or something on Windows already uses port 80 | Run sudo systemctl status nginx, then see ERR_CONNECTION_REFUSED |
| Commands are very slow | Your files are under /mnt/c | Move the project into your Linux home folder |
| Forgot the Linux password | It is separate from Windows | In PowerShell run wsl -u root, then passwd exampleco to set a new one |
WSL is a practice ground, not a backup. If you unregister a distribution or reset WSL, its files go with it. Keep anything important in Git or copied elsewhere.
Official documentation
Related
- How to connect to a server with SSH: use your new Linux terminal to log in to a real server.
- How to set up SSH keys: create a key pair inside WSL and stop typing passwords.
- How to install Nginx on Ubuntu: go beyond the welcome page and serve a site from its own folder.
- What is a port number?: understand why
localhoston portPort A numbered door on a server. Each service listens behind its own door: web pages on 443, email on others, remote login on 22. More about Port → 80 reaches Nginx.
Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.

