How to Install WSL on Windows

WSL Windows

In this guide, we’ll walk you through installing Windows Subsystem for Linux (WSL) on Windows. This post also includes tips on managing your WSL environment with multiple Linux Distros installed.

WSL empowers Windows users to develop and run applications within a GNU/Linux environment with ease. 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.

You system will need to be on Windows 10 version 2004 or later (Build 19041 and above) or Windows 11 for this to work.

Installing Windows Subsystem for Linux (WSL)

1. Install WSL Feature

1.1. Install WSL Feature (without Distro)

To install WSL on the more recent versions of Windows 10 & 11, we can simply run ‘wsl‘ in our PowerShell Terminal to activate the WSL installation process.

The screenshot below shows a PowerShell session running the ‘wsl‘ command, and then the terminal recognises it’s not installed, so we proceed with the installation by accepting the authentication prompt.

wsl install

1.2. Install WSL (with Distribution)

Alternatively, as described in the MS Docs on Installing WSL, we can quickly install the WSL with Ubuntu using the command below:

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

This command installs WSL with Ubuntu as your default distro. You can install with a specific WSL Linux distribution using the ‘--distribution‘ parameter as described in the Microsoft WSL Install Docs.

2. Check Installed and Available WSL Distributions

We can run a command in our PowerShell Terminal to check installed Linux Distributions, as well as check available Linux Distros we can install. The WSL 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 a WSL Distro

We can have several different flavours of Linux distros installed on our Windows Computer using the WSL feature. By listing WSL available Linux distros as shown above, we can take the name of the distro and use that in the WSL install command.

# List available WSL linux distros for install
wsl -l -o
<# WSL Distro List >> 
-- Ubuntu,
-- Debian,
-- kali-linux,
-- Ubuntu-18.04,
-- Ubuntu-20.04,
-- Ubuntu-22.04,
-- OracleLinux_7_9,
-- OracleLinux_8_7,
-- OracleLinux_9_1,
-- openSUSE-Leap-15.5,
-- SUSE-Linux-Enterprise-Server-15-SP4,
-- SUSE-Linux-Enterprise-15-SP5,
-- openSUSE-Tumbleweed 
#>

# Install Kali Linux WSL
wsl --install Ubuntu
wsl install ubuntu

4. Changing 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.


3 responses to “How to Install WSL on Windows”

  1. […] WSL Linux Distributions by running wsl -l -o in our Windows Terminal. This is assuming you have WSL installed on your system. You can also check out this page for some information on basic WSL […]

  2. […] with Windows Terminal to expand its capabilities. A quick installation of this is done using the wsl –install command, which opens up a new realm of possibilities for cross-platform development and seamless […]

  3. […] The latest versions of Windows comes with a set of built-in WSL commands that help us utilise Windows Subsystem for Linux. To install WSL we can simply run ‘wsl –install’ in our PowerShell terminal, but for more detailed information on this see my page; Installing WSL. […]

Leave a Reply

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

Popular Posts

Blog Categories