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:
- Make sure installer scripts are executable:
sudo chmod +x *.sh
- Login as root:
sudo -s -H
- Run the LAMPP uninstaller:
- 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.
- 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.