How to Install WSL2 on Windows

WSL or Windows Subsystem for Linux lets developers run Linux environment on windows. You can run Linux tools and apps on windows with the help on WSL. There are two versions of WSL and we will install WSL2 in this tutorial which is the latest version and is recommended by Microsoft.

There are multiple ways to install WSL. You can directly download an Linux distribution from windows store and it will install WSL2 and your chosen Linux distribution.

The way recommended by Microsoft is by using command line. In this tutorial we will install WSL using command prompt.

Step 1: Open command prompt

Type command prompt in the search box on the taskbar. If you do not have a search box then you can click on the search icon and start typing. If you do not have that too. You can click on the windows button and start typing command prompt to search for it.

Once you find the command prompt right click on it and click on the run as administrator on the popup menu.

Step 2: Install WSL2

Run following command in the command prompt window to install WSL2. This command will also install ubuntu which is the default Linux distro for WSL. You can always install other distros afterward.

wsl --install

Windows will start downloading and installing the WSL2 and then Ubuntu to set up the Linux environment.

Step 3: Set up UNIX user and password

After the installation it will ask for a Unix username. You can choose any username it does not have to be same as windows username. Type your username and press enter.

After the username it will ask for password. Type a password of your choice for this user and press enter.

ubuntu install choose username

If everything goes well WSL2 and ubuntu will be successfully installed on your system.

You can verify WSL by using this command

wsl --status 

This is will you a screen like the pic below.

I you face any problem please comment below.