Search

Step-by-Step Guide: How to Install httpd / Apache Rocky Linux 9

Welcome to our comprehensive installation guide for httpd on Rocky Linux 9! In this step-by-step tutorial, we will walk you through the process of installing httpd, the popular Apache HTTP server, on your Rocky Linux 9 system. By following our easy instructions, you'll have httpd up and running in no time.

Whether you're a website owner, developer, or web hosting provider, httpd offers the reliability, flexibility, and security you need. So, let's get started on your journey to a smoothly operating web server on Rocky Linux 9.

Prerequisites for Httpd Installation

Before you can install httpd on Rocky Linux 9, there are a few prerequisites that you need to ensure are met. Firstly, you should have a server running Rocky Linux with either root or sudo privileges. This will allow you to perform the necessary installation and configuration steps. If you don't have these privileges, you may need to contact your system administrator for assistance.

Secondly, it's important to have the required packages and dependencies installed on your system. This includes httpd, which is the Apache HTTP server we will be installing. If you don't have httpd installed, you can use the package manager to install it by running the following command:

 

sudo dnf install httpd

 

Lastly, it's recommended to update your operating system before proceeding with the installation. This ensures that you have the latest software updates and security patches, providing a stable foundation for your httpd server. To update Rocky Linux 9, simply run the following command:

 

sudo dnf update

 

Once these prerequisites are met, you can move on to the next section to learn the step-by-step installation process for httpd on Rocky Linux 9.

Step-by-Step Installation of Httpd on Rocky Linux 9

Now, let's dive into the step-by-step process of installing httpd on Rocky Linux 9. Start by updating your operating system with the following command:

sudo dnf update

Installing Httpd

Once your system is updated, you can proceed with the installation of httpd. Use the following command to install httpd:

sudo dnf install httpd

Starting and Enabling Httpd

After the installation is complete, start the httpd service and enable it to automatically start on system boot with the following commands:

sudo systemctl start httpd

sudo systemctl enable httpd

Verifying Httpd Installation

To ensure that httpd is successfully installed and running on your Rocky Linux 9 system, you can verify its status with the following command:

sudo systemctl status httpd

If httpd is running, you should see a "active (running)" status message in the output.

That's it! You have now successfully installed httpd on Rocky Linux 9. In the next section, we will learn how to configure the firewall settings for your httpd server and test its functionality.

Configuring Firewall and Testing the Httpd Server

Once you have successfully installed httpd on Rocky Linux 9, it is crucial to configure the firewall settings to ensure the security of your server. By opening the necessary ports, you can allow incoming traffic and ensure that your httpd server functions properly.

To configure the firewall, you can use the following commands:

sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=443/tcp
sudo firewall-cmd --reload

Opening Port 80 for HTTP

The first command,

sudo firewall-cmd --permanent --add-port=80/tcp

, opens port 80 for HTTP traffic. This allows your server to handle incoming requests for websites hosted on httpd.

 

Opening Port 443 for HTTPS

The second command,

sudo firewall-cmd --permanent --add-port=443/tcp

, opens port 443 for HTTPS traffic. This is necessary if you plan to serve websites over a secure connection.

 

Reloading the Firewall

Finally, the command

sudo firewall-cmd --reload

reloads the firewall settings, ensuring that the changes take effect immediately.

 

Once you have configured the firewall, you can test your httpd server by accessing it through a web browser. Simply enter your server's IP address or domain name in the address bar, and if everything is set up correctly, you should see the default Apache test page.

Configuring the firewall and testing your httpd server are essential steps to ensure that it is secure and ready to handle incoming requests. By following these instructions, you can confidently deploy and manage your websites on Rocky Linux 9.

Conclusion

Congratulations on successfully completing the installation and configuration of httpd on Rocky Linux 9! With this powerful web server now in place, you are ready to handle requests and deliver static and dynamic content with ease.

Remember, httpd offers a wide range of features and configurations that can enhance the functionality of your web server. Take some time to explore these options and customize httpd according to your specific requirements. Whether you are hosting a personal website or managing a complex web application, httpd on Rocky Linux 9 has got you covered.

By following this step-by-step installation guide, you have gained the knowledge and skills necessary to set up httpd on Rocky Linux 9. Enjoy the reliability and security that httpd provides, and make the most out of your web server.

Sys Admin

Sys Admin

I am a Red Hat Certified Engineer (RHCE) and working as an IT Professional since 2012...