How to Uninstall Apache Server

The Apache HTTP Web server software is installed using the standard installation procedures for both Linux and Windows operating systems. However, you cannot uninstall the server software using the standard methods of software removal for each of the respective operating systems. You must first stop the Apache Web service from the command line in both Windows and Linux or the removal operation will fail. You can then run a special command to remove the server application and all configuration files.

Row of network servers in data center
Use a command line tool to remove the Apache HTTP Web Server software.
credit: scanrail/iStock/Getty Images

Uninstall from Windows

Step

Type “command” in the Windows Charms bar Search box and then click the “Command Prompt” link when it appears, to open a terminal window.

Step

Type the following command at the prompt and then press the “Enter" key to stop the Web service:

Step

net stop apache2.2

Step

Type the following command and press “Enter” to change the working directory:

Step

cd apache2\bin\

Step

Type the following command and press “Enter” to uninstall the Apache software and configuration files. The "-k" operation is used to stop, restart and uninstall the Apache service.

Step

httpd.exe -k uninstall

Uninstall from Linux

Step

Open a terminal window and then type the following command at the prompt to stop the Apache service. Press “Enter.” Type your password when prompted.

Step

sudo service apache2 stop

Step

Type the following command and press “Enter” to uninstall the Apache software.

Step

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

Step

Type the following command and press “Enter” to uninstall any remaining dependencies.

Step

sudo apt-get autoremove

Step

Type “whereis apache2“ and press “Enter” to check for any remaining Apache files or directories. You can manually delete these remnants.