apache, rocky linux,

How to install Apache on Rocky Linux 8

Jul 24, 2021 · 1 min read · Post a comment

Apache is one of the most popular, open source web servers that allows you to host your web content on Internet. Apache can be installed easily and can run on any operating system. In this tutorial, we are going to install it on the latest version of Rocky Linux.

Prerequisites

  • Rocky Linux 8
  • sudo privileges

Install Apache on Rocky Linux 8

Step 1. Run the system update command.

sudo dnf update

Step 2. Install Apache.

sudo dnf install httpd

Step 3. Once it is installed start and enable the service.

systemctl start httpd
systemctl enable httpd
systemctl status httpd

Output:

httpd.service - The Apache HTTP Server
    Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
    Active: active (running)

Step 4. If you want to check the version, run:

httpd -v

Output:

Server version: Apache/2.4.37 (rocky)

Step 5. If firewalld is enabled, make sure to allow http and https protocols.

sudo firewall-cmd --permanent --add-service={http,https}
sudo firewall-cmd --reload

Uninstall Apache on Rocky Linux

If you decide to remove Apache on Rocky Linux, execute:

sudo dnf remove httpd

Conclusion

This tutorial shows you how to install the latest Apache version on Rocky Linux 8, and if you decide to use another web server instead of Apache there is a section on how to remove it. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.