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.
Alternatively, we can access the Windows Features windows from
Programs and Features from the left panel `Turn Windows features on or off.
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
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.
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.
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
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.
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.
- Ubuntu 16.04 LTS
- Ubuntu 18.04 LTS
- OpenSUSE Leap 15
- OpenSUSE Leap 42
- SUSE Linux Enterprise Server 12
- SUSE Linux Enterprise Server 15
- Kali Linux
- Debian GNU/Linux
- Fedora Remix for WSL
- Pengwin Enterprise
- Alpine WSL
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.
We will type
linux to the Microsoft Store search box like below. Then we will press enter which will show the search results.
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.
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.
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
We can launch the Kali Linux image for WSL by clicking to the
Launch button like below.
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.
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.
We will see the following screen where we will list the distributions name with the following command.
$ cat /etc/debian_version