How to Install Windows Subsystem for Linux (WSL)

In this guide, we’ll walk you through the straightforward process of installing Windows Subsystem for Linux (WSL) on your Windows 10 or 11 computer. This post includes tips on managing your WSL environment with multiple Linux Distros installed.

WSL empowers Windows users to seamlessly develop and run applications within a GNU/Linux environment. Prior to this feature release, achieving similar functionality often required the use of Virtual Machines (VMs), and dual boot setups were prevalent for those seeking local test environments.

1. Install Windows Subsystem for Linux (WSL)

To run the commands below, your system must be running Windows 10 version 2004 or later (Build 19041 and above) or Windows 11. Full instructions can be found on the MS Docs: Install WSL.

Open PowerShell as Administrator and run the following to quickly install WSL with the default Linux distribution (Ubuntu):

# Install WSL with Default Linux Distro (Ubuntu)
wsl --install

2. Check Installed & Available WSL Distributions

We can run a command in our PowerShell Terminal to check installed Linux Distributions, as well as check available Linux Distros to install.

The commands below are short versions of the --List and --Online parameters.

# List installed WSL distros
wsl -l

# List available WSL distros
wsl -l -o
WSL List Linux Distros

Alternatively, we can check installed and available WSL Distros via the Microsoft Store:

Microsoft Store Ubuntu

3. Installing Kali-Linux (WSL)

We can have many Linux Distributions installed on our computer with Windows Subsystem for Linux (WSL).

As demonstrated above, we can list the available Linux Distros to install. We can take the name of the Distro and use that in the WSL install command:

# List available WSL Distros for download
wsl -l -o

# Install Kali Linux WSL
wsl --install -d kali-linux
Install Kali Linux WSL

4. How to Change Your Default WSL Distro

If you have multiple WSL Distributions installed, you will need to specify the Linux Distribution Name on some WSL commands. For example, if we run ‘wsl‘ in our PowerShell Terminal, it’ll log us into the default distro Ubuntu.

Here’s an example of entering and exiting the 2x installed WSL distros:

Entering WSL Default Distro

To set your default WSL Linux Distribution run the following command, using the Linux Distro Name returned with the ‘wsl -l‘ command:

# List installed WSL Distros
wsl -l

# Set Default Linux Distro WSL
wsl --set-default DistroName
WSL Set Default Distro

That’s it! You’ve successfully installed WSL on your Windows machine, providing a seamless Linux environment for development and testing.

2 thoughts on “How to Install Windows Subsystem for Linux (WSL)

Leave a Reply

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