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).
> Enabling WSL on Windows
> Downloading & Installing a Linux Distro

Enabling WSL on Windows

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, then run the following PowerShell cmdlet 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 computer.

PowerShell Enable WSL

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

Downloading & Installing a Linux Distro

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 Downloading distributions

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

Microsoft Store Ubuntu WSL

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

Open WSL Ubuntu

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.

Hope this was useful, check out my WSL tag link below for more random info like this.