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:
DO NOT ENTER THE FOLLOWING COMMAND!!
DO NOT DO THAT!!
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.
The phpMyAdmin installation was the last part of my LAMP installation tutorial, so we'll remove that first. From the command line:
You'll be presented with a screen asking if you want to deconfigure the database for phpMyAdmin.
Go ahead and select Yes and hit <Enter>.
You'll be asked next if you want to purge the database for phpMyAdmin.
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 the correct password, (you created the password when you installed phpMyAdmin), select Ok and hit <Enter>. The phpMyAdmin removal should now complete.
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:
My system gives this list of packages.
So let's get rid of those.
You have successfully removed MySQL Server from your system.
First, we'll use a similar command like in the previous step to check what Apache packages are installed.
My results look like this:
So let's remove those.
Apache should be gone from your system.
There may be a few stray packages left on your system that you no longer need. Get rid of them with:
You're now ready to reinstall your LAMP server if that's what you want to do.