Atlantic.Net Blog

How to Install and Configure Apache Webserver on Oracle Linux 8

Free, open-source Apache is one of the most popular web servers on the internet. It was developed and maintained by the Apache Software Foundation. Apache is reliable, secure, fast, and can be customized using extensions and modules. Due to its stability, efficiency, and popularity, it is used by many web hosting companies worldwide. It supports all major operating systems including Linux, Windows, macOS, Solaris, and more.

In this post, we will explain how to install an Apache web server on Oracle Linux 8.


  • A server running Oracle Linux 8 on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Oracle Linux 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install Apache on Oracle Linux 8

By default, the latest version of Apache is available in the Oracle Linux default repository. You can install it by running the following command:

dnf install httpd -y

Once the Apache package is installed, verify the package information using the following command:

apachectl -V

You will get the following output:

Server version: Apache/2.4.37 (Oracle Linux)
Server built:   May 11 2022 05:39:03
Server's Module Magic Number: 20120211:83
Server loaded:  APR 1.6.3, APR-UTIL 1.6.1
Compiled using: APR 1.6.3, APR-UTIL 1.6.1
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

Also Read

Host Multiple Websites on a Single Server Using Apache Web Server

Step 3 – Manage Apache Service

By default, the Apache webserver service is managed by systemd. You can manage it easily using the systemctl command-line utility.

To start the Apache service, run the following command:

systemctl start httpd

To restart the Apache service, run the following command:

systemctl restart httpd

To enable the Apache service, run the following command:

systemctl enable httpd

To check the status of the Apache service, run the following command:

systemctl status httpd

You will get the following output:

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2022-06-08 11:41:51 EDT; 25min ago
     Docs: man:httpd.service(8)
 Main PID: 3745 (httpd)
   Status: "Running, listening on: port 80"
    Tasks: 213 (limit: 23694)
   Memory: 25.2M
   CGroup: /system.slice/httpd.service
           ├─3745 /usr/sbin/httpd -DFOREGROUND
           ├─3760 /usr/sbin/httpd -DFOREGROUND
           ├─3765 /usr/sbin/httpd -DFOREGROUND
           ├─3766 /usr/sbin/httpd -DFOREGROUND
           └─3767 /usr/sbin/httpd -DFOREGROUND

Jun 08 11:41:51 oraclelinux8 systemd[1]: Starting The Apache HTTP Server...

Step 4 – Configure Firewall

By default, Apache listens on ports 80 and 443. If a firewall is installed and configured to your server, then you will need to allow both ports via firewalld. You can allow them with the following command:

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https

Next, reload the firewalld to apply the changes:

firewall-cmd --reload

Step 5 – Access Apache Default Web Page

At this point, the Apache web server is installed and listens on port 80. You can now open your web browser and access the Apache test page using the URL http://your-server-ip. You should see the Apache default page on the following screen:
Apache test page

Step 6 – Host a Simple Website with Apache

First, create a directory to hold the website data with the following command:

mkdir /var/www/html/

Next, create a simple HTML file inside the website directory:

nano /var/www/html/

Add the following HTML code:

<h1>Welcome to the Apache Webserver!</h1>

Save and close the file, then change the ownership and permissions of the website directory:

chown -R apache:apache /var/www/html/
chmod -R 775 /var/www/html/

Next, create an Apache virtual host configuration file to define your website directory:

nano /etc/httpd/conf/example.conf

Add the following configuration:

<VirtualHost *:80>
    DocumentRoot /var/www/html/
    DirectoryIndex index.html
    ErrorLog /var/log/httpd/error.log
    CustomLog /var/log/httpd/access.log combined

Save and close the file, then restart the Apache service to apply the configuration changes:

systemctl restart httpd

Now, open your web browser and verify your website using the URL You should see your website page on the following screen:
Apache test page

Also Read

How to Set Up Apache Virtual Hosting


In the above post, we explained how to install an Apache webserver on Oracle Linux 8. We also explained how to create a new website and host it using the Apache virtual host. Try it on VPS hosting from Atlantic.Net!


Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year