How to Install and Manage Apache2 on a Linux System
For Ubuntu/Debian:
1. Update the package list:
sudo apt update
2. Install Apache2:
sudo apt install apache2
For CentOS/RHEL:
1. Install Apache (called httpd in CentOS/RHEL):
sudo yum install httpd
For Fedora:
1. Install Apache:
sudo dnf install httpd
Common systemctl
Commands for Apache:
1. Start the Apache service:
sudo systemctl start apache2 # For Ubuntu/Debian
sudo systemctl start httpd # For CentOS/RHEL and Fedora
2. Enable Apache to start on boot:
sudo systemctl enable apache2 # For Ubuntu/Debian
sudo systemctl enable httpd # For CentOS/RHEL and Fedora
3. Check the status of the Apache service:
sudo systemctl status apache2 # For Ubuntu/Debian
sudo systemctl status httpd # For CentOS/RHEL and Fedora
4. Restart the Apache service:
sudo systemctl restart apache2 # For Ubuntu/Debian
sudo systemctl restart httpd # For CentOS/RHEL and Fedora
5. Stop the Apache service:
sudo systemctl stop apache2 # For Ubuntu/Debian
sudo systemctl stop httpd # For CentOS/RHEL and Fedora
6. Reload Apache configuration without restarting:
sudo systemctl reload apache2 # For Ubuntu/Debian
sudo systemctl reload httpd # For CentOS/RHEL and Fedora
0 Comments