Skip to main content

Apache HTTP Server Installation

This guide covers the essential steps to install and start Apache (httpd) on Debian/Ubuntu and CentOS systems.


Installation Steps

1. Update Package Index

sudo apt update

2. Install Apache

sudo apt install apache2 -y

3. Start and Enable Apache

sudo systemctl start apache2
sudo systemctl enable apache2

4. Check Status

sudo systemctl status apache2

5. Allow HTTP/HTTPS in Firewall (if UFW is enabled)

sudo ufw allow 'Apache Full'

6. Test in Browser

Visit: http://localhost or your server's IP address.


Uninstall Apache

sudo apt remove --purge apache2 -y
sudo apt autoremove -y

Quick Commands Reference

TaskCommand
Start Apachesudo systemctl start apache2
Stop Apachesudo systemctl stop apache2
Restart Apachesudo systemctl restart apache2
Enable on Bootsudo systemctl enable apache2
Statussudo systemctl status apache2

Tip: Default web root is /var/www/html.