Wednesday 13 December 2017

Installing Apache into Ubuntu running on Windows Subsystem for Linux on Windows 10

Part A - Installing WSL

So in the previous post I discussed the merits of Apache and whilst installable directly onto Windows 10 there is a good case for running it on Linux. But fortunately we don't have to thanks to a new component of Windows 10 called Windows Subsystem for Linux (Wikipedia article) (hereafter WSL) which is more lightweight than a fully virtualised machine (though a VM remains an option).

Microsoft's own documentation is here. To install one can follow instruction on this web page Microsoft - Install the Linux Subsystem on Windows 10 - Microsoft Docs. However, I can supplement with some extra info and a few screenshots because not everything is spelt out and indeed some of it I didn't follow at all :) .

To install 'Windows Subsystem for Linux' one needs to go to the Control Panel->Programs and Features->Turn Windows features on or off

Taking the above update requires a reboot.

Then I opened the Windows Store. Then I searched for Ubuntu and made sure to match the one shown on the Microsoft installation web page, the correct app is published by Canonical Group Limited. Then I clicked Install and it began downloading. Ubuntu is the leading leading distribution or "Distro". Once installed I pinned to Start menu and then clicked the Launch button. A command windows opens and the installation continues

After a while I get a prompt to create a new UNIX username which I did, on the first machine I tried this there was such a long dealy I though the process had hung, but please be patient it will get there. Then it asks for a password which I entered and then confirmed. then I am dropped into a console session. Yea! Try 'cd /' and then 'ls' to see the contents of your root folder.

Part B - Installing Apache

So next we install Apache, and I followed (roughly) the instructions from Digital Ocean and at the prompt I did the following

sudo apt-get update

sudo apt-get install apache2

this completes the install. Now we start the server with

sudo /etc/init.d/apache2 start

Then in a browser naviaget to

http://127.0.0.1

and one should see the Apache2 Ubuntu Default page

By the way, to fans of Virtual Machines (VMs) who are not convinced all I can say in parting is that I had to tidy a user profile of late because it grew massive and I discovered huge VM disk images. WSL allows the native disk filing system to be mounted so there is no need for a separate disk image with WSL.

No comments:

Post a Comment