How to Uninstall LAMP Stack Ubuntu 18.04

Tooba Malaika
2 min readOct 26, 2020

--

To uninstall PHP

sudo apt-get remove –purge php*
sudo apt-get purge php*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-php
sudo apt-get dist-upgrade

Note: The output of the below command will provide you with information the installed package software, version, architecture and short description about the package. grep command is used to find the PHP package
sudo dpkg — get-selections | grep php | cut -f 1
sudo apt-get remove — purge <package name from the previous command output>
sudo whereis php
sudo rm -rf <directory/file path from the previous command output>

To uninstall Apache

sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove
The output of the below command will provide you with information the installed package software, version, architecture and short description about the package. grep command is used to find the MySQL package
sudo dpkg — get-selections | grep apache | cut -f 1
sudo apt-get remove — purge <package name from the previous command output>
sudo whereis apache
sudo rm -rf <directory/file path from the previous command output>

To uninstall MySQL

sudo apt-get remove –purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove.
sudo apt-get autoclean.
sudo apt-get remove dbconfig-php.
sudo apt-get dist-upgrade.
The output of the below command will provide you with information the installed package software, version, architecture and short description about the package. grep command is used to find the MySQL package
sudo dpkg — get-selections | grep mysql | cut -f 1
sudo apt-get remove — purge <package name from the previous command output>
sudo whereis mysql
sudo rm -rf <directory/file path from the previous command output>

To uninstall PHPMyadmin

sudo apt-get remove –purge phpmyadmin*
sudo apt-get purge phpmyadmin*
sudo apt-get autoremove.
sudo apt-get autoclean.
sudo apt-get dist-upgrade.
The output of the below command will provide you with information the installed package software, version, architecture and short description about the package. grep command is used to find the phpmyadmin package
sudo dpkg — get-selections | grep phpmyadmin | cut -f 1
sudo apt-get remove — purge <package name from the previous command output>
sudo whereis phpmyadmin
sudo rm -rf <directory/file path from the previous command output>

--

--