How to Uninstall XAMPP in Ubuntu using Terminal

In this article, we will focus on uninstalling XAMPP from an Ubuntu system using the terminal. XAMPP is a popular software package that provides a local development environment for web developers. It includes Apache, MySQL, PHP, and Perl, making setting up a server environment on your local machine easy.

However, there might be instances where you no longer need XAMPP or wish to switch to a different development environment. Uninstalling XAMPP from your Ubuntu system allows you to clean up unnecessary files and regain valuable disk space.

In the following sections, we will provide a step-by-step guide on uninstalling XAMPP from Ubuntu using the terminal. We will cover the necessary commands and configurations to ensure a smooth removal.

So, let's proceed and learn how to uninstall XAMPP from your Ubuntu system to maintain a clean and efficient development environment and how to uninstall XAMPP in Ubuntu using a terminal, how to uninstall XAMPP in Ubuntu, how to remove XAMPP in Ubuntu, uninstall XAMPP ubuntu 22.04, ubuntu uninstall XAMPP.

There are multiple ways to uninstall XAMPP from the Linux Ubuntu system.

  1. Solution 1 – Using /opt/lampp/uninstall
  2. Solution 2 – -i cd /opt/lampp ./uninstall
  3. Solution 3 – rm -r /opt/lampp
Solution 1: Using /opt/lampp/uninstall

Open a terminal window and execute the following command. Now, let's proceed with uninstalling XAMPP. Run the following command in the terminal to remove the entire XAMPP directory.

sudo /opt/lampp/uninstall


Solution 2: -i cd /opt/lampp ./uninstall

If there is a problem with the first solution or does not uninstall XAMPP from Ubuntu. So, we can uninstall XAMPP by executing this command.

sudo -i cd /opt/lampp ./uninstall


Solution 3: rm -r /opt/lampp

Also, you can delete the lampp folder using the following command.

sudo rm -r /opt/lampp




Step 1: Stop XAMPP Services

Before uninstalling XAMPP, make sure to stop all the services running under XAMPP. Open a terminal window and execute the following command to stop Apache and MySQL services.

sudo /opt/lampp/lampp stop


Step 2: Navigate to the XAMPP Installation Directory

By default, XAMPP is installed in the /opt/lampp directory. You can verify the installation path by running the following command.

ls /opt/lampp


Step 3: Uninstall XAMPP

Now, let's proceed with uninstalling XAMPP. Run the following command in the terminal to remove the entire XAMPP directory.

sudo rm -r /opt/lampp


Step 4: Remove XAMPP Binaries and Symlinks

Next, remove any remaining XAMPP binaries and symlinks by running the following commands.

sudo rm /usr/bin/php
sudo rm /usr/bin/phpize
sudo rm /usr/bin/pear


Step 5: Remove XAMPP Data and Configuration Files

XAMPP may have created some data and configuration files that we need to remove. Run the following commands to remove them.

sudo rm -r /var/lampp
sudo rm -r /etc/php
sudo rm -r /etc/apache2


Step 6: Remove MySQL (Optional)

If you installed MySQL through XAMPP and no longer need it, you can remove it using the following command.

sudo apt remove --purge mysql-server mysql-client


Step 7: Clean Up

Finally, run the following command to clean up any unused packages and dependencies.

sudo apt autoremove


You might also like:


Techsolutionstuff | The Complete Guide

I'm a software engineer and the founder of Hailing from India, I craft articles, tutorials, tricks, and tips to aid developers. Explore Laravel, PHP, MySQL, jQuery, Bootstrap, Node.js, Vue.js, and AngularJS in our tech stack.