how to remove apache2? [duplicate]

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 ?


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.


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.