WSL 2 lets you run a full Linux environment inside Windows without dual-booting or a virtual machine. This guide shows you how to install WSL 2 and set up Ubuntu on Windows 10 or Windows 11, from enabling the required Windows features to running your first apt update.
Prerequisites
- Windows 10 version 2004 or later (Build 19041+), or Windows 11
- Administrator access on your machine
- Virtualization enabled in BIOS (usually on by default)
To check your Windows version, press Win + R, type winver, and press Enter. You need Build 19041 or higher.
Which Ubuntu Version to Install
| Version | Codename | Support Until | Status |
|---|---|---|---|
| Ubuntu 24.04 LTS | Noble Numbat | April 2029 | Recommended |
| Ubuntu 22.04 LTS | Jammy Jellyfish | April 2027 | Stable, widely used |
| Ubuntu 20.04 LTS | Focal Fossa | April 2025 (ended) | End of standard support |
If you’re starting fresh, go with Ubuntu 24.04 or 22.04. Ubuntu 20.04 has reached end of standard support and no longer receives free security updates.
Step 1: Enable WSL 2
WSL 2 requires two Windows features: Windows Subsystem for Linux and Virtual Machine Platform. Open PowerShell as Administrator (right-click the Start menu and select “Terminal (Admin)” on Windows 11, or “Windows PowerShell (Admin)” on Windows 10).
Enable both features:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Restart your computer after running these commands. The features need a reboot to activate.
Step 2: Set WSL 2 as the Default Version
After the restart, open PowerShell as Administrator again and set WSL 2 as the default:
wsl --set-default-version 2
If you see a message about updating the WSL kernel, run:
wsl --update
Then run wsl --set-default-version 2 again.
Step 3: Install Ubuntu
Install Ubuntu 22.04 (or 24.04) from PowerShell:
wsl --install -d Ubuntu-22.04
For Ubuntu 24.04:
wsl --install -d Ubuntu-24.04
To see all available distros:
wsl --list --online
Note: If WSL is not yet installed on your system, wsl --install -d Ubuntu-22.04 handles Steps 1–3 in a single command — it enables WSL, enables the Virtual Machine Platform, sets WSL 2 as default, and installs Ubuntu. The explicit steps above are useful if you need to set things up separately or if the one-liner fails in enterprise/restricted environments.
Step 4: Create Your Linux User
After installation, Ubuntu launches and asks you to create a username and password:
Enter new UNIX username: your-username
New password:
Retype new password:
This is your Linux user — separate from your Windows login. The password won’t show characters as you type. That’s normal.
Step 5: Update Packages
Update the package index and upgrade installed packages:
sudo apt update && sudo apt upgrade -y
Step 6: Verify the Installation
Check your Ubuntu version:
lsb_release -a
Confirm you’re running WSL 2 (not WSL 1) by running this in PowerShell:
wsl -l -v
Expected output:
NAME STATE VERSION
* Ubuntu-22.04 Running 2
If the VERSION column shows 1, convert it to WSL 2:
wsl --set-version Ubuntu-22.04 2
Useful WSL Commands
| Command | What It Does |
|---|---|
wsl |
Opens the default distro |
wsl -d Ubuntu-22.04 |
Opens a specific distro |
wsl -l -v |
Lists installed distros with WSL version |
wsl --shutdown |
Shuts down all running WSL instances |
wsl --set-default Ubuntu-22.04 |
Sets the default distro |
wsl --update |
Updates the WSL kernel |
wsl --unregister Ubuntu-22.04 |
Removes a distro (deletes all data) |
Working with Files
Your Windows drives are mounted under /mnt/ in WSL. For example, C: is at /mnt/c/:
ls /mnt/c/Users/
You can read and write Windows files from Ubuntu, but keep your Linux projects inside the WSL filesystem (your home directory ~). File operations on /mnt/c/ are significantly slower because WSL has to translate between the Linux and Windows file systems.
If you see Zone.Identifier files appearing when you copy files from Windows into WSL, see Manage Zone Identifier Files in WSL on Windows 10 and Windows 11.
Troubleshooting
“WSL 2 requires an update to its kernel component”
Update the WSL kernel from PowerShell:
wsl --update
Then restart WSL:
wsl --shutdown
Virtualization not enabled
If installation fails with a virtualization error, restart your computer and enter BIOS (usually F2, F10, or Del during boot). Enable Intel VT-x, AMD-V, or SVM Mode depending on your processor.
DNS or internet issues inside WSL
If apt update fails or you can’t reach the internet from inside WSL, it’s usually a DNS resolution issue. See Resolving Internet Connection Issues in WSL 2 for the fix. If DNS keeps resetting after a reboot, follow How to Make Resolve Config Changes Permanent in WSL 2.
Conclusion
You now have Ubuntu running in WSL 2 on Windows. You can install dev tools, manage servers, run Docker, and do everything you’d normally do on a Linux machine — right from your Windows desktop.
Next, connect VS Code to your WSL instance for a full development setup — see How to Connect Visual Studio Code with WSL 2 for Linux Ubuntu. To customize your terminal, check out How to Make Your WSL Ubuntu Terminal Look Better with Oh My Posh.


