Select Start menu Type cmd.exe in Search Right-click & select “Run as Administrator”
wsl.exe --install
Installs the Ubuntu distribution and WSL on the device.
Remember you must also install Hyper-V Service (WSL.exe doesn’t do it)
In the same elevated (as Administrator) Cmd prompt:
DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V
Or the same can be done in an Elevated PowerShell session:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
REMINDER: You must also have the following enabled in your computer’s BIOS:
- Enable Hardware Virtualization.
- Enable Nested Virtualization.
- Turn on Virtual Machine Platform
Once all of the above is down, we’re ready to proceed!
Now it is time to install a Linux Distro (WSL2 tries to install Ubuntu default)
wsl --list --online
lists all available Linux distributions that you may install using the wsl command. Currently, these are:
Syntax | Description |
---|---|
Ubuntu | Ubuntu |
Debian | Debian GNU/Linux |
kali-linux | Kali Linux Rollin |
openSUSE-42 | openSUSE Leap 42 |
SLES-12 SUSE | Linux Enterprise Server v12 |
Ubuntu-16.04 | Ubuntu 16.04 LTS |
Ubuntu-18.04 | Ubuntu 18.04 LTS |
Ubuntu-20.04 | Ubuntu 20.04 LTS |
wsl --install -d <DistroName>
installs the selected distribution. Replace
wsl --update
updates the WSL Linux kernel manually.
wsl --update rollback
Rolls back to the previous WSL kernel version.
wsl --status
Displays general information about the status of the Windows Subsystem for Linux installation.
wsl --help
Displays the list of command parameters.
List installed Distros:
wsl -l -v
Type the following command to set a distro as the new default and press Enter:
wsl --unregister DISTRO-NAME
wsl --unregister Ubuntu
Remove a Distro
winget uninstall --id "DISTRO-ID-NAME"
For example, this command removes the Ubuntu distro:
winget uninstall --id Canonical.Ubuntu