How to Uninstall and Remove Apache2 on Ubuntu 18.04

Atleast, there are two pupular web service known so far, namely : Apache and Nginx. Sometime we need to install one of them, but sometimes we need they are running together, and sometimes we need install and uninstall all together. At this article, I will explain how to uninstall and remove the Apache2 from Ubuntu.

It seems that uninstalling Apache2 isn't as easy as putting in it. you'll have to be compelled to take away Apache2 package itself, moreover as different dependent packages and its associated configurations. Here is however you take away Apache2 cleanly on Ubuntu and Debian.

The first step is to prevent any running instance of Apache2, as a result of Apache2 won't be properly removed whereas it's running. We check the apache2 service is running and than stop it with this commands :

$ sudo service apache2 stop 


$ sudo service apache2 stop 
 
 
Then uninstall Apache2 and its dependent packages. Use purge possibility rather than take away with apt-get command. the previous possibility can try and take away dependent packages, similarly as any configuration files created by them. additionally, use autoremove possibility similarly, to get rid of the other dependencies that were put in with Apache2, however are not any longer utilized by the other package.

$ sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
$ sudo apt-get autoremove 



Finally, check if there's any configuration files or manual pages happiness to Apache2, that square measure still not removed.

$ whereis apache2 




In this instance, /etc/apache2 directory still exists. Since this directory (as well as any configuration files in it) isn't any longer necessary, move and take away it manually.

$ sudo rm -rf /etc/apache2 



I hope it can help you on installing the Apache2 web service from your Ubuntu system.

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post