7

Well i installed apache2 by typing

sudo apt-get install apache2

now i am tring to uninstall apache2 by this command

sudo apt-get autoremove apache2

Well my apache2 is still running. And when i stop it vie typing

sudo service apache2 stop

it stops, and i can also start it typing

sudo service apache2 start

Whats the point of auto remove anyway? and how to remove apache2 ?

2 Answers2

14

Try the following command to uninstall and remove configuration files.
You need to stop the apache service BEFORE you uninstall.

sudo apt-get purge apache2*

If you have the service running but not installed (according to apt), stop the service and reinstall, then issue the command above.

NGRhodes
  • 9,490
3

You want remove or purge, not autoremove so:

sudo apt-get remove apache2

purge will attempt to remove configuration as well as the installed files (can be dangerous if you're planning on reinstalling).

autoremove is just there to remove automatically installed but now not currently required dependencies. So after you remove Apache, a sudo apt-get autoremove will probably remove some of the things that only Apache needed.

Oli
  • 293,335
  • nihan@heel:~/dev/app/website$ sudo apt-get remove apache2 Reading package lists... Done Building dependency tree Reading state information... Done Package 'apache2' is not installed, so not removed But i can start and stop it! – Katrina Mcmahon Oct 08 '13 at 08:44
  • @KatrinaMcmahon: because it will be removed only when you restart your system. Do it once and check whether it is removed completely or not? – Saurav Kumar Oct 08 '13 at 08:49
  • No, it's because the binary is actually in a dependency package (apache2-mpm-prefork) so an autoremove after removing apache2 should do the trick. This all sounds familiar because I've already answered this elsewhere. That's the question I've closed this one against. – Oli Oct 08 '13 at 08:50
  • +1 for answering the other parts of the question – TripleAntigen Oct 04 '14 at 04:10