How to create a test Apache Web Server using CentOS 08

Ani Dhruva
4 min readJun 10, 2021

--

My team wants to test out a webpage on my CentOS 8 server. Specifically they want to know if they can access a page over the internet. My task is to install the test web server that will serve the webpage for my team on the CentOS server. I will be utilizing the puTTY program on a windows 10 PC for this task.

I will be utilizing a large CentOS 08 Cloud Playground server on Linux Academy. For context, CentOS 08 is built on RedHat Package Management, or RPM. The following is the list of steps I will be taking to achieve this task:

  1. Log-in to server
  2. Update all packages on the server using sudo yum update -y
  3. Install and activate Apache Web Server using HTTP
  4. Enable the Apache Web Server using HTTP
  5. Copy the public IP of the server and share with my team to verify access is possible.

Log-in to server

using PuTTY, I logged in as cloud_user and was prompted to change my password.

Update all packages on the server using sudo yum update -y

Always remember your user’s password!

Since we are using the sudo command, we are required to enter our password. With CentOS being a RPM-based Linux OS, we use the sudo yum update -y command. deb based operating systems may differ in the requisite command.

If it is your first time updating, it will take a while. 818 MB!!

Be prepared for a wait if this is your first update! Also to note you do not need to include the -y for the update command if you do not wish, though I have used it. Updating is a good way to ensure that you are ironing out and updating any dependencies that you might not have in sync!

Updates have been completed.

Install and Activate the Apache Web Server using HTTP

HTTPS (port 443) is used for transactional websites and in this case not necessary for what my team aims to accomplish with the server. For this reason, we will use HTTP (port 80). We will utilize the command sudo yum install httpd.

We will then double check the status of the httpd install with the command systemctl status httpd.

Active: inactive (dead). Means we must start and enable it.

If inactive, we need to turn it on and activate it with the command systemcl start httpd && systemctl enable httpd.

We must verify our credentials before we can activate.
We have successfully started and enabled the Apache HTTP server on our CentOS server.

Recheck status using systemctl status httpd.

Active: active (running) is a good sign and what we are looking for.

Enable the Apache Web Server using HTTP

We then will use the command curl localhost:80.

Running the command curl localhost:80 gives us back a series of commands.

Curl sends data to and from servers using a specified protocol. In our task we will use HTTP. This means using a certain port, and the port number to use is 80. Note: https://linuxconfig.org/redhat-8-open-and-close-ports is a fantastic resource for inquires regarding ports on CentOS or RedHat.

Copy the public IP of the server and share with my team to verify if access is possible

Now it is time to send over to the team!

--

--

Ani Dhruva
Ani Dhruva

Written by Ani Dhruva

Just a young dude who likes to write about soccer (football).

No responses yet