Windows Subsystem For Linux (WSL) Installation and Usage Tutorial with Examples – POFTUT

Windows Subsystem For Linux (WSL) Installation and Usage Tutorial with Examples


Windows Subsystem For Linux is a Windows hosting container technology used to run Linux distributions on a Windows Nt Kernel. In this tutorial, we will learn what is Windows Subsystem for Linux, How To Enable/Install WSL and how to install and run different Linux distributions?

What Is Windows Subsystem For Linux?

Windows Subsystem for Linux aka WSL is a container system that can be used to run Linux distributions on a Windows operating system. This makes us run Linux commands on a Windows operating system container. WSL is used by the system administrator to test some features and especially by developers in order to run and test different tools, frameworks and programming languages.

Enable WSL From Windows Features

We can enable or install the WSL from the Windows Features menu. Windows Features windows can be opened in different ways where typing Windows Features into the Start Menu search box is like below.

Windows Features From Start Menu
Windows Features From Start Menu

Alternatively, we can access the Windows Features windows from Control Panel->Programs and Features from the left panel `Turn Windows features on or off.

Windows Features From Control Panel
Windows Features From Control Panel

We will see the following screen about Windows Features. We will find the  Windows Subsystem for Linux elements and select the checkbox and then click to the OK

Install WSL From Windows Features
Install WSL From Windows Features

The WSL feature will be automatically installed. After the installation is complete we will see the following screen which will request us to restart the system in order to complete the WSL installation. We will click to the Restart now button which will reboot the system.

Reboot Windows For WSL Installation
Reboot Windows For WSL Installation

Enable WSL From PowerShell

We can also install WSL from the PowerShell command line. We will use the Enable-WindowsOptionalFeature command. As this installation is an administrative task we need to have Administrator rights while using PowerShell. From the Start Menu we will type PowerShell which will list PowerShell shell. We will right-click to the Windows PowerShell app and click to the Run as administrator like below.

LEARN MORE  How To Find Python Version?

We will be asked to provide Administrative rights to the Windows PowerShell like below.

We will run the following command with the following options in order to install the feature named Microsoft-Windows-Subsystem-Linux with the -FeatureName option.

PS> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

We will be asked to restart the system. We can type Y and press enter which will be rebooting the system in order to enable the WSL feature.

Check WSL Installation

After the installation is complete we can check the WSL installation just typing the wsl command to a command-line interface MSDOS or PowerShell. Both will work without a problem. In the following example, we will use the PowerShell interface and after entered the wsl we will run the help command which will show help information.

PS> wsl

$ help

Select, Download and Install A Linux Distribution

Now we have the WSL but we need to download and install a Linux distribution or tool. WSL supports popular Linux distributions and tools.

We can use the Microsoft Store in order to list, select and download WSL Linux distribution. Open the Microsoft Store from the start menu like below.

Open Microsoft Store
Open Microsoft Store

We will type linux to the Microsoft Store search box like below. Then we will press enter which will show the search results.

Search Linux Images In Microsoft Store
Search Linux Images In Microsoft Store

The available Linux distributions which can be used with WSL will be listed below. We can select the Linux distribution we want to download and install. We will click on our selection.

LEARN MORE  Ubuntu, Debian, Kali Ssh Installation
Search Linux Images In Microsoft Store
Search Linux Images In Microsoft Store

In this case, we select the Kali Linux distribution. The following screen provides information about the Kali Linux. We can start download by clicking the Get button like below.

Download Kali Linux For WSL
Download Kali Linux For WSL

During the download, the download speed and the size of the Kali Linux will be listed below. In the following screen, Kali Linux size is about 201 MB and the download speed is about 8.4 Mb/s.

Download Kali Linux For WSL
Download Kali Linux For WSL

We can launch the Kali Linux image for WSL by clicking to the Launch button like below.

Launch Kali Linux
Launch Kali Linux

For the first time, we will be asked for a user name and password in order to create on the Kali Linux and use it. We will provide ismail as the user name and password.

Kali Linux Terminal On Windows
Kali Linux Terminal On Windows

Start Kali Linux with WSL

We can start the downloaded and installed Linux distribution from the Start Menu too. We will just type the distribution name and it will be listed as an application like below. In this case, we will search for the Kali Linux as below.

Start Kali Linux with WSL
Start Kali Linux with WSL

We will see the following screen where we will list the distributions name with the following command.

$ cat /etc/debian_version
Start Kali Linux with WSL
Start Kali Linux with WSL

Leave a Comment