You can completely remove Apache 2 and its related libraries from Ubuntu 22.04 or 20.04 using the command sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common; In this tutorial, we will show you how to completely uninstall Apache 2 and it’s related libraries, configured files and directories on ubuntu 22.04 system.
Here are some steps to completely uninstall Apache 2 and its related libraries on Ubuntu 22.04 system:
Step 1: Stop the Apache 2 Web Server
Before removing Apache2, you have to stop in the Ubuntu only then you can remove it, for this, you can use:
sudo systemctl stop apache2
Step 2: Uninstall Apache 2 Ubuntu 22.04
Now you can use sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common command and uninstall Apache and its associated libraries:
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
Step 3: Remove Apache Configured Files
Now you need to delete the configured directory and files related to Apache 2, for this you can use the command sudo rm -rf /etc/apache2:
sudo rm -rf /etc/apache2
Or if you want to reinstall Apache 2 and configure it in your Ubuntu system, you can follow the guide for the same, Install Apache 2 on Ubuntu 22.04.
Conclusion
You have completely removed Apache 2 from Ubuntu 22.04 system using just 3 commands as you learned in the tutorial.
If you still have any questions related to this tutorial, you can ask by commenting in the comment box below or mail me at [email protected].