How to Install WSL 2 on Windows 10
Windows Subsystem for Linux, commonly known as WSL, is a feature of Windows 10 that allows users to run a Linux shell environment within Windows. It can be used for developing and testing Linux software, run Linux server applications, and even run Linux GUI applications.
The latest version of WSL is WSL 2, which was released in May 2020. It brings significant performance improvements over its predecessor, WSL 1. If you are looking to install WSL 2 on your Windows 10 system, this article will guide you through the process.
Before you start, please make sure that your Windows 10 system is up to date. To update, go to Settings > Update & Security > Windows Update, and click on the Check for updates button.
Step 1: Enable WSL
First, you need to enable the WSL feature on your Windows 10 system. To do that, open PowerShell as an administrator and run the following command:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
This command will enable the necessary WSL feature on your system. Once the command completes, restart your computer.
Step 2: Install a Linux distribution
Once the WSL feature is enabled, you can install a Linux distribution of your choice. There are several Linux distributions available in the Microsoft Store, including Ubuntu, Debian, and Kali Linux.
To install a Linux distribution, open the Microsoft Store app, search for the Linux distribution you want to install, and click on the Get button. The installation may take a few minutes, depending on your system and the size of the distribution.
Step 3: Set WSL 2 as the default version
By default, when you install a Linux distribution in WSL, it uses WSL 1. To use WSL 2, you need to set it as the default version. To do that, open PowerShell as an administrator and run the following command:
wsl –set-default-version 2
This command will set WSL 2 as the default version for all Linux distributions installed in WSL.
Step 4: Update your Linux distribution
After setting WSL 2 as the default version, you need to update your Linux distribution to use WSL 2. To do that, open your Linux distribution, and run the following command:
sudo apt update && sudo apt upgrade -y
This command will update your Linux distribution and install the necessary packages to use WSL 2.
Step 5: Install the WSL 2 kernel update package
The final step is to install the WSL 2 kernel update package. To do that, download and install the latest package from the Microsoft website.
Once the installation is complete, restart your computer, and you are ready to use WSL 2.
Conclusion
WSL 2 is an excellent feature of Windows 10 that allows you to run a Linux shell environment within Windows. It brings significant performance improvements over its predecessor, WSL 1. By following the steps outlined in this article, you should be able to install WSL 2 on your Windows 10 system and start using it to develop and test Linux software or run Linux server applications.