Remove will uninstall Apache from the system, but leave the configuration files behind. In particular, this means that site configuration files in the /etc/apache2 directory are left alone. If you have any intention of reinstalling Apache in the future, you should use the remove option instead of purge. Of course, the website files themselves, stored inside /var/www will also not be deleted during the removal process.

Open a terminal and type the following command to remove the Apache web server.

$ sudo apt remove apache2

Purge will uninstall Apache from the system, along with the configuration files inside /etc/apache2. That directory will be deleted entirely. If the /var/www is not empty, then the removal process leaves it intact, so you don’t need to worry about purge deleting your entire website. If you don’t plan to reinstall Apache in the future, and don’t need your configuration files (or have already made a backup of them), then the purge option is for you. To err on the safe side, it’s advisable to back up your website files before doing a purge anyway.

 

Open a terminal and type the following command to purge the Apache web server.

$ sudo apt purge apache2

Reinstall will remove Apache from your system and then install it again. It won’t make changes to your configuration files or /var/www directory. Rather, Apache system files are deleted and replaced. Your installation of Apache would have to be pretty screwed up to justify this option, but it’s there in case you need it.

Open a terminal and type the following command to reinstall the Apache web server.

$ sudo apt reinstall apache2

Was this answer helpful? 1 Users Found This Useful (1 Votes)