How to install WSL on Windows

To install WSL, the Windows Subsystem for Linux, Windows 11 and Windows 10 need just one command and a restart. WSL runs a real Linux, Ubuntu by default, next to Windows: with its terminal, apt and Linux tools, but without a separate virtual machine to set up. This guide covers the install, other distributions, the first user, WSL 1 and WSL 2, and the install errors people search for most.

What you need

  • Windows 11, or Windows 10 version 2004 (build 19041) or newer. Type winver in Start to see yours.
  • An administrator account on the PC: the install turns on Windows features.
  • For WSL 2, virtualization turned on in the BIOS or UEFI. Check it in Task Manager › Performance › CPU: the line Virtualization should say Enabled.

How to install WSL with one command

Right-click Start and choose Terminal (Admin). Run the command and restart Windows when it is done. It turns on the Windows Subsystem for Linux and Virtual Machine Platform features, installs the Linux kernel, makes WSL 2 the default and installs Ubuntu.

wsl --install

If the command only prints the WSL help text, WSL is already on the PC and only a distribution is missing. Install one as shown in the next section.

Choose another Linux distribution

The first command lists the distributions you can install, with names like Ubuntu-24.04, Debian or kali-linux. The second installs the one you name. You can keep several side by side.

wsl --list --online wsl --install -d Ubuntu-24.04

Plain Ubuntu installs the current LTS release. A name with a number, such as Ubuntu-24.04, gives exactly that release. To make another distribution the one wsl opens:

wsl --set-default Debian

Create your Linux user

After the restart Ubuntu opens by itself, or open it from Start. It unpacks for a minute and asks for a User Name and a Password.

  • The name has nothing to do with your Windows account. Use lowercase Latin letters, such as alex.
  • While you type the password, nothing appears on screen. This is normal. You need it for sudo, and this user is the Linux administrator.
  • Each distribution has its own users. A new or reset distribution asks again.
  • Forgot the password? In Terminal, open Linux as root: wsl -u root Then set a new password, with your user name in place of alex: passwd alex

Windows doesn’t update the Linux packages. Do it yourself from time to time in the Ubuntu terminal:

sudo apt update sudo apt upgrade -y

WSL 1 or WSL 2: check and switch

The first command lists your distributions and the WSL version each one uses. The second moves a distribution to WSL 2, the third makes WSL 2 the default for new ones. The last one updates WSL itself.

wsl -l -v wsl --set-version Ubuntu 2 wsl --set-default-version 2 wsl --update

WSL 2 runs a real Linux kernel in a light virtual machine. Everything works there, Docker included, and files inside Linux open fast. WSL 1 needs no virtualization and reads files on the Windows drives faster, but some programs don’t run in it. For development choose WSL 2 and keep projects in your Linux home folder, not in /mnt/c.

Before you stop all distributions and the WSL virtual machine, save your work in Linux: open programs in it are closed. They stop with: wsl --shutdown

If WSL doesn’t install or start

  • WSL2 is unable to start since virtualization is not enabled on this machine. with the error code HCS_E_HYPERV_NOT_INSTALLED (current WSL), or Error: 0x80370102 The virtual machine could not be started because a required feature is not installed. (older versions): turn on virtualization in the BIOS or UEFI (often named Intel VT-x, AMD-V or SVM) and the Virtual Machine Platform feature, then restart. Check the hypervisor setting: bcdedit /enum | findstr -i hypervisorlaunchtype If it shows Off, Microsoft says to run this in Terminal as administrator and restart: bcdedit /set hypervisorlaunchtype Auto Inside a virtual machine, WSL 2 also needs nested virtualization turned on in the host’s settings.
  • WslRegisterDistribution failed with error: 0x8007019e: the Windows Subsystem for Linux feature is off. Turn it on in Turn Windows features on or off and restart, or run the install again: wsl --install
  • Installation failed with error 0x80070003: WSL runs only from the system drive. In Settings › System › Storage › Advanced storage settings › Where new content is saved, set new apps to C:.
  • The install hangs at 0.0%: download the distribution first: wsl --install --web-download -d Ubuntu
  • WSL 2 doesn’t start on an old CPU: it needs SLAT, which Intel Core processors from the first generation on and AMD Opteron have. On older ones only WSL 1 works.
  • For other errors, install Windows updates and update WSL: wsl --update Microsoft’s troubleshooting page also suggests repairing system files in Terminal as administrator: sfc /scannow

You can also turn on both features with these commands from Microsoft’s manual install page, in Terminal as administrator, then restart:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

If you also work on a Mac

MacWashing, System Junk: Xcode junk, user caches, installers and logs found, 22.83 GB ready to be cleaned

System Junk in MacWashing finds the caches of every app it knows, including those hidden inside app data, plus logs, Xcode junk and leftovers of deleted apps. It shows how much each takes and clears them in one go. Anything debatable stays unchecked until you decide.

Free trial · macOS 14 or later

Questions and answers

How do I install WSL on Windows 11?

Open Terminal (Admin), run this command and restart: wsl --install Ubuntu opens after the restart and asks you to create a Linux user name and password.

Where are my WSL files in Windows?

In File Explorer under Linux in the left pane, or at \\wsl$\Ubuntu\home\<user>. To open the current folder in File Explorer from the Linux terminal: explorer.exe .

How do I remove a WSL distribution?

This deletes the distribution with all its files, programs and settings, and it can’t be undone, so copy what you need to Windows first. Then run: wsl --unregister Ubuntu WSL itself stays and other distributions keep working.