Use the Ubuntu Linux distro from within Windows 10
YOU’LL NEED THIS
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 MaximumPC 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.
1 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” [ Image A]. Enter the following command, and restart your system. Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
2 INSTALL 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” [ Image B]. 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.” 3 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 [ Image C]. Typically, it asks you once it’s updated them whether it’s OK to install the updates.
4 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 [ Image D] from https://sourceforge.net/projects/xming/. Allow the firewall exception as well.
5 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. Type gedit to run the program [ Image E].
6 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 conky
7 PREP YOUR DESKTOP We’re going to do a bit of housekeeping to keep things neat, so run the command nano ~/.xinitrc and, 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 to make the file we’ve just created executable, then use ln -s ~/.xinitrc ~/.xsession to “link” that file with another standard X configuration file. Start your newly installed Linux desktop with dbus
launch --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 [ Image F].
>> 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!