Can't remove Apache2

Asked by Craig Bakalian on 2011-08-23

I installed apache2. It didn't configure correctly with mysql or php. I uninstalled, but it is still there. Now I cannot install or reinstall. Purging is not working. How do I uninstall apache2. I am also having difficulty uninstalling mysql. So, basically how do I purge the LAMP stack and start over?

Question information

English Edit question
Ubuntu apache2 Edit question
No assignee Edit question
Last query:
Last reply:
enubuntu (mr.tennents) said : #1

Try to do this:

1. Open a terminal hitting CTRL+ALT+T
2. Enter these commands:
sudo apt-get install apache2
sudo apt-get remove --purge apache2 apache2-utils

Craig Bakalian (craigbakalian) said : #2

Great! I am getting a 404 (unable to connect) when I do http://localhost/ But one more thing. Do I need to remove the var/www folder? Should I delete the entire /etc/apache2 folder?

enubuntu (mr.tennents) said : #3

So the previos commands is for remove apache, if you want install it retype:
sudo apt-get install apache2

No, the /var/www folder is automatically delete when you run:
sudo apt-get remove --purge apache2 apache2-utils
the /etc/apache2 folder too.

enubuntu (mr.tennents) said : #4

Hel yourself with this if you want to install Apache:

Craig Bakalian (craigbakalian) said : #5

I did do --

sudo apt-get install apache2
sudo apt-get remove --purge apache2 apache2-utils

but the /var/www/ folder is still there
and the /etc/apache2 folder is still there

can I manually delete them?
What will manually deleting them do?

enubuntu (mr.tennents) said : #6

Absolutely nothing, you can remove it if you don't want to use Apache.
For remove just type this in terminal:
sudo rm -rf /var/www/
sudo rm -rf /etc/apache2

Craig Bakalian (craigbakalian) said : #7

Now that I have completely removed (hopefully) the LAMP stack, what is the best and easiest way to install the LAMP stack. Is the tasksel method the best way to go?

Hi Craig,

If you are new to the LAMP stack I personally would recommend you use Xampp.
It installs and configures the settings for you easily.

Go to and follow the instructions there.

Hope this helps.


Can you help with this problem?

Provide an answer of your own, or ask Craig Bakalian for more information if necessary.

To post a message you must log in.