Saturday, December 22, 2012

Linux/Unix(Debian):Remove apache2 completely and perform fresh install

It is often difficult to completely uninstall an apache webserver installation on linux os. Using just apt-get remove --purge apache2 will lead to incomplete uninstallation of apache webserver, as the related binaries and configurations are not removed.

It is very important to find out which packages related to apache are installed on your system.To do so,just use the following command
dpkg --get-selections|grep apache2

This command will list out some packages like this

apache 2.2-common
apache 2.2-bin  

Now the next step would be to remove/purge all these packages.For doing this use this command

apt-get remove --purge apache 2.2 xxxx ....

where xxxx are the installs generated from the previous command.You can specify all the installs in this command by seperating each of them with a space.

After the purging is completed,you might manually need to remove some files/directories.To find out which files/directories we need to remove,we use the locate command.Type the following command on the console

locate -e apache2

This will show you all the files related to apache2 still present on the system.You can now manually remove the files/directories.

This completes the procedure to remove the apache webserver from your system. To perform a fresh install just use apt-get install apache2


Anonymous said...

thanks a lot man.. u saved a lot of time

Anonymous said...

thanks a lot man.. u saved a lot of time

Siddharth Deo said...

Always a pleasure.