bluppfisk
bluppfisk

Reputation: 2652

Installing Apache on Windows Subsystem for Linux

Having just updated to the newest Windows 10 release (build 14316), I immediately started playing with WSL, the Windows Subsystem for Linux, which is supposed to run an Ubuntu installation on Windows.

Maybe I'm trying the impossible by trying to install Apache on it, but then someone please explain me why this won't be possible.

At any rate, during installation (sudo apt-get install apache2), I received the following error messages after the dependencies were downloaded and installed correctly:

initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: No such file or directory
runlevel:/var/run/utmp: No such file or directory
 * Starting web server apache2                                                 *
 * The apache2 configtest failed.
Output of config test was:
mktemp: failed to create directory via template '/var/lock/apache2.XXXXXXXXXX': No such file or directory
chmod: missing operand after '755'
Try 'chmod --help' for more information.
invoke-rc.d: initscript apache2, action "start" failed.
Setting up ssl-cert (1.0.33) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
WARN: / is group writable!

Now, I understand that there seem to be some folders and files missing for Apache2 to work. Before I start changing anything that will mess with my Windows installation, I want to ask whether there's a different way? Also, should I worry about / being group writable or is this just standard Windows behaviour?

Upvotes: 31

Views: 48722

Answers (4)

Alpha
Alpha

Reputation: 41

Following the great advice here I edited apache2.conf and inserted the following to end of file after receiving all the various errors above and apache2 then worked great on the debian wsl package:

Servername localhost
AcceptFilter http none
AcceptFilter https none

Upvotes: 4

Alberto.d72
Alberto.d72

Reputation: 639

In order to eliminate this warning

Invalid argument: AH00076: Failed to enable APR_TCP_DEFER_ACCEP

Add this to the end of /etc/apache2/apache2.conf

AcceptFilter http none

Upvotes: 63

cetipabo
cetipabo

Reputation: 473

You have to start bash.exe in administrator mode to avoid a lot of problems related to network. i installed Lamp (Apache/MySQL/Php) without any problem :

  • Start bash.exe in administrator mode

  • type : sudo apt-get install lamp-server^

  • add these 2 lines in /etc/apache2/apache2.conf :

Servername localhost

AcceptFilter http none

then you can start apache : /etc/init.d/apache2 start

Upvotes: 16

Erez A. Korn
Erez A. Korn

Reputation: 2758

Note the following in your output

failed to create directory via template '/var/lock/apache2.XXXXXXXXXX': No such file 

I tried listing /var/lock. It points to /run/lock, which doesn't exist.

Create the directory with

mkdir -p /run/lock

The install should now work (you may need to clean the installation first)

apache running on Windows Ubuntu

Upvotes: 18

Related Questions