Windows Subsystem for Linux 2, also known as WSL 2, is the latest version of a compatibility layer that lets Windows users run a Linux/GNU environment on Windows. Through WSL 2, a Windows user can use Linux utilities, command-line, tools, and applications on Windows directly – without the need for a virtual machine setup. Designed by Microsoft for the sole purpose of working in harmony with Linux distros and enhancing overall productivity and experience, WSL 2 allows for the user to work on Windows 10 while having the luxury of developing Linux distributions.

Coming in as a successor to WSL 1, it was created to provide the user a noteworthy boost in performance and better system compatibility. WSL 2 offers a variety of improved features, the most striking of which are:

  • Having a managed Virtual Machine (VM)
  • Allowing for full system call ability
  • An in-built Linux Kernel

These features are the crux to what makes the switch from WSL 1 to WSL 2 a desirable experience.

Getting Started

Before we begin, we need to make sure that we have Windows 10 updated to either version 1903 with OS Build 18362 or higher (for x64 systems) or Version 2004 with OS Build 19041 or higher (for ARM64 systems). You can check your Windows version by typing winver in the search box next to the Start button.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/How-to-install-WSL-2-on-Windows-10-1.png" data-lazy- height="800" src="data:image/svg xml,” width=”1320″>

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/How-to-install-WSL-2-on-Windows-10-2.png" data-lazy- height="391" src="data:image/svg xml,” width=”449″>

If you are running an older build of Windows 10, you can update it by navigating to Settings > Updates and security > Check for updates.

You also need to ensure that your device offers adequate support for Hyper-V virtualization, which you can determine by typing Msinfo32.exe in the search box and checking your system information.

Having done that, we can begin the installation process.

Step 1. Initializing WSL

This is a crucial step to install either version of WSL. We can initialize WSL by using simple console commands.

Click on the Start button and search “Windows PowerShell”. Right-click on the first result and select Run as administrator. A console window should now appear.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/How-to-install-WSL-2-on-Windows-10-3.png" data-lazy- height="794" src="data:image/svg xml,” width=”1039″>

Enter the following command line in the console and press enter:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

The output should look something like the image below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/How-to-install-WSL-2-on-Windows-10-4.png" data-lazy- height="186" src="data:image/svg xml,” width=”957″>

Step 2. Initializing VM Platform

Unlike WSL 1, WSL 2 uses an in-built kernel. For this reason, we require the use of a Virtual Machine Platform.

Like what we did for WSL in step 1, we will run commands in Windows PowerShell to enable Virtual Machine Platform.

For Windows 10 (2004 edition):

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

For Windows 10 (Version 1903, 1909):

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/How-to-install-WSL-2-on-Windows-10-5.png" data-lazy- height="140" src="data:image/svg xml,” width=”906″>

After completing both steps 1 and 2, it is recommended to restart your device to apply changes correctly and make sure that everything works as intended.

Step 3. Configuring WSL 2 as default

After restarting your device, run Windows PowerShell as an administrator and type the following command:

wsl –set-default-version 2

In some cases, the console will ask you to update your WSL kernel. The prompt should look something like this:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/How-to-install-WSL-2-on-Windows-10-6.png" data-lazy- height="66" src="data:image/svg xml,” width=”868″>

You can download the update by visiting the link in the image above or by clicking here (for x64).

Once you are done installing, run the command again, and the default version should now be set to WSL 2.

Step 4. Install a Linux distro

Now that we are done with configuring WSL 2, it is time to install a Linux distro. Here you have a wide variety of options to choose from, each with its pros and cons. Currently, one of the most popular distros – Ubuntu 20.04 LTS – is an open-source OS that caught major traction in the Linux community. Other options include Kali Linux, Pengwin, and Fedora Remix for WSL, but it is a matter of preference more than anything.

For the sake of simplicity and wide accessibility, we will proceed with using Ubuntu 20.04 LTS as the Linux distribution for the upcoming steps.

Step 5. Getting started with WSL 2

Having installed the distro of your choice, you can access it from the recently added icons in the Start menu. Click on the icon to open Ubuntu to start the installation process. This will take a while since it is booting up for the first time, extracting all required files and packages. Make sure not to turn off your device during this process. Once it finishes booting up, you will be prompted to enter a username and a password. Fill in a username and password that you find suitable. Having done that, you are now ready to use WSL 2.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/How-to-install-WSL-2-on-Windows-10-7.png" data-lazy- height="442" src="data:image/svg xml,” width=”621″>

An alternate method to enable WSL and VM Platform (Optional)

Those of you who struggle with working on the console and are more accustomed to GUI-based configurations have the option to enable WSL and VM Platform manually. Follow the steps below to enable these features.

Firstly, click on the Start button and search for “Turn Windows features on or off”. Click on the first result. A new features window should open.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/How-to-install-WSL-2-on-Windows-10-8.png" data-lazy- height="547" src="data:image/svg xml,” width=”646″>

Scroll down and look for “Virtual Machine Platform” and “Windows Subsystem for Linux” options. Check the box to the left of the names to enable them and click OK.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/How-to-install-WSL-2-on-Windows-10-9.png" data-lazy- height="495" src="data:image/svg xml,” width=”555″>

Windows will now install the required files, after which it will ask you to restart your device to apply these changes. After the restart, proceed as instructed from Step 3 and onwards.

Additional Remarks

  • You can switch back to WSL 1 by typing wsl –set-default-version 1
  • If your device lacks Windows 10 or Hyper-V compatibility, you can still use WSL 1

Conclusion

With WSL 2 finally installed and configured, you are ready to experience the best Windows-Linux integration. You now can do all your Linux-related development without leaving the comfort of Windows 10 or going to great lengths by dual-booting your PC. Hopefully, with the ease of using Linux applications and executing Linux commands at fast speeds and optimized performance, your experience will be nothing short of gratifying.

About the author

<img alt="Zeeman Memon" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/myAvatar-150×150.png" height="112" src="data:image/svg xml,” width=”112″>

Zeeman Memon

Hi there! I’m a Software Engineer by degree, Blogger by skills who loves to write about tech, develop websites & do SEO. You can reach out to me on LinkedIn.