How to Install WSL on Windows 10 and 11

Open PowerShell as administrator, run wsl --install, and restart the computer. This enables the Windows features WSL needs and installs Ubuntu as a WSL 2 distribution; after the restart, Ubuntu opens and asks you to create a Linux username and password.

You need Windows 11, or Windows 10 version 2004 (build 19041) or later. Check your build by pressing Win + R, typing winver and pressing Enter.

How to install WSL step by step

  1. Right-click the Start button and choose Terminal (Admin) or Windows PowerShell (Admin). (Or search for PowerShell, right-click it and pick Run as administrator.)
  2. Run:
    wsl --install
  3. Restart Windows when the installer finishes.
  4. After the restart, Ubuntu opens in a console window and unpacks itself. Microsoft notes this first launch takes a while; later launches should take less than a second.
  5. When prompted, enter a Linux username and password. They are separate from your Windows account, and the password is what sudo asks for. Nothing appears on screen while you type it.

Then update the distribution's packages:

sudo apt update && sudo apt upgrade

Microsoft notes that wsl --install on its own "only works if WSL is not installed at all". If WSL is already present, the command prints the help text instead. In that case, install a distribution by name, as below.

How to choose a different Linux distribution

List what is available:

wsl --list --online

Real output from WSL 2.0.14 on Windows 11 (the list is downloaded from Microsoft and changes over time):

The following is a list of valid distributions that can be installed.
Install using 'wsl.exe --install <Distro>'.

NAME                            FRIENDLY NAME
Ubuntu                          Ubuntu
Debian                          Debian GNU/Linux
kali-linux                      Kali Linux Rolling
OracleLinux_7_9                 Oracle Linux 7.9
OracleLinux_8_10                Oracle Linux 8.10
OracleLinux_9_5                 Oracle Linux 9.5
SUSE-Linux-Enterprise-15-SP6    SUSE Linux Enterprise 15 SP6
openSUSE-Tumbleweed             openSUSE Tumbleweed

Install one using the name in the first column:

wsl --install -d Debian

If you're unsure, pick Ubuntu: it's the default, and most tutorials written for WSL assume it. You can install several distributions side by side, and if the download hangs at 0.0%, Microsoft suggests adding --web-download.

How to check your WSL version with wsl -l -v

wsl -l -v

(-l -v is short for --list --verbose.) Real output from a machine with Ubuntu and Docker Desktop installed:

  NAME                   STATE           VERSION
* docker-desktop-data    Stopped         2
  docker-desktop         Stopped         2
  Ubuntu                 Stopped         2

The * marks the default distribution, which is what plain wsl opens. VERSION is the WSL architecture, 1 or 2. docker-desktop entries belong to Docker Desktop, which runs its Linux engine inside WSL 2 (see Docker vs virtual machines). In that example Docker Desktop has become the default; set your own distribution back with:

wsl --set-default Ubuntu

Run wsl --version to see the WSL package and kernel versions (for example WSL version: 2.0.14.0 and Kernel version: 5.15.133.1-1), and wsl --update to update them.

WSL 1 vs WSL 2: which should you use?

Use WSL 2, the default for new installs. It runs a real Linux kernel, built by Microsoft, "inside of a lightweight utility virtual machine". WSL 1 translated Linux system calls instead, without a kernel.

FeatureWSL 1WSL 2
Full Linux kernelNoYes
Full system call compatibility (Docker, systemd)NoYes
Performance across OS file systemsBetterSlower
Runs with current VMware and VirtualBoxYesSee FAQ below
Managed VMNoYes

Microsoft lists a few reasons to stay on WSL 1: your project files must stay on the Windows file system and you work on them from Linux tools, you need serial port access, or you have strict memory limits. Switch a distribution between versions with:

wsl --set-version Ubuntu 2

How to access files between Windows and Linux

Windows files from Linux. Your Windows drives are mounted under /mnt: C:\Users\alex\Documents is /mnt/c/Users/alex/Documents. Run wsl pwd from a PowerShell window in a project folder and you see the translation directly:

/mnt/c/Users/alex/Desktop/project

Linux files from Windows. Type \\wsl$ (or \\wsl.localhost) in File Explorer's address bar to see every distribution's files; \\wsl$\Ubuntu\home\alex is your Linux home folder. From inside Linux, explorer.exe . opens the current folder in File Explorer (note the dot).

Where to keep your projects. Microsoft recommends against working across the two file systems: if you work from a Linux terminal, store files in the Linux file system (/home/alex/project), not under /mnt/c. File access across the boundary is noticeably slower in WSL 2. Linux file permissions also don't behave normally on /mnt/c; see Linux file permissions explained.

You can also run Linux commands from PowerShell by prefixing them with wsl, for example wsl ls -la, and Windows programs from Linux by their .exe name, for example notepad.exe.

Common errors and how to fix them

Error 0x80370102: virtualization is not enabled

Error: 0x80370102 The virtual machine could not be started because a required feature is not installed.

Microsoft's troubleshooting page answers this with "Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS." In practice:

  1. Check whether virtualization is on: open Task Manager (Ctrl + Shift + Esc), go to Performance > CPU and look at Virtualization. Or run systeminfo: a line reading A hypervisor has been detected. under Hyper-V Requirements means it is already running.
  2. If it is disabled, turn it on in your PC's UEFI/BIOS setup. The option is usually called Intel VT-x, Intel Virtualization Technology, AMD-V or SVM, under CPU settings; the menu differs by manufacturer.
  3. Make sure the Virtual Machine Platform feature is ticked in Turn Windows features on or off, then restart.
  4. If it still fails, check the boot configuration from an administrator prompt with bcdedit /enum | findstr -i hypervisorlaunchtype. If it says Off, Microsoft's fix is bcdedit /set hypervisorlaunchtype Auto and a restart.

The same page notes that WSL 2 needs a CPU with Second Level Address Translation (SLAT), so very old processors such as the Intel Core 2 Duo can't run it at all. Error 0x80070003 during installation has the same causes. If Windows itself is running in a virtual machine, nested virtualization has to be enabled on the host.

WslRegisterDistribution failed with error 0x8007019e

The Windows Subsystem for Linux optional component is not enabled. Open Control Panel > Programs and Features > Turn Windows features on or off, tick Windows Subsystem for Linux, and restart.

The term 'wsl' is not recognized

The full message is The term 'wsl' is not recognized as the name of a cmdlet, function, script file, or operable program. WSL's optional component is not installed. Enable Windows Subsystem for Linux in Turn Windows features on or off as above, and restart. On ARM64 devices, Microsoft notes this error can appear in Windows PowerShell even when WSL is installed; run wsl.exe from Command Prompt or PowerShell 7 instead.

Something else is already using a port

Microsoft's networking guide says a server running in your Linux distribution can be reached from Windows apps "using localhost (just like you normally would)", so WSL servers can collide with Windows programs using the same port. Fixing "port already in use" shows how to find the other process on both sides.

Frequently asked questions

Does WSL slow down Windows?
WSL 2 runs a lightweight virtual machine only while a Linux distribution is in use. Microsoft's settings reference gives a default idle timeout of 60,000 milliseconds (60 seconds) on Windows 11 before the VM shuts down. While it runs, it uses memory that grows and shrinks with what you do in Linux. Microsoft notes that WSL 2 does not yet return cached file pages to Windows until the instance shuts down, so long sessions that touch many files can hold memory. wsl --shutdown stops it immediately.
How do I uninstall a Linux distribution from WSL?
Run wsl --unregister <DistroName>, for example wsl --unregister Ubuntu. This deletes the distribution and every file inside its Linux file system permanently, so copy anything you need out first. WSL itself stays installed.
Can I use WSL with VirtualBox or VMware?
Yes with recent versions. WSL 2 uses Windows' hypervisor, and Microsoft's troubleshooting guide says third-party hypervisors must be on versions that support Hyper-V, naming VMware 15.5.5 and later and VirtualBox 6 and later, or be turned off. Microsoft still describes VirtualBox support as having significant challenges.
Do I need Windows 11 for WSL?
No. The one-command install works on Windows 10 version 2004 (build 19041) and later as well as Windows 11. Older Windows 10 builds can install WSL using Microsoft's manual installation steps.

Sources