Using the Windows Subsystem for Linux.
Windows 10 with the latest Creators Update.
Hardware: A 64-bit processor and at least 1GB free on your C drive.
“Oh Lordy, no, not that Linux again!” cries out the rightly indignant Maximum PC reader. “Stop trying to foist that beardy, communist-inspired, open-source nonsense on us!” No one wants to install a whole operating system, just to mess around with a bit of terminal-based garbage, so Microsoft did the right thing, and brought Linux inside Windows, using the Windows Subsystem for Linux. Partnering with one of the leading Linux developers, Canonical, it developed the WSL to enable you to effectively install the core of the Ubuntu Linux OS inside of Windows. No mess, no fuss, just pure, simple Windows, with added Linux on top, erm, inside.
“Why?” we hear you despairingly cry. Because developers love it. It enables them to directly install and run common open-source tools, commands, and server services without leaving Windows. It also enables you to monkey around with Linux from the comfort of Windows, without even needing to fire up a virtual machine. So it’s free, it’s easy to get up and running, won’t take up much space, it’ll expand your knowledge, and help freak out your friends! What’s not to love? Let’s give it a try, and explain how you can have some open source fun along the way.Prepare your PC
Setting up and running the WSL has become somewhat simpler than when it was first introduced back in 2016, as long as your version of Windows 10 has the Fall 2017 Creators Update, which is Windows build 16215, aka Redstone 3. The most complex step is doing the following: In search, type “powershell,” right-click this, and select “Run as administrator” (see image below). Enter the following command, and restart your system:Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-LinuxInstall Linux
Head to the Windows Store and search for “Linux.” Boom—a whole new section dedicated to Linux on Windows. Will wonders never cease? We’re only interested in Ubuntu here—OpenSUSE is another major Linux distro, but it uses a different installer system (known as package management) to Ubuntu. So choose Ubuntu, and click “Get it” (see image below). If you run into an error at this point, ensure you ran the PowerShell command, you have a 64-bit CPU, that you have the correct build of Windows 10, and it’s installed on the C: drive under “Default Save Locations” in “Settings.”Setting up Linux
Before you can do anything, you need to create a user account for Ubuntu; enter a suitable username and password. Now begin the obscure terminal incantations to start the Linux magic. These first two ensure Ubuntu has the latest packages, and is up to date, so type:sudo apt-get update sudo apt-get upgrade
You’ll see a list of scrolling text, which refers to the online repositories where Ubuntu stores OS files, ensuring you have the latest list, then ensuring Ubuntu has them installed (see below). Typically, it asks you once it’s updated them whether it’s OK to install the updates.Install a GUI
At this point, all you have is the basic Bash shell—that’s the text-based terminal to you, which is super-powerful, but more for developers and server environments, which we’re likely not living in or with. The cool part is that the Linux world uses a graphical system called X to generate its GUI. X uses a server/client model, which means you can access interfaces over network connections or across subsystems. We’ll install a Windows-based X server, and the Linux client will be able to launch GUI-based X tools.
Download and install Xming from here. Allow the firewall exception as well.Tweak Ubuntu
That’s the Windows side taken care of. On the Linux side—you’ve run Ubuntu, right?—we need to point any GUI activity at the correct display. Type:export DISPLAY=:0.0
To permanently set this display environmental variable, type:echo “export DISPLAY=:0.0” >> ~/.bashrc
That adds the directive to a script that’s run each time you start Ubuntu, technically the Bash shell part. Now we need to install a graphical program:sudo apt-get install gedit
This takes a while. Then type:gedit
To run the program.Install a desktop
If you research this online, you may find references to Dbus fixes; these are no longer required, because it’s now part of the default Ubuntu install. This means we’re able to dive in and install a Linux desktop—we’re opting for a lightweight one called Xfce4. Run each command here in turn:sudo apt install xfce4 sudo apt install gnome-themes-standard sudo apt install conkyPrep your desktop
We’re going to do a bit of housekeeping to keep things neat, so run the command:nano ~/.xinitrc
In the text editor, enter the lines of code that follow. When done, press Ctrl-O and hit Return to save it, and Ctrl-x to exit the text editor.#!/usr/bin/env bash export LANG="en_US.UTF-8” export LC_ALL="en_US.UTF-8” exec startxfce4
Run:chmod +x ~/.xinitrc
This will make the file we’ve just created executable. Then:ln -s ~/.xinitrc ~/.xsession
This will “link” that file with another standard X configuration file. Start your newly installed Linux desktop with the following command:dbuslaunch --exit-with-session ~/.xsession
On the first run, a dialog pops up—select to use the default. The Xfce4 desktop appears over the Windows 10 one, so you might want to ensure the Ubuntu window isn’t full-screen, because the window bar can be blocked. You should spot an “Application” menu top-left, there’s a dock at the bottom, with a taskbar running along the top. To quit, use the “Log out” option in the top-left menu (see image below).
You won’t find too much to play with at this point, because it’s a Linux desktop running on a largely sparse distro. You can add programs, such as Firefox, via sudo apt-get install firefox and this then appears under the “Internet” menu. Have fun!Begone Linux and other tricks
Previously, removing the WSL was a case of running PowerShell as Administrator, and typing lxrun /uninstall /full. Now, if Windows 10 is up to date, all you need to do is remove it from the Start menu/Windows Store. By the time we’ve finishing installing bits, the Linux install will be pushing 1GB, so it’s not something you’ll want hanging around your C drive.
We’re frankly doing things here with the WSL that it was never designed to do. In fact, trying to get these things working in earlier builds was far more of a bind than they are now. So, if you find you’re having a few glitches here and there, it’s to be expected.
We’re going to leave you here, but there’s plenty of other things you can do with the WSL. For instance, running sudo apt-get install compiz-core and sudo apt-get install compizconfig-settingsmanager adds a host of visual effects settings that you can monkey around with. You also might notice there’s no sound, and while it is possible to add this, it’s rather tricky, and probably not worth your hassle. Long story short: Linux uses a server/client sound system called PulseAudio, and you need to install both a Windows version (tricky), and redirect the output to your host Windows machine. Just for the pleasure of likely hearing out-of-sync sound.
This article was originally published in Maximum PC issue 149. For more quality articles about all things PC hardware, you can subscribe to Maximum PC now.