Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to remove all apache packages from my system (as I am transitioning to lighttpd).

I have these installed :

monkey@debVirtual:/etc/php5dpkg --get-selections | grep apachee]
apache2-doc                                     install
apache2-mpm-itk                                 install
apache2-utils                                   install
apache2.2-bin                                   deinstall
apache2.2-common                                install
libapache2-mod-dnssd                            install
libapache2-mod-perl2                            deinstall
libapache2-mod-php5                             install
libapache2-mod-python                           install


monkey@debVirtual:/etc/php5$ whereis apache2
apache2: /usr/sbin/apache2 /etc/apache2 /usr/lib/apache2 /usr/lib64/apache2 /usr/share/apache2 /usr/share/man/man8/apache2.8.gz

I would like to use one dpkg (or other) command to remove (totally from my system) all apache packages.

share|improve this question
up vote 2 down vote accepted

The command to remove a package and its configuration is apt-get purge. It can accept multiple package names as argument:

sudo apt-get purge apache2-mpm-itk apache2-utils apache2.2-bin and so on

It may happen that /etc/apache2 remains untouched after removal, in that case remove it manually with:

sudo rm -rf /etc/apache2

Be careful when typing this command or you may regret it.

share|improve this answer

Your Answer


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.