Reinstall Apache2 on Ubuntu

there is some problems when i want to reinstall apache2 through aptitude / package. when i try usual apt-get remove apache2 then apt-get install apache2 i always get this message

/etc/apache2/envvars: No such file or directory
invoke-rc.d: initscript apache2, action “start” failed.

the message then says that its probably because you have deleted dir apache2. the problem is on apache2.2-common, but simple apt-get remove or dpkg –purge wont work, mostly because thera still package dependencies that prevent the package from deletion. after googling sometime i find same post that has been solved by running this command :

[php]sudo apt-get remove –purge $(dpkg -l apache* | grep ii | awk ‘{print $2}’) && sudo apt-get install apache2[/php]

that command will aslo work for usual reinstall (reinstall without any problem before)

http://www.gnulinux.in/forum/apache2-error-etcapache2envvars-no-such-file-or-directory

6 thoughts on “Reinstall Apache2 on Ubuntu”

  1. Hi, I think maybe there are a mistake on the command: you put “sudo apt-get remove –purge $(dpkg -l apache* | grep ii | awk ‘{print $2}’) && sudo apt-get install apache2″, but the right it’s “sudo apt-get remove –purge $(dpkg -l apache* | grep ii | awk ‘{print $2}’) && sudo apt-get install apache2″. The point it’s before of the “purge”.

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=""> <strike> <strong>