Installing Apache HTTP Server

Step 1: Download and install Apache HTTP Server from the CentOS's default software repositories. Make sure the machine can connect to the Internet during the download and installation process.

$ sudo dnf install httpd

During the download and installation process, you might be prompted to enter the password for your user account, or enter y to confirm that you want to install Apache.

Step 2: Start Apache HTTP Server.

$ sudo systemctl start httpd

Step 3: Verify that the HTTP Server service is running.

$ sudo systemctl status httpd


Step 4: If you have set up a firewall on the server, run the following command to permanently enable HTTP service and port 80:

# sudo firewall-cmd --permanent --zone=public --add-service=http
# sudo firewall-cmd --permanent --zone=public --add-port=80/tcp

To apply the changes, reload the firewall service using the following command:

# sudo firewall-cmd --reload

To verify that the http service and port 80 were added successfully, you can run:

# sudo firewall-cmd --permanent --list-all 


Step 5: Test the Apache HTTP server by opening up a Web browser and typing in the address: http://localhost or http://your_server_ip.

The following page indicates the Apache HTTP server is installed and started successfully.

You can further test from the development PC by typing http://your_server_ip in a browser.