Getting Apache to work under Ubuntu on Windows Insider Preview build 14316

OK – so that’s a very long title to this post for what is actually a very simple solution.

Like many I’m sure I was eager to try the new build of Windows 10. The first thing I wanted to try when it first booted? Ubuntu and bash of course.

By default, it’s not installed, you have to go into Windows Update Settings, down to ‘For Developers’ and make sure ‘Developer Mode’ is switched on.

Then you have to hit windows key, type ‘Windows Features’ [enter], and scroll to the bottom of the list and tick ‘Windows Subsystem for Linux (Beta)’.

For some I gather you then need to reboot, but on my machine it didn’t.

Anyway, after all that, I thought, ooh, let’s try running Apache on Ubuntu on Windows.

First I typed ifconfig to see what ip address it had, was it different? .. well that command doesn’t work yet so I was thinking maybe apache wouldn’t work either.

So I installed with ‘apt-get install apache2′.

It installs fine, but its not running. It throws the error:

mktemp: failed to create directory via templat ‘/var/lock/apach2.xxxx…’.

Turns out that /var/lock is a symbolic link to /run/lock, which doesn’t exist.

So all you need to do is mkdir /run/lock, restart apache, and hey presto you are up.

But what IP address is it at? .. as Ubuntu is running natively on Windows there is no virtualisation so it has the same IP address as your local machine.

So browsing to localhost should do the trick. If you have another service using that port then edit /etc/apache2/ports.conf and change to a different port.

Hope that helps a few people.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>