How to install Apache Web Server on Oracle Linux 9.4

To Install Apache Web Server On Oracle Linux 9.4

Introduction:

The Apache HTTP Server, commonly known as Apache, is one of the most extensively utilized web server platforms globally. It is highly regarded for its stability, flexibility, and comprehensive feature set, making it an excellent choice for a diverse array of web applications and services. Apache is compatible with multiple operating systems, including Unix, Linux, and Windows, enabling it to accommodate various deployment environments.

Procedure

Step 1: Check the OS-version

[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="9.4"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="9.4"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Oracle Linux Server 9.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:9:4:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9"
ORACLE_BUGZILLA_PRODUCT_VERSION=9.4
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=9.4

Step 2: Update the packages

[root@linuxhelp ~]# dnf update -y
Last metadata expiration check: 0:11:37 ago on Tue 08 Oct 2024 01:09:32 PM IST.
Dependencies resolved.
Nothing to do.
Complete!

Step 3: Install the package

[root@linuxhelp ~]# dnf install httpd -y
Last metadata expiration check: 0:11:56 ago on Tue 08 Oct 2024 01:09:32 PM IST.
Dependencies resolved.
===============================================================================================================================================================
 Package                                 Architecture                Version                                      Repository                              Size
===============================================================================================================================================================
Installing:
 httpd                                   x86_64                      2.4.57-11.0.1.el9_4.1                        ol9_appstream                           64 k
Installing dependencies:
 apr                                     x86_64                      1.7.0-12.el9_3                               ol9_appstream                          131 k
 apr-util                                x86_64                      1.6.1-23.el9                                 ol9_appstream                           99 k
 apr-util-bdb                            x86_64                      1.6.1-23.el9                                 ol9_appstream                           12 k
 httpd-core                              x86_64                      2.4.57-11.0.1.el9_4.1                        ol9_appstream                          1.8 M
 httpd-filesystem                        noarch                      2.4.57-11.0.1.el9_4.1                        ol9_appstream                           11 k
 httpd-tools                             x86_64                      2.4.57-11.0.1.el9_4.1                        ol9_appstream                           94 k
 oracle-logos-httpd                      noarch                      90.2-1.0.4.el9                               ol9_baseos_latest                       37 k
Installing weak dependencies:
 apr-util-openssl                        x86_64                      1.6.1-23.el9                                 ol9_appstream                           14 k
 mod_http2                               x86_64                      2.0.26-2.el9_4                               ol9_appstream                          171 k
 mod_lua                                 x86_64                      2.4.57-11.0.1.el9_4.1                        ol9_appstream                           58 k

Transaction Summary
===============================================================================================================================================================
Install  11 Packages

Total download size: 2.5 M
Installed size: 6.0 M
Downloading Packages:
(1/11): oracle-logos-httpd-90.2-1.0.4.el9.noarch.rpm                                                                            91 kB/s |  37 kB     00:00    
(2/11): apr-util-1.6.1-23.el9.x86_64.rpm                                                                                       215 kB/s |  99 kB     00:00    
(3/11): apr-util-bdb-1.6.1-23.el9.x86_64.rpm                                                                                   209 kB/s |  12 kB     00:00    
(4/11): apr-util-openssl-1.6.1-23.el9.x86_64.rpm                                                                               332 kB/s |  14 kB     00:00    
(5/11): apr-1.7.0-12.el9_3.x86_64.rpm                                                                                          243 kB/s | 131 kB     00:00    
(6/11): httpd-2.4.57-11.0.1.el9_4.1.x86_64.rpm                                                                                 850 kB/s |  64 kB     00:00    
(7/11): httpd-filesystem-2.4.57-11.0.1.el9_4.1.noarch.rpm                                                                      209 kB/s |  11 kB     00:00    
(8/11): httpd-tools-2.4.57-11.0.1.el9_4.1.x86_64.rpm                                                                           913 kB/s |  94 kB     00:00    
(9/11): mod_http2-2.0.26-2.el9_4.x86_64.rpm                                                                                    1.6 MB/s | 171 kB     00:00    
(10/11): mod_lua-2.4.57-11.0.1.el9_4.1.x86_64.rpm                                                                              529 kB/s |  58 kB     00:00    
(11/11): httpd-core-2.4.57-11.0.1.el9_4.1.x86_64.rpm                                                                           4.7 MB/s | 1.8 MB     00:00    
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                          2.5 MB/s | 2.5 MB     00:01 

Step 4: Check the version of the package

[root@linuxhelp ~]# apachectl -v
Server version: Apache/2.4.57 (Oracle Linux Server)
Server built:   Aug  8 2024 00:00:00

Step 5: Start the services

[root@linuxhelp ~]# systemctl start httpd

Step 6: Enable the services

[root@linuxhelp ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

Step 7: Check the status of the services

[root@linuxhelp ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
     Active: active (running) since Tue 2024-10-08 13:22:07 IST; 15s ago
       Docs: man:httpd.service(8)
   Main PID: 69175 (httpd)
     Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec"
      Tasks: 177 (limit: 15706)
     Memory: 32.5M
        CPU: 271ms
     CGroup: /system.slice/httpd.service
             ├─69175 /usr/sbin/httpd -DFOREGROUND
             ├─69176 /usr/sbin/httpd -DFOREGROUND
             ├─69180 /usr/sbin/httpd -DFOREGROUND
             ├─69181 /usr/sbin/httpd -DFOREGROUND
             └─69182 /usr/sbin/httpd -DFOREGROUND

Oct 08 13:22:07 linuxhelp systemd[1]: Starting The Apache HTTP Server...
Oct 08 13:22:07 linuxhelp httpd[69175]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:fefa:7bb3%>
Oct 08 13:22:07 linuxhelp systemd[1]: Started The Apache HTTP Server.
Oct 08 13:22:07 linuxhelp httpd[69175]: Server configured, listening on: port 80

Step 8: Check the IP address

[root@linuxhelp ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:0c:29:fa:7b:b3 brd ff:ff:ff:ff:ff:ff
    altname enp3s0
    inet 192.168.6.138/23 brd 192.168.7.255 scope global noprefixroute ens160
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fefa:7bb3/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

Step 9: Check the status of firewall

[root@linuxhelp ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; preset: enabled)
     Active: active (running) since Tue 2024-10-08 11:09:53 IST; 3h 4min ago
       Docs: man:firewalld(1)
   Main PID: 811 (firewalld)
      Tasks: 4 (limit: 15706)
     Memory: 41.4M
        CPU: 1.935s
     CGroup: /system.slice/firewalld.service
             └─811 /usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopid

Oct 08 11:09:52 linuxhelp systemd[1]: Starting firewalld - dynamic firewall daemon...
Oct 08 11:09:53 linuxhelp systemd[1]: Started firewalld - dynamic firewall daemon.

Step 10: Enable the http port

[root@linuxhelp ~]# firewall-cmd --permanent --zone=public --add-service=http
Success

Step 11: Enable the https port

[root@linuxhelp ~]# firewall-cmd --permanent --zone=public --add-service=https
success

Step 12: Apply the changes

[root@linuxhelp ~]# firewall-cmd --reload
Success

Step 13: Access in web browser

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to installation of Apache Web Server in Oracle Linux 9.4. Your feedback is much welcome.

FAQ
Q
What are the disadvantages of Apache web servers?
A
Security: Security is the major concern associated with Apache web servers. As it allows an individual to do modifications in the configuration, it might cause serious security issues if not taken care of properly. Loss of permission: Having access to httpd. conf main server config file, the user shouldn't use.
Q
What is the full form of Apache?
A
APACHE II ("Acute Physiology and Chronic Health Evaluation II") is a severity-of-disease classification system, one of several ICU scoring systems.
Q
Is the Apache Web server open-source?
A
The Apache HTTP Server is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0.
Q
How many connections can the Apache server handle?
A
The Apache Web server controls concurrent connections (simultaneous requests) using the max clients directive. By default, the max client directive is set to 256.
Q
What is the purpose of the Apache web server?
A
Its job is to establish a connection between a server and the browsers of website visitors (Firefox, Google Chrome, Safari, etc.) while delivering files back and forth between them (client-server structure). The Apache software is also compatible with any operating system, from Windows to Unix.