The most popular post on this site is the one showing how to install a LAMP server on Ubuntu. Once you're done developing your websites on your computer, you may want to remove the LAMP server from your Ubuntu installation. Actually, you probably want to leave the Linux part and only remove the AMP part, (Apache, MySQL, php).
I've done a post previously that shows how to do this in several steps, but I wanted to come up with a more automated way. So I came up with this one-liner that will remove Apache, MySQL, php, and phpMyAdmin from your Ubuntu system.
Warning: this command will uninstall the packages from your system without asking for confirmation.
If you're a bit unsure about doing this and you only want to see a list of packages that will be removed, just leave off the end portion from the last pipe onward, like this.
#
Nice, not only did it remove LAMP, but it also got rid of KDE when the usual command to remove it wasn't working. Sometimes side-effects are useful 🙂
#
thanks, worked perfectly for me. Now i can re-install lamp from the scratch.
#
Vorsicht! This tears out your Kubuntu/KDE-Desktop too! (At least on my Kubuntu 12.10)
#
You're right! I just tried it on Kubuntu 12.04 and it happened to me. It's easily fixed with:
Apparently kubuntu-desktop has some MySQL dependencies. After reinstalling it everything seems to be fine. All of my other software is still there.
#
-may i delete every folder like's apache2, php5, mysql, and phpmyadmin?
i was panic and i do that.. and my lamp was error.. they did'nt work well.. 🙁
can you give some guide,, how to reinstall my lamp ?
thanks
#
This post will help you reinstall LAMP: http://tuxtweaks.com/2012/04/installing-lamp-on-ubuntu-12-04-precise-pangolin/
#
Little heads up, this command removed my Eclipse packages and my Eclipse-platform
#
this don't will delete the var/www/ directory right?
#
Thanks so much! That made life easy. Lamp is gone!
#
thank you..
i want to reinstall my lamp
#
I am running Ubuntu 10.04 under Virtual Box on a MAC Host. I have attempted to do a LAMP installation per instructions found online. I have successfully installed everything but the PHPMyAdmin. Something is wrong with the installation, but I have no way of knowing what it is. The command line instructions for the install, were clear, the process just wouldn't complete. And I've tried to go back and re-install PHPMyAdmin several times, now it tells me there's nothing to change or update, but I cannot access PHPMyAdmin in a browser, so it was obviously unsuccessful.
I want to uninstall JUST the PHPMyAdmin and try again. Can you give me a line of code that would do that?
Thanks, WCW
#
You probably forgot to select apache2 during the configuration of phpMyAdmin during installation. You don't need to reinstall phpMyAdmin. You can fix the configuration by following the instructions here: http://tuxtweaks.com/2010/04/installing-lamp-on-ubuntu-10-04-lucid-lynx/comment-page-1/#comment-2952
If you still want to uninstall phpMyAdmin, you can do it with:
#
This would be better in a for loop (eliminating the need for xargs):
for pkg in `dpkg -l *apache* *mysql* phpmyadmin | grep ^ii | awk '{ print $2}'`; do apt-get -y purge --auto-remove $pkg; done;
#
I gave your command a try. It works as long as I add a sudo to the apt-get command so it looks like this:
What I don't like about it is that it ends up running apt-get multiple times. apt-get carries some overhead with it, so your command will take longer to execute. I did a little benchmarking to confirm my suspicion. My command takes about 45 seconds to execute on my computer while your version takes about 74 seconds. In the end, it's not a big deal either way.
It just goes to show that there are often many ways to do things. I don't tend to use for loops very often on the command line, so thanks for offering your perspective.