Get Started with WSL2…
In this article, we will look into a complete, easy way to enable Windows Subsystem for Linux(WSL) and upgrade to WSL2 in windows 10.
1. What’s WSL?
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.
2. WSL vs WSL2?
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.
Alright, enough info, let’s dig into the installation part.
3. Tools Required.
- 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.
4. Install the WSL2..
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.
5. Set default version to WSL2
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.
6. Install a 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
Check whether your linux distro is running on WSL2.
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
- If you got something like this, Bravo🎉 your linux distro is running on WSL2.
- 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.