How To Install an Apache HTTP Web Server On CENTOS 8

Jarvis Bryant
4 min readJan 19, 2022

Introduction

I recently started a Cloud Career Bootcamp with an organization called Level Up In Tech. It is a six month program with coaches and fellow students designed to challenge you to be the best version of yourself, while meeting the rigorous standards of the program. For someone like myself who is transitioning from Army Logistics to Technology, I appreciate the opportunity to document some of the amazing skills I am developing on my journey to becoming a DevOps Engineer.

In this article, I will walk you through my very first hands on project. The objective is to Install an Apache HTTP Web Server On Centos 8. I will cover how to Install , Enable, Acquire the Public IP Address and check the status of an Apache Web Server in a simple, step-by-step breakdown.

Here’s What You Will Need To Complete This Project:

Internet Connectivity

Command Line Terminal

A Server with Centos 8 Installed

Access to An Account with Root or Sudo Privileges (Super User Do)

What Is Apache?

From all the web servers available, the Apache Web Server is probably one of the most popular ones. Apache is so popular that it runs 70% of all the web servers online. It is a reliable and secure web server that every system administrator should know. Apache is part of the LAMP stack that stands for Linux, Apache, MariaDB and PHP and it is commonly used in many companies to host internal and external websites.The role of the web server is to process requests and transmit information through the internet, using HTTP. Today, we are going to demonstrate how you can install Apache on CentOS 8.

LET’S BEGIN!

STEP 1: Update all packages on the Centos 8 Server

After logging into the server, we will use the packages present in the repositories themselves, so the first action will be to update the lists of packages and installed software.

To get started we will enter the command sudo yum update into the command line terminal.

You will be prompted to enter your password, enter it. The process may take a few minutes to update but when finished the system will display Complete!

Step 2: Install an Apache HTTP Web Server

Now that your update is done, you are ready to install Apache. Enter Command sudo yum install httpd . This command will prompt you to enter your password to begin installing Apache. Once the installation is finished you will see Complete!

Step 3: Enable The Apache Web Server

To enable your Apache HTTP Web Server enter the command

sudo systemctl enable httpd

To start the Apache Web Server Enter the command

sudo systemctl start httpd

Finally, make sure that your Apache Web Server is running correctly by running a simple status command

sudo systemctl status httpd

You have successfully Started, Enabled, and Checked the Status of your Apache HTTP Web Server!

Step 4: Test Your Apache Web Server

By default, Apache will run on the port 80 on your server. In order to accept HTTP connections, you are going to open port 80 on your server. Enter the command sudo firewall-cmd — zone=public — permanent — add-service=http

You will see success when the command is entered correctly.

In order for the web server to be available by external hosts, you are going to need to open specific ports on your firewall. By default, CentOS uses firewalld which is a firewall that runs as a daemon on your host and provides basic security for it.

Reload the firewall service with this command sudo firewall-cmd — reload

LET’S CHECK OUT OUR WORK!!

From this moment your Apache Web Server is already accessible from outside the CentOS 8 machine. You can access the default web page through a browser by specifying the IP address, hostname, domain, etc.

To acquire the IP address of the Centos 8, Enter the command curl -4 icanhazip.com

Your IP address will appear and and you can check your success on your web browser.

Conclusion:

This is the default page that you should see when you enter http:// with your IP Address into your web browser. This is just a standard presentation page with some basic instructions sitting on it.

CONGRATULATIONS! You have installed an Apache HTTP Web Server on Cent0S 8 !

--

--