How to Install WSL 2 (Windows Subsystem for Linux) on Windows 10

How to Install WSL2 (Windows Subsystem for Linux) on Windows 10

[powerkit_collapsible title=”Looking to install WSL 1 instead?”]
How to Install WSL (Windows Subsystem for Linux) on Windows 10
[/powerkit_collapsible]

In 2017, Microsoft released the first version of WSL enabling users to run Linux commands on their Windows 10 system. WSL2 (Windows Subsystem for Linux version 2) is the latest release and is meant to replace WSL 1.

Unlike the previous version, WSL 2 uses a lightweight virtual machine enabling users to run Linux natively on Windows 10.

Therefore, unlike WSL 1, this new version allows you to interact with an actual Linux kernel. That improves app compatibility and leverage GPU-intensive tasks while still maintaining the same experience as WSL 1.

Hardware and Software Requirements for Installing Windows 10

Unlike WSL 1 fast and straightforward installation process, WSL 2 can be a little demanding. To install WSL 2 on Windows 10, you will need the following:

  • Windows 10 versions 1903, 1909, 2004, 20H2, or any other higher version
  • A PC with Hyper-V Virtualization support

If you are running Windows 10 May 2019 (1903) or Windows 10 November 2019 (1909), you will need to install Windows Update KB4566116 first before installing WSL 2.

[powerkit_alert type=”warning” dismissible=”false” multiline=”false”]If you don’t meet the two requirements above, you won’t be able to install WSL 2 on your system. However, you can still install WSL 1 and experience the thrill of running Linux on your system.[/powerkit_alert]

Install WSL2 on Windows 10

Step 1: Enable Windows Subsystem for Linux

There are two ways to enable the Windows Subsystem for Linux feature on your system. One is a command-line method that requires you to execute commands on the Windows Powershell, while the other is graphical and doesn’t require any commands.

If you want the command-line method, launch PowerShell as an administrator and execute the command below:

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

word image 39

Alternatively, if you don’t want to use PowerShell, search for Turn Windows Features on or off in the Windows Search bar (Win key + S) and hit Enter.

On the Windows Features window that appears, scroll down and check the box next to Windows Subsystem for Linux.

word image 40

Click OK and restart your PC to apply the changes.

Up to here, we are done with Step 1. If you wanted to install WSL 1, you could skip to Step 4. However, since we are dealing with WSL 2, we now need to ensure virtualization support is enabled on our system.

Step 2: Enable Virtual Machine Platform

[powerkit_alert type=”warning” dismissible=”false” multiline=”false”]
Important Note
For this step, your Motherboard and processor should support virtualization technology, and the feature should be enabled in the BIOS or UEFI. Therefore, if you come across an error while carrying out any step below, confirm whether your PC supports virtualization and has the feature enabled.
[/powerkit_alert]

To get started, launch PowerShell as an administrator and execute the command below to enable Virtual Machine platform for Windows 10 version 2004:

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

word image 41

If you are running Windows 10 versions (1903 and 1909), execute the command below to enable the Virtual Machine Platform.

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform –NoRestart

word image 42

To apply all the configurations we have made, please reboot your computer at this point.

With virtualization support now enabled on our system, we can now enable WSL 2 and set it as the default version.

Step 3: Set WSL 2 as the default version

To get started with WSL 2, we will first need to download the WSL 2 Kernel update. Once you have downloaded the .msi file, execute it to apply the update.

word image 43

Once done, type PowerShell on the Windows search bar, right-click on it and select Run as administrator. Now to set WSL 2 as the default architecture for our Linux distributions, execute the command below:

wsl --set-default-version 2

word image 44

Tip: If you had a distribution already installed for WSL 1, you could convert it to support WSL 2 architecture with the command below:

wsl --set-version Ubuntu-20.04 2

Remember to replace Ubuntu-20.04 with the name of your installed distribution. If you are not sure, use the wsl –l –v command to list installed distros.

Up to here, we are done setting up WSL 2 on our Windows 10 system, and we can proceed to install our first Linux distribution.

Step 4: Install a Linux distribution

You can get the Linux distros from Microsft Store.

The available distributions are Kali Linux, Ubuntu 20.04 LTS, Ubuntu 18.04 LTS, OpenSUSE Linux, Debian, Pengwin, Alpine, and Fedora Remix. For beginners, I would highly recommend Ubuntu 20.04 LTS as it is beginner-friendly and easy to use.

To install Ubuntu 20.04 LTS (Long Term Support), launch Micorosft Store and search for Ubuntu. Select your desired release and hit the Get button. The distribution will begin to download and install on your Windows 10 system.

word image 45

Use WSL 2 on Windows 10

When you install any distribution from Store, a shortcut will be added to the Windows start menu. Please search for your distribution and click on it to launch.

When you start it for the first time, it might seem a little slow, but that’s expected. It will unpack its content and install any additional packages required. When done, you will see a prompt to enter a username and password.

Please note: while typing your password, nothing will be displayed on the password field. That is a security feature present in most Linux systems.

word image 46

Conclusion

I believe this post has given you a step-by-step guide on installing and enabling WSL 2 (Windows Subsystem for Linux version 2) on Windows 10. If you come across any issue while executing any of the commands above, please feel free to comment below and we will get back to you as soon as we can.

0 Shares:
Subscribe
Notify of
guest
Receive notifications when your comment receives a reply. (Optional)
Your username will link to your website. (Optional)

0 Comments
Inline Feedbacks
View all comments
You May Also Like