Error while re-installing apache2 on ubuntu 14.04

Apache2ubuntu-14.04

I remove apache from my machine following these steps:

sudo apt-get remove apache2*

sudo apt-get autoremove

sudo rm -Rf /etc/apache2

I was able to remove it successfully but when I tried to install it again I got this error:

/etc/init.d/apache2: 64: .: Can't open /etc/apache2/envvars
/etc/init.d/apache2: 76: .: Can't open /etc/apache2/envvars
ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars
invoke-rc.d: initscript apache2, action "restart" failed.

I tried to fix it whit this command

sudo apt-get --purge --reinstall install apache2

but I got the same error.

Best Answer

apt-get remove does not remove configuration files, and you probably touched that file and messed it up so reinstalling without purging configuration will not work. So try this approach instead:

apt-get purge apache2

and then:

apt-get install apache2

envvars file comes in apache2 package and default should include all the necessary variables, you can brwose and check it yourself from envvars search at packages.ubuntu.com

Related Topic