Get Started with WSL2...
Tags: ubuntu, windows, wsl2, linux
Published: 2020-11-16 03:58:14

This post will give a complete, easy way to enable **Windows Subsystem for Linux(WSL)** and upgrade to WSL2 in your Windows 10
system.

##**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](https://github.com/microsoft/WSL2-Linux-Kernel) 

_______

##**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.

_______

###**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.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/a4c0xnrqc8es0dsoxo1u.jpg)


* 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. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9sjzqz7ppbjytz7hsx18.jpg)

* Not Sure Which version of windows you're using. Check for Windows Updates from Settings or use the [Windows Update Assistant](https://www.microsoft.com/en-in/software-download/windows10). 

_______

##**Install the WSL2..**

Let's get into the installation part.

1. Open Start from search for **Turn Windows features on or off**.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8es0bdlzl0w222qvz8tl.jpg)
2. Look for **Virtual Machine Platform** and **Windows Subsystem for linux** are checked.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xevlocvsarb76lruejhk.jpg)
3. Restart the system if needed.
4. If you're intended to use just WSL, head over to *Install the Linux Distribution*. Follow further instructions to install or update to WSL2.
5. In order to update to WSL2, you need to install the WSL2 kernel that can be find here. 

  > for x64-based machine [here](https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi)
  > for ARM64 machine [here](https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_arm64.msi)

________

###**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.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/eh7tcnjovgdorh67ypjr.jpg)
- 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.

_________

##**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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/x78wqfxwcf6wuapdhj0j.jpg)

- 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.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/61n8tcz53ba7olztsb2e.jpg)

- Once it done, you'll be welcomed with the following details

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tstdi0x1grg54p998ols.jpg)

_______

###**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.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/x93volqo7cpmef7uh5fv.jpg)

- 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](https://docs.microsoft.com/en-us/windows/wsl/install-win10). This post is mainly intended for the enthusiasts who are willing to install WSL2 on their PC.