How to Enable WSL 2 on Windows 10
WSL 2 is the newest version of the Windows Subsystem for Linux. The previous version is now called WSL 1.
In this tutorial, We will learn how to enable WSL2 on Windows 10 and Install Linux distributions to use WSL2.
To install WSL 2 on Windows 10, Go to Start Menu | Windows System | Control Panel | Programs | Turn Windows features on or off.
Ensure that the Virtual Machine Platform and Window Subsystem for Linux features are selected before clicking the OK button.
After clicking on the OK button, Windows will enable WSL 2 on the computer, and you need to restart your PC when requested.
After the restart, we need to update the WSL kernel component. To do that, Click This Link to download the Update setup.
Once the download is complete, run the "wsl_update_x64.msi" file to install kernel updates.
After that open up a command prompt and run the following
wsl command to make WSL 2 the default Windows Subsystem for Linux (This step is optional).
wsl --set-default-version 2
Installing Linux on WSL2
For this demonstration, we are going to install Ubuntu on Windows 10. You can install any of your favorite Linux distributions as long as it is available in Microsoft Store.
Open Microsoft Store and Search Ubuntu.
Select the Ubuntu app and click the Get button to install it. After the install is done, go to the start menu and open the Ubuntu app.
Update From WSL1 to WSL2
If you have a Linux distro currently running on WSL 1, you can update it to WSL2, and one can also downgrade WSL 2 distro to WSL 1.
Open up a command prompt and run the
wsl --list -v command to list all running Linux distributions.
As you can see, I have Kali Linux running on WSL 1. Now I will upgrade it to version 2 using the
wsl command as follows:
wsl --set-version kali-linux 2
Microsoft is not planning to discontinue WSL 1. Version 1 and 2 are designed to run side by side in the same Windows System. The user can convert WSL Linux distros from one version to another, depending on the users' requirements.
Better File IO Performance and Full System Call Compatibility
Windows Subsystem Linux 2 is significantly faster than version 1. For example, If you run the apt install command to install software on your Ubuntu distro, it will take less time to install the software on WSL 2 compared to WSL 1.
Windows Subsystem for Linux 2 also introduces its own Linux kernel to fully support system call compatibility, which means now we can run a lot more Linux Apps (Like Docker) on Windows 10.
The Linux kernel is running on a lightweight utility virtual machine, and all WSL 2 Linux distributions are launched within this single lightweight utility VM.