This brief tutorial shows students and new users how to remove Apache and purge from Ubuntu 20.04 | 18.04.
The steps below will show you if you’re a webmaster and want to remove the Apache web server from your host.
There are two ways to uninstall or remove programs from Ubuntu and Linux systems.
You can either run the apt remove or apt purge.
When you use the remove option with apt, the command will delete the software package from the system but leave the configuration files behind.
Purge with apt will delete the software package, including all configuration files and settings.
When you want to delete Apache from Ubuntu, follow the steps below:
Remove Apache
Again, if you run apt with the remove option, it will delete Apache from the host computer but keep all configuration files intact.
If you think of removing Apache to reinstall, you may want to use the purge option.
If you simply want to remove the Apache package but critical all configuration files, then run the commands below:
sudo apt remove apache2
The commands above delete Apache but site configuration files in the /etc/apache2 directory are left alone, including the content directory at /var/www.
Purge Apache
The purge option with apt will delete Apache and all configuration files from Ubuntu.
If you want to delete Apache, including configuration files and settings, use the purge option.
The files in the/etc/apache2 directory will be removed. However, the site content at /var/www will be left alone.
Run the commands below to remove Apache along with its configuration files.
sudo apt purge apache2
Reinstall Apache
The command will delete Apache and install when you use the reinstall option with apt.
The reinstall option won’t change or delete any configuration file or the site content at /var/www.
It will simply delete and reinstall the Apache packages.
To reinstall Apache, run the commands below:
sudo apt reinstall apache2
That should do it!
Conclusion:
This post showed you how to delete, purge or reinstall Apache. If you find any error above, please use the comment form below to report.
You may also like the post below:
Leave a Reply