How To Install Windows Subsystem for Linux (WSL)

To install WSL (Windows Subsystem for Linux), we first enable the WSL Windows Feature using PowerShell, then install WSL Linux Distributions via the Microsoft Store.

This post will help guide you through enabling and installing Windows Subsystem for Linux (WSL) on your local Windows computer.

WSL allows Windows users to develop and run applications within a GNU/Linux environment. Previous to this feature release we needed Virtual Machines (VMs), and dual boot setups were much more common if you wanted local test environments.

The list of available Linux Distributions for installation, current as of this post date, includes the following:

– Ubuntu 20.04 (LTS / 18.04 LTS)
– openSUSE Leap 15.1
– SUSE Linux Enterprise Server (15 SP1 / 12 SP5)
– Kali Linux
– Debian GNU/Linux
– Fedora Remix for WSL
– Pengwin (+ Enterprise)
– Alpine WSL
– Raft (Free Trial)

For more information on WSL as a whole, have a look at the MS Docs – Microsoft Documentation: What is Windows Subsystem for Linux?
https://aka.ms/wslinstall

This blog post is a demo to help you install WSL for the first time on your Windows machine. FYI, there’s a reboot of your computer required at the end of the first step (enabling WSL).

# Enable Windows Subsystem for Linux (WSL)
# Download & Install a Linux Distro

Enable Windows Subsystem for Linux (WSL)

As described above in this post, need to enable the optional WSL Windows Feature before we look at installing a Linux Distribution.

To enable WSL, we need to open PowerShell, running as Administrator.

PowerShell Run as Administrator

Then run the following PowerShell cmdlet, PowerShellEnable-WindowsOptionalFeature which will enable the Windows Subsystem.

# windows subsystem for linux enable
PowerShellEnable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
PowerShell Enable WSL

You’ll then be prompted to restart your local computer.

PowerShell Enable WSL

Reboot your Windows machine and then proceed to the next steps to install a Linux WSL distro.

Download & Install a Linux Distribution

You can find all the WSL Linux Distributions in the Microsoft Store which are available to download from there. This may be restricted by Group Policy if you’re on a Domain (a work/corporate computer).

We can also download and install Linux Distributions manually. To download a WSL Linux Distro, have a look at this MS Docs link Microsoft Documentation – Downloading distributions

In this post, we’re going for the simple Linux install option, which is done via the Microsoft Store.

Microsoft Store Linux

Select Apps within your search to filter your list, and find your desired Linux Distribution. We’re choosing Ubuntu 20.04 in this demo.

When you click to open this Ubuntu LTS App, a WSL terminal will be opened and will prompt you for a username and password for Linux.

WSL Ubuntu 20.04

We are now in our Ubuntu 20.04 instance and can now test or develop in the Linux world, on Windows.

If we close this app down and open a PowerShell or Windows Terminal, we can enter this WSL Distribution by typing wsl.

WSL Version

That about wraps things up for now on installing the Windows Subsystem.

For more useful tips on administering WSL, have a look at some of my other WSL blog posts:
# How to Reboot WSL (Windows Subsystem for Linux)
# How to Upgrade WSL from Version 1 to Version 2
# How to Change Default Linux Distro in WSL
# How to Check WSL Versions