How to Install Windows Subsystem for Linux (WSL)

If you’re a developer or someone who prefers to work with Linux tools, but you’re stuck using a Windows operating system, then Windows Subsystem for Linux (WSL) is an excellent solution for you.

WSL is a feature in Windows 10 and later versions that allows you to run a Linux distribution natively on Windows, without the need for a virtual machine or dual-boot setup.

In this blog post, we’ll guide you through the process of installing WSL on your Windows machine.

Enable the WSL Windows Feature

The first step in installing WSL is to enable the feature on your Windows machine. To do this, follow the steps below:

  1. Open the Start menu and search for “Turn Windows features on or off.”
  2. Click on the search result that appears to open the “Windows Features” window.
  3. Scroll down to find “Windows Subsystem for Linux” and tick the checkbox next to it.
  4. Click “OK” to apply the changes.
  5. Restart your computer when prompted.

Alternatively, we can enable the WSL feature by running the following PowerShell command:

# Enable Microsoft-Windows-Subsystem-Linux Feature
PowerShellEnable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
enable wsl powershell

Install a Linux Distribution for WSL

Once you’ve enabled WSL on your Windows machine, the next step is to install a Linux distribution of your choice. You can download a Linux distribution from the Microsoft Store or through other sources, such as the official website of your preferred Linux distribution.

To download a Linux distribution from the Microsoft Store, follow these steps:

  1. Open the Microsoft Store app on your Windows machine.
  2. Search for your preferred Linux distribution (e.g., Ubuntu, Debian, Kali Linux).
  3. Click on the search result to open the Linux Distribution’s page.
  4. Click the “Get” button to download and install the Linux distribution on your Windows machine.
install WSL distro from Microsoft Store

Tip 1: How to List Installed WSL Distros & Versions

If you’ve installed multiple Linux distributions on your Windows machine, you can list them using the following command in the Windows Command Prompt or PowerShell:

# List Installed WSL Distros
wsl --l --v

This command will display a list of all installed WSL distributions, along with their version numbers and status as shown in the screenshot below.

WSL List Distros

Tip 2: How to Change Your Default WSL Distro

If you’ve installed multiple WSL distributions on your Windows machine, you can set a default distribution to be used whenever you run WSL commands. To do this, follow these steps:

  1. Open the Windows Command Prompt or PowerShell.
  2. Type the following command, replacing “DistroName” with the name of the distribution you want to set as default:
# Set Default Linux Distro WSL
wsl --set-default DistroName
  1. Press “Enter” to apply the changes. You can verify by running the command to check installed WSL distros as shown above.
change default WSL distro

Leave a Reply

Your email address will not be published. Required fields are marked *