How to install Apache web server on CentOS 8

How To Install Apache httpd Webserver On CentOS 8

This article will show you how to install Apache http server on CentOS 8

Description

Apache is the most popular web server application on the internet. Apache is a free and open-source cross-platform web server application released under the terms of Apache License 2.0. It is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation. Apache is aslo part of the LAMP stack (Linux, Apache, MySQL, PHP) that powers much of the internet.

In this article we will expalain how to install the Apache HTTP Web Server on CentOS 8. The last stable release of Apache is version version 2.4.46 which was released on August 07, 2020.

Prerequisites

Before we are going throuht the installation steps, there are will be several prerequisite to be fulfilled, such as :

  • System running CentOS 8 Linux
  • A user account with sudo or root privileges
  • Sufficient space for Apache binnary files and internet connection

Apache HTTP Web Server Installation Steps

Update Repository

It is ussually in CentOS environment, if we are going to install new application, we have to update the CentOS software repository first. The usage of this activity is to ensure all the environemnt and software we want to install is the newest version and has been validated by the community. For this purpose, we must have root privilege, we can using sudo in every single command, or we logged in to the root user first as below.

[ramans@otodiginet ~]$ sudo dnf update
sudo dnf update

The output on our system is as follow:

Installed:
grub2-tools-efi-1:2.02-87.el8_2.x86_64
kernel-4.18.0-193.14.2.el8_2.x86_64
kernel-core-4.18.0-193.14.2.el8_2.x86_64
kernel-devel-4.18.0-193.14.2.el8_2.x86_64
kernel-modules-4.18.0-193.14.2.el8_2.x86_64
Complete!

Install Apache

After all our CentOS 8 repository software was updated, the next step is Apache installation process. The we submit the command line as below.

[ramans@otodiginet ~]$ sudo yum install httpd
sudo yum install httpd (install httpd on CentOS 8)

The output will be as below :

Installed:
apr-1.6.3-9.el8.x86_64
apr-util-1.6.1-6.el8.x86_64
apr-util-bdb-1.6.1-6.el8.x86_64
apr-util-openssl-1.6.1-6.el8.x86_64
centos-logos-httpd-80.5-2.el8.noarch
httpd-2.4.37-21.module_el8.2.0+382+15b0afa8.x86_64
httpd-filesystem-2.4.37-21.module_el8.2.0+382+15b0afa8.noarch
httpd-tools-2.4.37-21.module_el8.2.0+382+15b0afa8.x86_64
mod_http2-1.11.3-3.module_el8.2.0+307+4d18d695.x86_64
Apache httpd web server installation was succeded completed.

Start and Configuring Apache httpd Web Server

After Apache httpd webserver installation was completed done, the next step is to start and checking the httpd services. These jobs will be performed by submitting command line below.

[ramans@otodiginet ~]$ sudo systemctl start httpd
[ramans@otodiginet ~]$ sudo systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[ramans@otodiginet ~]$ sudo systemctl status httpd

The output will be as follow :

httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disa>
Active: active (running) since Sat 2020-08-15 17:45:10 PDT; 1min 1s ago
Docs: man:httpd.service(8)
Main PID: 76667 (httpd)
Status: "Running, listening on: port 80"
Tasks: 213 (limit: 23810)
Memory: 22.9M
CGroup: /system.slice/httpd.service
├─76667 /usr/sbin/httpd -DFOREGROUND
├─76677 /usr/sbin/httpd -DFOREGROUND
├─76678 /usr/sbin/httpd -DFOREGROUND
├─76679 /usr/sbin/httpd -DFOREGROUND
└─76680 /usr/sbin/httpd -DFOREGROUND
Aug 15 17:44:54 otodiginet systemd[1]: Starting The Apache HTTP Server…
Aug 15 17:45:10 otodiginet httpd[76667]: AH00558: httpd: Could not reliably determine >
Aug 15 17:45:10 otodiginet systemd[1]: Started The Apache HTTP Server.
Aug 15 17:45:21 otodiginet httpd[76667]: Server configured, listening on: port 80
Start enable and check the status of web server httpd service

Test Apache Web Server

New Apache installation has a default test page, and aso we can create a custom test page. We will see the default testing page. For this purpose we have to find your IP address web server. The IP address could be find by submitting command line below.

[ramans@otodiginet ~]$ hostname -I | awk '{print $1}'
192.168.59.128
Finding IP Address

After getting IP Address, the we hit the IP Address via web browser.

Apache httpd web server
Share this article via :

One thought on “How To Install Apache httpd Webserver On CentOS 8

Leave a Reply

Your email address will not be published. Required fields are marked *