How to Uninstall Apache2 in Ubuntu
![uninstall apache2 ubuntu](https://storage.googleapis.com/static.configserverfirewall.com/images/ubuntu/uninstall-apache2-ubuntu.webp)
We can uninstall apache2 in Ubuntu using the apt-get purge command. But first, run the dpkg -l | grep -i apache2
command to check if apache is installed on your Ubuntu server.
![check if apache is installed on your Ubuntu server](https://storage.googleapis.com/static.configserverfirewall.com/images/ubuntu/check-if-apache-is-installed.webp)
To uninstall apache2, run the following command:
apt-get purge apache2*
After that, run the apt-get autoremove
command to remove all unnecessary packages which were initially installed on Ubuntu to satisfy dependencies for the apache2 web server.
apt-get autoremove
If you want to reinstall the Apache web server, run the apt install apache2
command.