Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jkariscodes/3ddf1d5cf53dd5b5c43b06a8abb54e28 to your computer and use it in GitHub Desktop.
Save jkariscodes/3ddf1d5cf53dd5b5c43b06a8abb54e28 to your computer and use it in GitHub Desktop.
Completely Uninstall LAMP Ubuntu 20.04 LTS
#!/bin/bash
# This will remove Apache
sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin
sudo apt remove apache2.*
sudo apt-get autoremove
whereis apache2
sudo rm -rf /etc/apache2
# In some cases, remove other locations
sudo rm -rf /usr/sbin/apache2 /usr/lib/apache2 /usr/share/man/man8/apache2.8.gz
# Confirm if apache2 is still there
whereis apache2
# This will remove PHP
sudo apt-get purge `dpkg -l | grep php7.2| awk '{print $2}' |tr "\n" " "` -y
sudo apt-get purge php7.*
sudo apt-get autoremove --purge
whereis php
sudo rm -rf /etc/php
# This will remove MYSql
sudo service mysql stop
sudo apt-get remove --purge mysql-server-core-* -y
sudo apt-get remove --purge mysql-server-core-* mysql-client mysql-common -y
sudo rm -rf /etc/mysql
sudo apt-get autoremove
sudo apt-get autoclean
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment