How To's

Install Apache CentOS 7

2,061 views · 0 found this helpful

Was this helpful?

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.

  1. Enter the following command in a terminal window:
    sudo systemctl start httpd
    This will start the Apache service.

  2. 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.

  1. Modify your firewall to allow connections on these ports using the following commands:
    sudo firewall-cmd ––permanent ––add-port=80/tcp
    sudo firewall-cmd ––permanent ––add-port=443/tcp
  2. Once these complete successfully, reload the firewall to apply the changes with the command:
    sudo firewall-cmd ––reload
  • Updated

← All articles

Still stuck?

Our engineers answer tickets directly, 24/7.