0

I am trying to uninstall apache2 on my Debian 7 server.

First I stop the apache2 service like this:

sudo service apache2 stop

Then I did

sudo apt-get --purge remove apache2

The response I got was:

0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded. After this operation, 29.7 kB disk space will be freed. Do you want to continue [Y/n]? Y (Reading database ... 43648 files and directories currently installed.) Removing apache2 ... mark@mw-webdev2:/etc$

So I figured it would be uninstalled, but then if I run:

sudo service apache2 start

I get this:

Starting web server: apache2.

I really can't understand what is happening here. Why does it say that it's uninstalled but it's still installed and running on my server?

  • It doesn't seem to be removed. A random idea would be that it is having trouble purging the configuration files (eh if they were chattr'd). Is there any reason you need to delete the config files too? – Peter Sep 7 '14 at 13:07
  • Hi Peter. Thanks for the reply. I don't mind so much about the configs, but I am concerned that I can still run the service even after I've supposedly uninstalled it. There must be a way to properly uninstall packages on debian? – Mark Winterbottom Sep 7 '14 at 13:10
  • Did you check the installation status of the package? E.g. with dpkg -l 'apache*' to immediately see all related packages? – Jaap Eldering Sep 7 '14 at 13:39
  • Well, you are using --purge so if you don't care about config files, I don't know why you included this argument at all. – Peter Sep 7 '14 at 15:48
  • 1
    apache2 is a metapackage which means that the package doesn't actually have anything inside it, it just exists to make it easier to properly install the correct packages by depending on those packages. You will need to remove the packages that apache2 installed in order to uninstall apache for real – DerfK Sep 7 '14 at 17:56
1

You may try to remove apache essential packages such as apache2-common or apache2.2-common. Also your init script may not be deleted.

1

At first you can see apache2 depencecies with

apt-cache depends apache2 |egrep Depends: |awk {'print $2'}

Then apply --purge with dpkg command.

  • 1
    Use apt-cache depends --installed apache2 to narrow this to the list of packages you actually have installed. – DerfK Sep 7 '14 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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