This post will give a complete, easy way to enable Windows Subsystem for Linux(WSL) and upgrade to WSL2 in your Windows 10
WSL stands for Windows Subsystem for Linux is a project maintained by Microsoft that lets developers run supported GNU/Linux environment directly in your Windows Machine without the overhead of dual booting your PC or using a virtual Machine.
Check out more information about WSL here
The major difference between WSL and WSL2 is full support system call compatibility and increased file system performance.
According to Microsoft, WSL2 uses an actual full linux kernel running on a managed VM (virtual Machine) with fast boot times.
Enough theory, I know you're excited to install WSL in your windows machine, but before that check that your PC meets the requirements.
- At least 4GB of RAM(Recommended 8GB of RAM).
- Definitely a Windows 10 Machine.
Check your Windows Version here.
Open Command Prompt and type
winver, a pop-up will be displayed that shows enough information about the current Windows Version and Build.
- For x64 machines: Microsoft Windows Version 1903 or higher, with Build 18362 or higher (Recommended).
- For ARM64 machines: Microsoft Windows Version 2004 or higher, with Build 19041 or higher (Recommended).
Not sure of what type of machine you've, Open command prompt or powershell and type
systeminfo. The respective will be shown under "System Type". As you can see, My system is of type x64-based PC.
- Not Sure Which version of windows you're using. Check for Windows Updates from Settings or use the Windows Update Assistant.
Let's get into the installation part.
- Open Start from search for Turn Windows features on or off.
- Look for Virtual Machine Platform and Windows Subsystem for linux are checked.
- Restart the system if needed.
- If you're intended to use just WSL, head over to Install the Linux Distribution. Follow further instructions to install or update to WSL2.
- In order to update to WSL2, you need to install the WSL2 kernel that can be find here.
With the above step, you've successfully installed the WSL2. By default, your machine is set to WSL1. The following steps will let you to configure your machine to use WSL2
- Open Powershell as adminstrator and enter the following command
wsl --set-default-version 2
- If you got something like this below, you're good to go with the next section.
- If you've encountered an error message such as
WSL 2 requires an update to its kernel component. For information please visit https://aka.ms/wsl2kernel.You still need to install the kernel or try reinstalling the kernel after restarting the PC. (Still got errors comment down with the screenshot of error message. Happy to help)
Congratulations🎉!, with that steps done, you've successfully configured your machine to use WSL2 and lest with only one step i.e., Installing Linux distro.
Microsoft store has a lots of linux distros that are readily available to download. I'll go with Ubuntu 20.04 LTS
- Download the package from Microsoft Store
- When it got installed, open the app and let the package set everything for you. Once it done, you'll be asked to enter new UNIX name and set a password.
- Once it done, you'll be welcomed with the following details
These steps will let you know whether Ubuntu 20.4(in my case) is running on WSL2 or not.
- Let the Ubuntu 20.04 app be running. Open cmd or powershell and enter the following command
wsl -l -v
You're free to set your linux distro to either WSL or WSL2 by using the following command
wsl --set-version <distribution name> <versionNumber>
<versionNumber>should be either 1 or 2
Congratulations!🎉, with that steps done, you've successfully configured and installed WSL2 on your windows machine.
Feel free to comment down any type of doubts/issues you've encountered. Would ❤️ to help.
Find this insightful🤔 Give a ❤️ & share the knowledge with your friends.
NOTE: The above information shared with you is written by studying the original docs of WSL Installation guide for Windows 10 and some parts like commands are extracted from the docs. You can find the original docs here. This post is mainly intended for the enthusiasts who are willing to install WSL2 on their PC.