This guide shows you how to install Ubuntu in WSL 2 on Windows 10 or Windows 11. WSL 2 (Windows Subsystem for Linux) gives you a full Linux terminal on Windows — no virtual machine setup, no dual boot. You get access to apt, bash, ssh, and everything else you’d expect from a real Ubuntu system.
The installation takes one command and about five minutes.
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 hit Enter. You need Build 19041 or higher.
Which Ubuntu Version Should You Install?
WSL supports multiple Ubuntu versions. Here are the current LTS options:
| 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.
Install Ubuntu in WSL 2
Step 1: Install WSL and Ubuntu
Open PowerShell as Administrator. Right-click the Start menu and select “Terminal (Admin)” on Windows 11, or “Windows PowerShell (Admin)” on Windows 10.
Run this command to install WSL 2 with Ubuntu 22.04:
wsl --install -d Ubuntu-22.04
Or for Ubuntu 24.04:
wsl --install -d Ubuntu-24.04
This single command handles everything — it enables the WSL feature, enables the Virtual Machine Platform, sets WSL 2 as the default, and installs your chosen Ubuntu version.
To see all available distros you can install:
wsl --list --online
Restart your computer when prompted. The WSL kernel needs a reboot to load.
Step 2: Create Your Linux User
After the restart, Ubuntu will launch automatically and ask 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 3: Update Packages
Update the package index and upgrade installed packages:
sudo apt update && sudo apt upgrade -y
Step 4: 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
Here are the commands you’ll use regularly:
| 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 run into 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, this is a common 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 2 instance for a full development setup, or customize your terminal with Oh My Posh to make it look better.