TechLife Australia

Installing Apache for Linux… on Windows

Make your own web server.

-

In the last issue we took a first look at one of the most useful hidden features of Windows for home networkers: the Windows Subsystem for Linux (WSL). This tool, built into Windows, allows you to run Linux apps right on your Windows desktop without the need to set up complicate­d virtualisa­tion software.

We won’t go over it again here in full, but getting it up and running is really just a two-stage process:

Go into Windows Features and enable Windows Subsystem for Linux. You can just type ‘turn windows features’ in the search bar to take you to the ‘Turn Windows features on or off’ control panel to find it.

Go to the Microsoft Store and find and download Ubuntu, which will install the server version of Ubuntu on top of WSL.

Why would you do that? Well, the fact is that many of the best server applicatio­ns, especially the best free server apps, are only available for Linux. Lychee, Squid, Jitsi Videobridg­e, ownCloud Server and many more are only available for or best used on Linux. Being able to get them running without actually needing to set up Linux is extremely useful.

As we discussed last month, what you don’t get is a graphical user interface – at least not without a little effort. There’s no virtual monitor with WSL – all you get is a Bash shell, similar to the

Windows Command Line. But you don’t really need a GUI to set up the important apps – nearly all are managed through a web interface.

Most, however, don’t come with the web interface built in. Instead they piggy back off the world’s most popular web server app, Apache. And this month we’re going to walk through setting up Apache inside WSL so that you can use these other apps – and run your own web server if you want to (though if a web server is all you’re after, you’re probably better off with Apache for Windows!)

Installing LAMP

Apache is most often installed as part of LAMP, which is a complete software stack with everything you need to run a fully enterprise­class web server. LAMP stands for Linux, Apache (the web server), MySQL (the database) and PHP (the scripting tool). Installing it is very easy. Just start Ubuntu in Windows and type the following:

sudo apt-get install lampserver^

Don’t forget the caret at the end. Once you do that, Ubuntu will run through the install script for Apache, PHP and MySQL. It will tell you how much disk space is needed, and ask you to confirm, then it will download and install the components. This might take a little while, but you can of course do other things in Windows while you wait.

web browser. You should not be able to access it from outside your home network, however – that would require forwarding ports on your home router’s firewall (a topic we’ve covered previously in this column, in the March 2020 issue).

If all is running as it should, you should see the default page for Apache in the web browser.

And that’s all there is to it really. Apache is running, and it can be used to run additional servers. You can also run your own web site from it by inserting html pages into the appropriat­e directory.

Let’s take a look at how you can do that now.

Creating and serving your own web pages

We’re not going to go into the process of creating HTML pages here, but you can create ones to test out in Word or most other text editors just by saving as HTML/a web page. This will net you an . html file (or sometimes an .htm file, which you should rename to . html). To get Apache to serve that .html file, all you have to do is copy it to the Apache www directory. You can even do that directly in Windows, without typing any command lines in Apache.

So where are the folders? Your Linux file structure is actually directly accessible in Windows, though you will have to dig deep to find it. First, you’ll have to show hidden folders: type ‘file explorer options’ in the Windows search bar. Click on the View tab, and

 ??  ?? This needs to be turned on.
This needs to be turned on.
 ??  ?? The default web page after a fresh install.
The default web page after a fresh install.
 ??  ?? You might want to pin the Linux directory to your quick access bar.
Replacing the default index. html file with one created in Word.
You might want to pin the Linux directory to your quick access bar. Replacing the default index. html file with one created in Word.

Newspapers in English

Newspapers from Australia