WSL Installation Step-by-Step

WSL (Windows Subsystem for Linux) is a very useful way of being able to use Linux tools on a Windows system, making it simple to get a proper, working Linux shell up and running. Now WSL2 makes it a lot faster, having an actual full Linux kernel running.

Some smart things can be done with WSL, apart from simply learning about Linux systems – Windows tools launched from shell scripts and vice versa, data can be piped between Windows and Linux applications, file access is seamless between the two environments too.

Installation is simple. You could use graphical tools, but the power of Linux is in the command line, so that’s how we’ll do this install. In an administrative Powershell, run:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

This installs the WSL system, and the Virtual Machine Platform feature brings it up to WSL2. A reboot is needed after these installs.

You can then install the Linux distribution of your choice.

The current choices are:

Distribution NamePowershell to download intaller
Ubuntu 18.04
ubuntu1804
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile ubuntu1804.appx -UseBasicParsing
Ubuntu 16.04
ubuntu1604
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile ubuntu1604.appx -UseBasicParsing
Debian
debian
Invoke-WebRequest -Uri https://aka.ms/wsl-debian-gnulinux -OutFile debian.appx -UseBasicParsing
Kali
kali
Invoke-WebRequest -Uri https://aka.ms/wsl-kali-linux-new -OutFile kali.appx -UseBasicParsing
OpenSuse Leap
opensuse-42
Invoke-WebRequest -Uri https://aka.ms/wsl-opensuse-42 -OutFile opensuse.appx -UseBasicParsing
SUSE SLES
sles-12
Invoke-WebRequest -Uri https://aka.ms/wsl-sles-12 -OutFile sles.appx -UseBasicParsing

I added Suse SLES to this table for reference, but only get it if you already know you need it, and preferably have a licence for it. Anyway, download the one(s) you want, then install them in PowerShell with the following in PowerShell, replacing debian with your filename:

add-AppxPackage .\debian.appx

You can then run them just by running the name in blue in the table above from Powershell or a command line. It takes a few minutes to install then asks for a username and password (while it’s installing you can see bsdtar running in task manager), confirms the password, then the Suse-based distributions also verify if you want to use the same user password for root, and you’re ready to run!

Once you’ve been through that first-run process once, they run instantly, just presenting you immediately with the shell prompt. The Linux kernels boot with Windows, so they’re always ready for action.

Before you go much further, it’s worth doing an update, as you will have a lot of missing and out-of-date packages in each distribution. In Kali, Debian, and the Ubuntus, the command is:

sudo apt-get update && sudo apt-get upgrade

On OpenSUSE Leap, its:

sudo zypper refresh && sudo zypper update

A final note, you can see which distribution(s) you have installed with:

wsl -l

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s