Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 576
bluppfisk Avatar asked Apr 07 '16 07:04

bluppfisk


People also ask

Can you run Apache in WSL?

Microsoft offers several Linux distributions for WSL2, which can be installed via the Microsoft Store once the subsystem has been activated as a Windows feature (see Install Subsystem for Linux 2 (WSL 2) on Windows 10 2004). Then you can start installing Apache, MySQL, and PHP.

How Apache server install on Windows operating system?

Step by step Apache install on Windows Download the installation media in the form of a ZIP file. Extract the contents of the Apache Web Server 2.4 zip to the file system. Locate the extracted Apache24 folder and copy this folder to the root of C:\ Open the C:\Apache24\bin folder and run the httpd.exe command.


2 Answers

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 
like image 66
Alberto.d72 Avatar answered Sep 21 '22 12:09

Alberto.d72


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

like image 24
Erez A. Korn Avatar answered Sep 18 '22 12:09

Erez A. Korn