WSL 2 or Windows Subsystem for Linux 2 is an iterative update to Windows Subsystem for Linux 1. Being so much better than WSL 1, it is obvious that one must upgrade to WSL 2. That is what we will be checking out in this guide.
How to install Windows Subsystem for Linux 2 on Windows 10
The following are the requirements that your computer must fulfill for Windows Subsystem for Linux 2 to run properly:
- Windows 10 Build 18917 or newer.
- Hyper – V Virtualization.
Also, you will have to do the following tasks in the given order for all the features of the Windows Subsystem for Linux 2 to work:
- Enable the Optional feature.
- Install a distro.
- Enable Virtual Machine Platform optional feature.
- Configure the installed distro.
1] Enable the Optional feature
In order to enable the WSL Optional feature, open Windows PowerShell with Administrator privileges.
Execute the following command:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
If will ask for a confirmation if you want to reboot your computer, hit Y to do it straight away or to reboot it manually, hit N.
2] Install a distro
You can try to download and install a suitable Linux distro for your computer from the Microsoft Store.
3] Enable Virtual Machine Platform optional feature
Open Windows PowerShell as an Administrator and execute the following command:
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
If it asks for a confirmation, to reboot your computer, hit Y to do it straight away or to do it later, hit N.
4] Configure the installed distro
Finally, we have to configure the installed distro to WSL 2.
Open Windows PowerShell and execute this command to list all the available WSL distros on your computer:
wsl -l -v
Set the desired distro to WSL 2. execute the following command:
wsl --set-version DistroName 2
Finally, set the selected distro as default by executing the following command:
wsl --set-default-version 2
You would be experiencing the new seamless and faster experience with Windows Subsystem for Linux.
This new update to the command line utility brings in the new architecture. This will drastically improve the file system performance and the full system call compatibility. This new update is based on virtualization (which is based on Hyper – V) which works on a real Linux kernel.
You should be all set now!