Reasons why you would want to do this
- Local Apache/MySQL/PHP not working after upgrade to Ubuntu 16.04
- Local Server beyond repair, diagnosing issues takes too much time
- Simply want to completely remove LAMPP installation in order to have a fresh installation.
Requirements and scope
Important: Please run:
sudo apt-get update
Before you proceed with anything else.
Preparations to make before removal
- Backup your existing website files and database – make sure you do a dB dump of every site you are working on locally and put them in the safe place like your Desktop or external drive. This uninstallation procedure completely removes your MySQL including all databases! I recommend that you test your backup to make sure it works 🙂
- Now you have a backup, closely examine your MySQL database, there might be databases there that are used for sites but you still need it. Make sure you have a backup it also.
- In your Ubuntu 16.04 attempt to update to the very latest packages. In the command line run these two simple commands:
sudo apt-get update
sudo apt-get dist-upgrade
Complete uninstallation procedures
- Clone this repo to your local Desktop:
git clone https://github.com/codex-m/ubuntu-lampp-server-scripts.git
- Get inside the scripts directory:
cd ubuntu-lampp-server-scripts
- Make sure installer scripts are executable:
sudo chmod +x *.sh
- Login as root:
sudo -s -H
- Run the LAMPP uninstaller:
sh lampp_uninstall.sh
- Now all you need to accept all conditions there like pressing 'Y' or pressing 'Enter' key. Make sure you answer 'Y' to all command line questions there or press 'Enter' in the command line screen if ask to. When it asks to delete database for phpMyadmin, you can click 'No'. It does not matter anyway since the dB will be deleted in the succeeding commands. Always keep an eye of the uninstallation progress because it will ask for your input.
- Once its all completed and back to command line, its required to run the uninstallation script again to completely pending packages. You can do this as many times as possible. But at least twice or thrice is required.
sh lampp_uninstall.sh
- That's it your done 🙂
At this point, you can safely re-install latest PHP, MySQL, Apache again in your Ubuntu 16.04. If something in this tutorial does not work, let me know and I will update the uninstallation scripts.
Hi, thanx but issues when i try to reinstall lamp :
“ParamĂ©trage de mariadb-common (10.1.37-0+deb9u1) …
update-alternatives: erreur: le chemin alternatif /etc/mysql/mariadb.cnf n’existe pas
dpkg: erreur de traitement du paquet mariadb-common (–configure)Â :
le sous-processus script post-installation installĂ© a retournĂ© une erreur de sortie d’Ă©tat 2
Des erreurs ont Ă©tĂ© rencontrĂ©es pendant l’exĂ©cution :
mariadb-common
E: Sub-process /usr/bin/dpkg returned an error code (1)”
It seems you are using Maria dB, this tutorial assumes you are using MySQL database. I think it would work if you replace mysql-common with equivalent mariadb-common. But I have not tested this , so I would recommend to get help somewhere else or read other resources. Thanks for dropping by!
Thank you for this script, it helped me a lot after I messed up my LAMP server.