TechLife Australia

Running Linux on Windows

-

In this column we have, for the most part, assumed that readers are using Windows for their home networking applicatio­ns. Statistica­lly speaking, most of you probably are. Unfortunat­ely for Windows users, however, many of the very best home networking apps – particular­ly server apps – are only available on Linux or other flavours of Unix.

That’s not the end of the world, however. You can still run all those apps on Windows with just a little bit of effort, and this month we’re going to look at the basics of how you can do that. This will help us in future TechLife issues, where we’ll walk through setting up some of the very best home server apps you can get.

The most obvious way is through some kind of virtual machine, like VMWare. These allow you to install Linux inside of Windows (kind of a computer inside another computer), and then you can run Linux apps on top of that.

Setting a Linux virtual machine up can be daunting, however, and typically requires the creation of virtual drives and an understand­ing of underlying hardware interactio­ns. Thankfully, in recent versions of Windows, Microsoft has given us an easier way: Windows Subsystem for Linux (WSL), recently updated to version 2.

WSL is a virtual machine, but integrated into Windows and using the underlying hardware. It will, by default, mount your real drives (C: and D:, for instance) in the mount (/mnt/) directory so that you can use them without hassle. On top of that many Linux distributi­on makers have made their products available through the Microsoft Store, so that getting, say, the Ubuntu Linux server up and running on Windows is actually relatively easy. Then, using that server, you can run all your Linux server apps almost as if they were native Windows apps.

Turning on Windows Subsystem for Linux

The first thing we need to do is turn this optional Windows feature on.

In the search bar, type ‘optionalfe­atures’, or alternativ­ely click on Start > Settings > Apps > Programs and Features > Turn Windows features on or off.

Scroll down to find Windows Subsystem for Linux and check the box next to it.

There will be a brief period of setup and you’ll be asked to reboot your computer.

Putting Ubuntu on your Windows PC

WSL provides a virtual Linux machine with a basic Linux kernel, but that’s it. If you want to actually run applicatio­ns on the device, you’re probably going to need a distributi­on as well (technicall­y, you could install everything manually, but we wouldn’t recommend it!).

Thankfully, a number of Linux distributi­ons have been made

available for WSL, and installing them is as easy as finding them in the Microsoft Store. Ubuntu, openSUSE, Debian, Kali, and SUSE have all been made available.

Let’s go through setting up Ubuntu.

Once you have WSL running on your system, open up the Microsoft Store app on your Windows computer and perform a search for Ubuntu. Click on Get to download it.

You can start it up by clicking on Launch in the store. It will also add an ‘Ubuntu’ item to your Program menu.

First steps

Launch the Ubuntu app. A console window will appear and after a moment you’ll be asked to create an account for this virtual machine. Give it a username and password – they don’t have to match your Windows ones.

Then the command line appears. You’re ready to roll. The first thing you probably want to do is perform an update. Ubuntu on WSL does not automatica­lly update, so you will have to periodical­ly run a manual update, and it’s the first thing you should do when it’s installed. To do this, type in the command line: sudo apt update

This is a Linux command that elevates your permission to superuser (which is necessary for package updates and requires your password) and goes online and searches for package updates.

The result will show a list of upgradeabl­e packages. To actually download the upgrades, type: sudo apt-get upgrade

That should download all the packages to their latest version. Once you’ve done that, Ubuntu is primed and ready to go. If you type: cd /mnt/

It will take you to the mount directory. If you then type the ls command (which is like the dir command in DOS/Windows), you’ll see that your physical Windows drives have been mounted. For example, you could go to cd /mnt/c/ to see your C: drive. This can be useful later when installing programs downloaded directly or copying content or files across to the virtual Linux computer.

Getting graphical

Most Linux server apps are controlled via a command line, config files and a web interface, and you’ll probably have to take the time to learn at least a few Linux commands. The version installed by the Windows Store is the server version of Ubuntu, which comes with no graphical user interface, and there’s no way to run graphical apps from within the console. There is, however, a way to run graphical apps using a third-party X server applicatio­n in Windows. The Ubuntu virtual machine will beam these graphical apps to the X Server and you’ll be able to use them normally.

The first thing we need to do is install a desktop interface for Ubuntu. In Ubuntu, type: sudo apt install lxde

This will download the relatively light LXDE graphical interface, and may take a while.

Once the install is done, type these in the Ubuntu console: export DISPLAY=:0 export LIBGL_ALWAYS_ INDIRECT=1

Now head to sourceforg­e.net/ projects/vcxsrv/ and download VcXsrv, an X server applicatio­n for Windows. Install and run the program.

At start, choose one large window as your option, and set the display number to 0. Then select ‘Start no client’ and leave the other options default. This will bring up a big empty window, ready to receive input from the Ubuntu virtual machine.

Now we go back to Ubuntu and launch the GUI. In the shell, type: startlxde

Over on VcXserv, the desktop interface should appear, and be usable just as if you were sitting at a Linux desktop. You can launch and run all your graphical Linux apps right here.

Of course, for most server apps on Linux you need no GUI. Many of the major ones are controlled by a web interface: you install them on the (virtual) Linux server then go to any desktop web browser to manage them. A key requiremen­t for most of these is Apache, the standard web server applicatio­n for Linux, and next month we’ll take a look at how you can install and configure your very own web server on your new Linux virtual PC.

 ??  ?? Is there a Linux server app you want to use, but don’t want to go through the trouble of setting up a Linux system? Nathan Taylor’s got you covered.
You’ll have to turn on the optional Windows feature.
Is there a Linux server app you want to use, but don’t want to go through the trouble of setting up a Linux system? Nathan Taylor’s got you covered. You’ll have to turn on the optional Windows feature.
 ??  ?? Get Ubuntu from the Microsoft Store.
Get Ubuntu from the Microsoft Store.
 ??  ?? In VcXsrv set Display to 0, to match the settings in Ubuntu.
In VcXsrv set Display to 0, to match the settings in Ubuntu.
 ??  ?? That’s the Linux version of LibreOffic­e, running on LXDE in a VcXserv window from an Ubuntu virtual machine in Windows.
That’s the Linux version of LibreOffic­e, running on LXDE in a VcXserv window from an Ubuntu virtual machine in Windows.
 ??  ?? Update the system.
Update the system.
 ??  ?? Ubuntu has started. Just create an account.
Ubuntu has started. Just create an account.

Newspapers in English

Newspapers from Australia