[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.
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]
Table of Contents
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
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
.
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
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
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.
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
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.
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.
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.
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.