In 2016, Microsoft introduced the Windows Subsystem for Linux (WSL) feature. This allowed users to run Linux tools natively on Windows, including the Linux terminal.  WSL 2, released in 2020, improves on its predecessor and offers much better performance and compatibility. The installation process has also been tremendously simplified, as demonstrated in this article.

How to Install Windows Subsystem (WSL2) for Linux?

First of all, if you’re interested in the differences between WSL1 and WSL2, the linked article covers things like their history and working mechanisms in detail. But the takeaway is that, barring a few exceptions, WSL2 is almost always the better option. As for the prerequisites, there are 3 cases. In order to use the automated install method, Windows 10 version 2004 (Build 19041) or higher is the minimum requirement. If performing a manual installation, the same requirement applies to ARM64 systems. For x64 systems, you need Version 1903 (Build 18362) or higher at the minimum.

Install WSL Command

Last year, Windows Insider preview builds introduced the ability to automate the entire installation process by just using the wsl.exe – install command. The command automates the following tasks:

Enabling the WSL and Virtual Machine Platform optional featuresInstalling the latest Linux kernelSetting WSL 2 as the defaultInstalling the default Linux distroPrompting a restart during the installation

In July 2021, this functionality was backported to older Windows versions as well, meaning all you need to do these days is execute the wsl – install command in an elevated command prompt window. There are a couple of catches, though. First, this method only works on Windows version 2004 or higher, as mentioned earlier. For older builds that support WSL2, manual installation is necessary.  Second, if no options are specified when using the command, it only installs the recommended features with the default distro (Ubuntu). Thus, we recommend getting familiar with some of the commands listed below: 

Use either of the following commands to check what Linux distros are available to install:wsl – list – onlinewsl -l -oUse the commands from above and note the distro names. Then, use either of the following commands to install WSL with a specific distro:wsl – install – distribution wsl – install -d Use the following command if you want to add more distros after the initial installation:wsl -d Use the following command to update the WSL Linux kernel:wsl – updateUse this command if you need to rollback the kernel version:wsl – update rollbackUse this command to check general info regarding your WSL configuration:wsl – status Finally, use this command to close the WSL 2 VM and all open distros:wsl – shutdown

You might also be wondering what to do after you install WSL2. Well, it’s quite simple. First, you open the installed distro from the Start Menu. Next, you set up the admin account for this specific distro. This includes setting the username and password.  We recommend updating and upgrading the packages at this point, but beyond, you’re free to do as you please. If you feel lost, the getting started with WSL documentation from Microsoft is worth checking.

Manual WSL Installation

As stated, certain earlier Windows builds will require manual installation. The process is a bit longer, but we’re doing the same things as in the prior section. Here are the necessary steps:

Troubleshooting Installation Errors

We’ve listed some common errors that users encounter during the WSL 2 installation in this section. If you’re facing some problem that’s not covered here, we recommend checking the troubleshooting guide from Microsoft for a more extensive guide.

Error 0x8007019e: Make sure the WSL optional component is enabled.Error 0x80370102 or 0x80070003: Make sure hardware virtualization is enabled from the BIOSError 0x80070003 installation failed: Ensure new programs are saved to your system drive. You can do this from Settings > System > Storage > More / Advanced Storage Settings > Change where new content is saved.Error: WSL 2 requires a kernel update: Update the WSL Linux Kernel. We’ve covered how to do this in both the automatic and manual installation sections. Additionally, make sure the Virtual Machine Platform component is enabled. Error: No installed distributions: If you haven’t already done so, obviously install a distro first. If you get said error despite this, make sure the distro was installed on the same Windows account you’re currently using. How To Install Windows Subsystem For Linux  WSL2  - 56How To Install Windows Subsystem For Linux  WSL2  - 1How To Install Windows Subsystem For Linux  WSL2  - 97How To Install Windows Subsystem For Linux  WSL2  - 14How To Install Windows Subsystem For Linux  WSL2  - 48How To Install Windows Subsystem For Linux  WSL2  - 94How To Install Windows Subsystem For Linux  WSL2  - 3