In this article, I’ll guide you step-by-step on how to install and uninstall Apache on an Ubuntu system. Apache is one of the most widely used web servers globally, known for its flexibility and performance. Whether you're setting up a new server or cleaning up your system, this guide will help you handle Apache effortlessly.
Steps to Install/Uninstall Apache in Ubuntu:
Update System Packages:
Open a terminal and run:
sudo apt update
sudo apt upgrade -y
Install Apache Web Server:
Execute the following command to install Apache
sudo apt install apache2 -y
Verify Installation:
Check the Apache service status with
sudo systemctl status apache2
Test Apache:
Open a web browser and visit:
http://your-server-ip
You'll see the default Apache welcome page if Apache is installed correctly.
Stop Apache Service:
Stop the running Apache service:
sudo systemctl stop apache2
Uninstall Apache:
Remove Apache and related dependencies:
sudo apt remove apache2 -y
sudo apt purge apache2 -y
Remove Configuration Files (Optional):
If you want to remove all configuration files and directories:
sudo rm -rf /etc/apache2
Verify Removal:
Check if Apache is completely uninstalled by running:
apache2 -v
If it returns "command not found," Apache has been removed successfully.
You might also like: