Install WSL - Windows Subsystem for Linux
Posted on April 15, 2017 by Sol
With the recent release of Windows 10 Creators Update, I’ve decided that I want to test the Windows Subsystem for Linux, WSL, aka Bash on Ubuntu on Windows. WSL is a way to run unmodified Ubuntu binaries on Windows natively, using the Windows kernel instead of the Linux kernel. The advantage of WSL is that you can run Linux command-line applications without the extra weight of a virtual machine. At this time, WSL on Windows 10 Creators Update uses binaries from Ubuntu 16.04.2.
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. Ideally, you will have at least the Creators Update which is version 1703. You can check the above by going in Settings → System → About:
Next, enable Developer Mode by going to Settings → Update & Security → For Developers and check 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:
Press OK and restart the machine.
Now, open a Command Prompt window (use the search box to find it, or go to Start → Windows System → Command Prompt) and write bash:
Type “y” and wait until WSL is installed. At the end, you will be asked to provide a username and a password. I suggest to keep the username short and a single word.
Once the installation is finished, you can start WSL from any Command Prompt window by writing bash, or use the Start menu to find the application named Bash on Ubuntu on Windows:
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:
In principle, you can install any command-line Linux application using:
1 sudo apt install <application_name>
Just keep in mind that WSL is still in beta at this time and not everything works.
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 5.4.0.
If, for any reason, you need to remove WSL use this command in a normal Windows console window:
1 lxrun /uninstall /full
be careful that the above will delete everything you’ve stored on the Linux filesystem.
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.comments powered by Disqus