Solarian Programmer

My programming ramblings

Install WSL - Windows Subsystem for Linux

Posted on April 15, 2017 by Paul

Updated 11 July 2018

Starting with Windows 10 Creators Update (April 2017) it is possible to use unmodified Linux binaries on Windows using the Windows Subsystem for Linux aka WSL. The advantage of WSL is that you can run Linux applications without the extra weight of a virtual machine. At the time of this writing, July 2018, WSL on Windows 10 gives you the choice between a couple Linux distributions like Ubuntu, Debian, Suse and so on. In this article I will show you how to install and use the Ubuntu 18.04 app.

There is also a video version of this tutorial:

If you want to run WSL on your Windows 10 installation, make sure that you have a 64 bits machine with a 64 bits Windows. If this is the case, check if your system is updated (you should have Windows 10 version 1803 or above). You can check what version of Windows you have by going in Settings → System → About:

Windows 10 version number and system type

Optionally, enable Developer Mode by going to Settings → Update & Security → For Developers and check Developer Mode:

Windows 10 enable Developer Mode

Next step is to go in Turn Windows features on or off, use the lower left search box to find it, scroll down and check Windows Subsystem for Linux:

Windows 10 enable Windows Subsystem for Linux

Press OK and restart the machine.

Now, open the Microsoft Store application and search for Ubuntu, select the latest stable version, which at the time of this writing is Ubuntu 18.04 and install the app:

Windows 10 Microsoft Store Ubuntu 18.04 app

Once the installation is finished, you can start the app by clicking the Ubuntu app in the Start Menu or by writing ubuntu1804 in a Command Prompt or Power Shell window.

Now, let’s make sure our WSL is updated to the latest version. Write these commands in the console window:

1 sudo apt update
2 sudo apt upgrade

Once the update is finished, you can check what version of Ubuntu is used as source for the Linux binaries with:

1 lsb_release -a

This is what I see on my machine:

1 ~ $ lsb_release -a
2 No LSB modules are available.
3 Distributor ID: Ubuntu
4 Description:    Ubuntu 18.04 LTS
5 Release:        18.04
6 Codename:       bionic
7 ~ $

In principle, you can install any command-line Linux application using:

1 sudo apt install <application_name>

For example, if you want to be able to compile C and C++ programs under WSL with GCC, you can install it with:

1 sudo apt install build-essential

You can check what version of g++ was installed with:

1 g++ --version

currently this is 7.3.0.

If, for any reason, you need to remove WSL go to Settings → Apps → Ubuntu 18.04 and select Uninstall.

In my next article, I will show you how to enhance WSL with graphical applications.

If you want to learn more about the Linux command-line applications, I would recommend reading The Linux Command Line by William E.Shotts Jr.

Show Comments