Software Engineer Standing Beside Server Racks

Remove Apache2 from Ubuntu Remote Server

How to Remove Apache2 from Remote Server or VPS having Ubuntu OS

Reclaim resources and optimize your Ubuntu server by removing Apache2 if you no longer require a web server. This guide provides a step-by-step process for uninstalling Apache2 packages and their dependencies.


  • SSH access to your Ubuntu server/VPS with root or sudo privileges.
  • Basic understanding of using the command line.


  • Stop Apache Service
service apache2 stop
  • Remove and Cleanup all apache2 packages
apt purge apache2 apache2-utils apache2.2-bin apache2-common
apt purge apache2 apache2-utils apache2-bin apache2.2-common
  • Remove other dependencies
apt autoremove
  • Check if There is any Folder or File
whereis apache2
  • Remove if found any
Syntax:- rm -r File_or_Folder_Path
Syntax:- rm -r /etc/apache2