Skip to content

Install WSL on Windows

Note

Most recent versions of Windows will come with wsl pre-installed. Run the wsl --version command to check if you already have WSL.

If you see a version when you run wsl --version, you can simply run wsl --install to install an Ubuntu image. If you want to use a different version of Linux, you can run wsl --install <distro-name>.

For example, to install Debian:

Install a WSL distribution
wsl --install debian

Run with no distribution name to install Ubuntu

Install Ubuntu in WSL
wsl --install

To change the default distribution that executes when you run wsl with no -d <distribution-name>, use --setdefault

Set default distribution for WSL
wsl --setdefault <distribution-name>

Install on older versions of Windows

On older versions of Windows, if this command fails, you can install wsl with the following steps:

  • Enable Windows Subsystem for Linux:
Enable WSL
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  • Enable virtual machine feature
Enable virtual machine
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  • Download and install the WSL2 Linux kernel update package
  • WSL2 Linux Kernel Download
  • Run the installer after download

  • Set WSL version 2 as default

Set WSL2 as default version
wsl --set-default-version 2
  • Install a distribution, i.e. Debian
Install Debian Linux in WSL
wsl --install -d Debian