Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

It seems a simple apt-get remove apache2 does not completely remove apache2 as I can still see it on one of the processes when running top. How does one remove apache2 completely on his ubuntu server?

It's not removed indeed:

~# which apache2
/usr/sbin/apache2
~# whereis apache2
apache2: /usr/sbin/apache2 /etc/apache2 /usr/lib/apache2 /usr/share/apache2 /usr/share/man/man8/apache2.8.gz

But when I do apt-get remove apache2 again:

# apt-get remove apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package apache2 is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
share|improve this question
run apt-get purge apache2. It will remove the all config files. – Manula Waidyanatha Aug 17 '12 at 10:06

2 Answers

up vote 11 down vote accepted

apache2 is a metapackage that just selects other packages. If you installed apache by installing that package, you just need to run this to clean up the automatically selected packages:

sudo apt-get autoremove

If that doesn't work, you might have installed one of the dependents manually. You can target all the apache2- packages from space and nuke the lot:

sudo apt-get remove apache2*

For future reference, to find out which package a binary is from, you can run this:

dpkg -S `which apache2`

I'd expect that to come back with apache2.2-bin

share|improve this answer
also, use --purge if you want the configuration files to be deleted as well: apt-get --purge remove apache2 – xyious Aug 17 '12 at 10:03
The last command outputs apache2-mpm-prefork: /usr/sbin/apache2 – We are the World Aug 17 '12 at 10:03
@Severus fair enough -- I was just guessing but that makes sense. Yeah I'd just use the wildcard but keen an eye on what it's going to delete. apache2-common is used by some tools that aren't the apache2 httpd so you might need to reinstall some thing after. – Oli Aug 17 '12 at 10:06

First check if you are using right package name, IMO correct package name is : apache2.x-common

If you want to completely remove the package including config files then try:

    dpkg --purge apache2.2-common
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.