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 | |
|---|---|
Run with no distribution name to install Ubuntu
| Install Ubuntu in WSL | |
|---|---|
To change the default distribution that executes when you run wsl with no -d <distribution-name>, use --setdefault
| Set default distribution for WSL | |
|---|---|
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
- Install a distribution, i.e. Debian