3 Easy Steps To Install Windows Subsystem For Linux

One can use Linux systems like Ubuntu on a PC by Dual Booting Linux, Installing Linux in Virtual Machine, or Installing Linux as main OS. But, using Windows Subsystem For Linux, you can install Linux distributions alongside Windows 10 or Windows 11.

Windows subsystem for linux




What Is WSL ?

Windows Subsystem For Linux (WSL) is a tool developed by Microsoft that allows users to install and run GNU/Linux distros directly on Windows without dual-booting or using virtual machines. Anyway after the successful installation of a Linux distro, one can only use the Linux command line along with CMD and Powershell on Windows. WSL does not provide a full Linux desktop experience.

Windows Subsystem For Linux is great for the developers who are using Windows as a primary operating system and have a great Linux shell experience. One can use all the Linux commands or install Linux packages using the respective package manager of the Linux distro installed. With the help of Windows Subsystem For Linux bash scripting to automate tasks is also possible.




WSL & WSL 2

There are two versions of the Windows Subsystem for Linux: WSL 1 and WSL 2.

  • WSL 1 is the older version of Windows Subsystem For Linux . It is slow as compared to WSL 2 but accesses files from Windows faster than WSL 2. It also supports access to a USB device or a serial port while WSL 2 does not supports accessing serial ports.
  • WSL 2 is the latest version that uses virtualizaton technology to run Linux kernel. It increases file system performance and supports full system call compatiability. With the help of full system compatiability app like Docker can also be run inside Windows Subsystem For Linux.




Install Windows Subsytem For Linux

Step 1 : Enable Windows Subsystem For Linux

There are two ways to enable Windows Subsystem For Linux in Windows, first one is by executing a command in PowerShell. The second one is by navigating to Windows features and enabling Windows Subsystem For Linux graphically.

Enable Windows Subsystem For Linux Using PowerShell

  • Open PowerShell as administrator.
Windows PowerShell as administrator
Run PowerShell As Administrator
  • Copy-paste the command given below in PowerShell, to enable Windows Subsytem For Linux.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Windows Subsytem for linux enabled using powershell




Enable Windows Subsystem For Linux From Windows Features

  • Open Settings and then click on Apps.
  • Click on Programs and Features that is under Related settings section.
Programs and features to enable wsl
  • On left panel, there is a option called Turn Windows features on or off. Click on it.
Windows features on/off option to enable wsl
  • Scroll down find Windows Subsytem for Linx and tick the check box.
tick windows subsystem for linux box

After you successfully enable Windows Subsystem for Linux, you need to restart your PC once but if you want to use WSL 2 you can restart after installing WSL 2. If you don’t want to update to WSL 2 directly skip to Step 3.




Step 2 : Updating WSL 1 To WSL 2

Before updating to WSL 2 make sure your PC meets the requirements given below :

  • You must be running Windows 10 or Windows 11
  • For x64 systems, Windows Version 1903 or higher, with Build 18362 or higher is required.
  • For ARM64 systems, Windows Version 2001 or higher, with Build 19041 or higher is required.
  • If you are using Windows Build below 18362 you cannot update to WSL 2. So before updating to WSL 2, update your Windows from Settings > Updates and Security > Windows Update.




Enable Virtual Machine

As I mentioned earlier, WSL 2 uses Virtualization Technology make sure you have enabled Virtual Machine Feature in your Windows.

To enable Virtual Machine Feature, Run PowerShell as Administrator and then copy-paste the code given below.

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
enabling virtual machine feature for WSL 2

After the Virtual Machine feature is enabled, restart your PC and then proceed to install WSL 2.

Install WSL 2

Now installing WSL 2 is very easy.

  • Download WSL 2 kernel by clicking here.
  • Run the installer that you’ve downloaded.

  • Click on next and then wait for few seconds to complete WSL 2 installation process.




Step 3 : Install Linux Distro

Now that we’ve enabled Windows Subsystem For Linux in our Windows system let’s install Linux distro in our Windows system.

  • Open Microsoft Store
  • Search for your Favourite Linux distro.

  • Click on Get/Install to install that Linux distro. As shown in image Below I’m installing Ubuntu.

  • After the installation is completed, click on Launch button to launch the Linux distro you installed.

  • Create a username for your Linux Distro and hit enter.
  • Specify password for the distro and hit enter.
  • Enter the password you specified again and hit enter.
  • After you complete these steps, you can start using your Linux distro in Command Line Interface ( CLI ) mode. As I told you earlier we can’t use Graphical User Interface ( GUI ) mode of Linux using Windows Subsytem for Linux.
ubuntu running in windows with the help of wsl
Ubuntu In Windows




Manually Install Linux Distro

If you are unable to download Linux distros from the Microsoft store app click the links given below to directly download them and then manually install them.

After you successfully download the distro, open PowerShell in the folder you’ve downloaded the distro. Hold the Shift button and then Right click to get Open Powershell window here option.

In PowerShell type Add-AppxPackage and then ./downloaded_file_name , For example, if the name of the downloaded file is ubuntu.appx, I need to type Add-AppxPackage ./ubuntu.appx


Add-AppxPackage ./downloaded_file_name

For Example : Add-AppxPackage ./ubuntu.appx

Once the installation is completed, You’ll be asked to enter the username and the password for the user. After you specify your username and password, you are ready to use your Linux distro in Windows with the help of Windows Subsystem For Linux.

Windows 11 Health Check – Check If Your PC Supports Windows 11




WSL Commands

One can do a lot more with WSL commands. Like, launch a Linux distro directly from PowerShell or CMD, viewing/setting which WSL version to use, and a lot more.

List all options that you can use with wsl. Type the command given below to list all the options in your terminal that you can use with WSL.

wsl -help

Check the installed Linux distros, by typing the command given below.

wsl -l
wsl -l command in windows subsystem for linux
wsl -l

You can enter a few other options too with wsl -l command, like :

  • wsl -l --all – Lists all Linux distros.
  • wsl -l --running – Lists the distros that are currently running.
  • wsl -l --quiet – Don’t print extra information, only print distro names.
  • wsl -l --verbose – Print detailed information about all distros.

Launch default distro by simply typing wsl.

wsl

Change the default distro by typing wsl -s and then the distro name that you want to make default.


wsl -s distro-name

For example: wsl -s ubuntu

Check on which Windows Subsystem For Linux version the installed distro is running by typing the command given below.

wsl -l -v
wsl -l -v command in windows subsystem for lInux
wsl -l -v

Change WSL version of Linux distro by typing wsl –set-version <distro-name> 1/2. If you specify one the WSL version will be set to 1 for that distro and if you specify 2 WSL version 2 will be used for the specified Linux distro. Changing the WSL version requires some time, so be patient. After the conversion is completed, you’ll see “Conversion Complete”message in Terminal.

wsl --set-version <distro-name> <wsl version 1/2>

For Example : wsl --set-version ubuntu 2
changing wsl version of a distro
wsl --set-version ubuntu 2

Set default WSL version for new distros using the command given below. For example, if I want all the distros that I’m going to install use WSL 2 by default, I need to type wsl --set-default-version 2 .

wsl --set-default-version <wsl-version 1/2>
changing default wsl version
wsl --set-default-version 2

Immediately terminate all running distros and the WSL 2 lightweight utility virtual machine.

wsl --shutdown

That’s it, these were some basic WSL commands that you can use while working with Windows Subsystem For Linux. To read more type wsl -help in Terminal.




Uninstalling Linux

If you want to remove the Linux distro that you installed for some reason. Follow the steps given below to uninstall Linux distro from your PC.

  • Open Settings and then Click on Apps.
  • After that click on Apps and features section.
  • In Apps and Features section search the Linux distro you want to uninstall. For example the Ubuntu distro.
  • Click the Uninstall button and then click on Uninstall button again to uinstall the Linux distro.
  • Done ! Now if you want to disable WSL too follow the steps given below.

Disabling Windows Subsystem For Linux

There are two ways to disable Windows Subsystem For Linux, the first one by executing a command in PowerShell and then the second one graphically through the Apps and features section.




Disable Windows Subsystem For Linux using PowerShell

  • Open PowerShell as administrator and then copy paste the command given below to disable Windows Subsystem For Linux .
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • Type Y and press enter to confirm that you want to disable Windows Subsystem For Linux.
  • Restart your PC.

Disable Windows Subsystem For Linux From Windows Feature

To disable Windows Subsystem For Linux from Windows Feature, follow the steps given below :

  • Open settings and then click on Apps.
  • Click on Programs and Features that is under Related settings section.
  • On left panel, there is a option called Turn Windows features on or off. Click on it.
  • Untick the Windows Subsystem For Linux.
  • Click the OK button and then click on Restart button.

After you successfully complete restarting your PC, Windows Subsystem For Linux will be disabled in your PC.

Microsoft’s Major Changes In Windows 11




Conclusion

So this is how you can install, use and uninstall the Windows subsystem for Linux. If you encounter any issue while following the steps given above, watch the YouTube video given below to see all steps performed live.

YouTube player
guest
1
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
trackback
4 months ago

[…] Kali Linux on Windows is so simple using a virtual box. In a previous article, I told you guys about installing Linux machines on windows using Windows Subsystem for Linux. But there are some limitations in the Linux machine that you have installed using WSL. So in this […]

1
0
Would love your thoughts, please comment.x
()
x