How can I completely uninstall LAMP installed in the Ubuntu 18.04 which is running in the VM, from the code I like to remove and make completely free now.

1 Answer 1


Assuming you are removing the "AMP" from the "LAMP" (you wouldn't like to remove the Linux, too), the following should work in most cases. The first command removes Apache, MySQL and PHP. The rest cleans up the packages that were only required by these packages. The purge removes all the configuration files, too; if you wish to preserve the configuration, use remove instead.

sudo apt-get purge apache2 mysql-server php
sudo apt autoremove
sudo apt autoclean

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .