In this tutorial, we will show you how to install Apache Web Server on Rocky Linux 8. For those of you who didn’t know, The Apache HTTP Server aka Apache is a free and open-source cross-platform web server software released under the terms of Apache Licence 2.0. The goal of this project is to provide a secure, efficient, and extensible server that provides HTTP services in sync with the current HTTP standards.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Apache Web Server on Rocky Linux. 8.
- A server running one of the following operating systems: Rocky Linux 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Apache Web Server on Rocky Linux 8
Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:
sudo dnf check-update sudo dnf update
Step 2. Installing Apache on Rocky Linux 8.
By default, Apache is available on Rocky Linux 8 base repository. Now run the following command below to install the Apache HTTP server to your system:
sudo dnf install httpd httpd-tools
After successfully installation, enable Apache (to start automatically upon system boot), start the webserver, and verify the status using the commands below:
sudo systemctl enable httpd sudo systemctl start httpd sudo systemctl status httpd
Step 3. Configure Firewall Rules.
Allow the default HTTP and HTTPS ports, ports 80 and 443 through the firewall by running the command below:
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload
Confirm the new firewall rules:
sudo firewall-cmd --permanent --list-all
Step 4. Test Apache HTTP Server.
Now we test your Apache installation by visiting your Server IP address:
You should get the following page in your Internet Browser:
Congratulations! You have successfully installed Apache. Thanks for using this tutorial for installing the Apache Web Server on your Rocky Linux 8 system. For additional help or useful information, we recommend you check the official Apache website.