How To Uninstall LAMP in Ubuntu 9.10 Karmic Koala

January 26, 2010 by
Filed under: HowTo, linux, Ubuntu, web development 

Update: I've written a simpler procedure that will uninstall LAMP with a single command. I'm leaving this post here for historical reasons, but the process is much faster if you follow my newer post.

The most popular post on this blog is How to Install LAMP on Ubuntu 9.10. On that post, I've had a few comments asking how to remove the single command LAMP installation. Perhaps the something went wrong during the installation and you want to completely remove everything and start over. Or maybe you just decided you don't need it installed any more and don't want the extra files and processes cluttering up your system. For whatever reason, due to popular demand...

How To Uninstall LAMP in Ubuntu 9.10

Actually, I'm only going to show how to remove AMP, since I assume you want to keep the GNU/Linux part of your installation. It would be nice if the removal could be done with a single command like:


Affiliate Link
sudo apt-get remove lamp-server^

That command appears to remove most, if not all, of your Ubuntu Desktop system. So instead, let's work backwards to remove the AMP part.

Remove phpMyAdmin

The phpMyAdmin installation was the last part of my LAMP installation tutorial, so we'll remove that first. From the command line:

sudo apt-get purge libapache2-mod-auth-mysql phpmyadmin

You'll be presented with a screen asking if you want to deconfigure the database for phpMyAdmin.

Removing phpMyAdmin

Removing phpMyAdmin

Go ahead and select Yes and hit <Enter>.
You'll be asked next if you want to purge the database for phpMyAdmin.

Purge phpMyAdmin Database

Purge phpMyAdmin Database

Again, select Yes and hit <Enter>.

The next screen is a little confusing. It prompts for the database administrator password, but it gives the impression that it's installing a new database.

Enter phpMyAdmin Password

Enter phpMyAdmin Password

Enter the correct password, (you created the password when you installed phpMyAdmin), select Ok and hit <Enter>. The phpMyAdmin removal should now complete.

Remove MySQL

Now let's see if we can remove MySQL. First we'll see what packages are installed relative to MySQL. Go to your terminal and enter:

dpkg -l | grep ^ii | grep mysql-server | awk -F' ' '{ print $2 }'

My system gives this list of packages.


So let's get rid of those.

sudo apt-get purge mysql-server mysql-server-5.1 mysql-server-core-5.1

You have successfully removed MySQL Server from your system.

Remove Apache

First, we'll use a similar command like in the previous step to check what Apache packages are installed.

dpkg -l | grep ^ii | grep apache2 | awk -F' ' '{ print $2 }'

My results look like this:


So let's remove those.

sudo apt-get purge apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common libapache2-mod-php5

Apache should be gone from your system.

Cleaning up

There may be a few stray packages left on your system that you no longer need. Get rid of them with:

sudo apt-get autoremove

You're now ready to reinstall your LAMP server if that's what you want to do.


49 Responses to “How To Uninstall LAMP in Ubuntu 9.10 Karmic Koala”

  1. samba says:


  2. lokman says:

    Brilliant! Worked flawlessly. Thanks!

  3. sifuni says:

    It works!! very nice

  4. Hasim says:

    Thank you!

    worked perfectly !

  5. gfirm says:

    awesome this is the best tutorial that I got...

    thanks dude, two thumbs up for you!!!!

  6. mozepha says:

    very useful and informative - Thank you

  7. jordi says:

    Thanks for sharing ! Gracias !

  8. Thank you so much. It worked for me clearly.

  9. shimba says:

    That was fantastic. Thanx

  10. spidymac says:

    Mahalo very helpful blog!

  11. panji prasetyo says:

    thanks.. it is very usefull for me. :)

  12. yakup says:

    thnak you..

  13. cununduru says:

    This commands very useful to me thx

  14. Awesome, thanks a lot!

  15. Deepak Ludhiarich says:

    This is very useful.At last i find coorect solution of my problem thanks lot.

  16. Risman says:

    This is very helpful! Thanks a lot!

  17. Bolaji says:

    Thank you for saving me a huge amount of time

  18. Mauricio says:

    idem :D

    its so good, very very useful. it worked for me.
    Thank You.

  19. Balaji says:


    its so good, very very useful. it worked for me.

    Thank You.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>