Step 1: Update to the latest software version list
sudo yum update
Step 2: Install Apache
sudo yum install httpd
The system should download and install the Apache software packages.
Step 3: Activate Apache
To activate Apache, start its service first.
-
Enter the following command in a terminal window:
sudo systemctl start httpdThis will start the Apache service.
-
Next, set the Apache service to start when the system boots:
sudo systemctl enable httpd
Step 4: Verify Apache Service
sudo systemctl status httpd
Step 5: Configure firewalld to Allow Apache Traffic
In a standard installation, CentOS 7 is set to prevent traffic to Apache.
Normal web traffic uses the http protocol on Port 80, while encrypted web traffic uses the https protocol, on Port 443.
-
Modify your firewall to allow connections on these ports using the following commands:
sudo firewall-cmd ––permanent ––add-port=80/tcpsudo firewall-cmd ––permanent ––add-port=443/tcp
-
Once these complete successfully, reload the firewall to apply the changes with the command:
sudo firewall-cmd ––reload
- Updated