top of page
Writer's pictureVijithkumar V

Windows Subsystem for Linux (WSL)

Updated: Jul 27

What is Windows Subsystem for Linux (WSL

Windows Subsystem for Linux (WSL) is a powerful tool that helps us install a desired Linux distribution (Ubuntu, OpenSUSE, Arch Linux, etc.), without the need for an overboard installation of a virtual machine, or dual boot machine


Pre-requisites for the Installation of WSL

You should be using Windows 10 version 2004 or higher (or Build 19041 or higher) or Windows 11 if you want to run the WSL command.

One way to check is by opening the “RUN” window, and typing “winver”, as shown below.


Run command window
Run command to check the Windows' version

The window that appears shows the version of Windows that you have.


About Windows window
Windows version and Build

You can also check the Windows version using the command prompt.


Windows Command Prompt window
Commandine method to check the Windows's version and Build

Let’s look at the command a bit. Here, the “findstr” finds the strings that start with “OS Name” and “OS Version


Install WSL

Next, you need to open the “Turn Windows Features On or Off”


Turn Windows features On or Off window
Turn Windows features On or Off window

On the window that you see above, you need to turn on “Windows Subsystem for Linux” and “Virtual Machine Platform

After you turn on both the features mentioned above, the system will apply the changes and you will have to restart your machine. A restart can be avoided using the following commands to turn on “Windows Subsystem for Linux” and “Virtual Machine Platform

For Windows Subsystem for Linux,


Command Prompt Window
Commandline method to enable the Windows Subsystem foe Linux feature.

For Virtual Machine Platform,


The command prompt window
Commandline method to enable the Virtual Machine Platform

Once the supportive Windows version is in place, now with a single command we can install WSL. Open the command prompt or Powershell with administrative privileges, and enter the following command.

wsl —install

But wait!

This will by default install Ubuntu. Specifically, you can install a Linux distribution of your choice.

Before that, we can check the available Linux distribution online. So, by entering the following command, we will be able to see the all Linux distributions that we can install in WSL.


The command prompt window
List of all Linux distributions to be used for WSL

We can install a specific Linux distribution using the following command.

wsl —install —d <Linux distro>

The Windows command prompt window
Install a specific Linux distribution for WSL

After the successful installation is over, the CMD looks as follows.


The Windows command prompt window
Installation of Ubuntu 22.04 for WSL

Sometimes you may encounter an error as follows.


The Windows command Prompt window
Error message that requires a WSL2 kernel update

Here the error message says the WSL2 requires an update to its kernal component.

To update to WSL 2, you need to be running Windows 10 or Windows 11.

And following are the individual requirements for x64-based PC and Arm64-based PC.

  • For x64 systems: Version 1903 or later, with Build 18362.1049 or later.

  • For ARM64 systems: Version 2004 or later, with Build 19041 or later

To check if it is an x64 or ARM64 system, use the following command.


The Windows Command Prompt window
Checking the "System Type" using CMD

You can check the version/ build using the method mentioned in the initial segment of this article.


Download the Linux Kernal Update Package

Now, you can download the Linux kernel update package. If you want to download the update package from the Microsoft Store, use one of the following commands.

You can use either wsl.exe --install or wsl.exe --update


The Windows command Prompt window
Kernel Update

Or, depending on whether you are using the x64-based or ARM64-based PC, you can manually download and install the update package.

For x64-based PC,

For ARM64-based PC,


Set WSL2 as default

Now, WSL2 can be set as our default version using the following command.


The Windows Command Prompt window
Setting WSL2 as default

Finally, we have the terminal window


The Command Prompt window
Successful Installation of WSL on Windows

The Command Prompt window
Successful Installation of WSL

Use the Ubuntu terminal as a new tab of the Windows terminal

You can also have the Linux terminal as a new tab of the Windows Terminal. For this, when you open the Windows terminal, you may notice the downward arrow. Click it and choose the terminal window of your choice. Here, it is the Ubuntu terminal.


The Windows Powershell and list of other Terminal options.
The Ubuntu terminal alongside the Winodws PowerShell


Comentarios


bottom of page