Guest
Guest
Jun 20, 2025
3:12 PM
|
How to Install Apache Webserver on Rocky Linux 9: Complete Guide Apache HTTP Server, commonly referred to as Apache, is one of the most popular and reliable web servers in the world. It is widely used for hosting websites and web applications. If you are using Rocky Linux 9, installing Apache is a quick and straightforward process. This tutorial will guide you through the step-by-step process to install Apache Webserver on Rocky Linux 9.
Prerequisites Before you begin, ensure you have:
A system running Rocky Linux 9
A user account with sudo privileges
Terminal or SSH access to the server
Step 1: Update Your System It is always a good idea to update your system packages before installing new software.
bash Copy Edit sudo dnf update -y This ensures your system is up to date and helps prevent potential conflicts.
Step 2: Install Apache Webserver Apache’s package name on Rocky Linux is httpd. Install it using the following command:
bash Copy Edit sudo dnf install httpd -y This command will install Apache and all necessary dependencies.
Step 3: Start and Enable Apache Once installed, start the Apache service:
bash Copy Edit sudo systemctl start httpd Enable Apache to start automatically at system boot:
bash Copy Edit sudo systemctl enable httpd Check the status to confirm that Apache is running:
bash Copy Edit sudo systemctl status httpd You should see the status: active (running).
Step 4: Configure the Firewall By default, Rocky Linux 9 uses firewalld. You need to allow HTTP and HTTPS traffic through the firewall.
bash Copy Edit sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --reload This will open ports 80 (HTTP) and 443 (HTTPS), allowing web traffic to reach your server.
Step 5: Verify Apache Installation Open your web browser and enter your server’s IP address:
arduino Copy Edit http://your_server_ip You should see the Apache Test Page, which confirms that Apache is installed and working correctly on your Rocky Linux 9 server.
Step 6: Apache Webserver Management Commands Here are some essential commands for managing the Apache service:
Restart Apache:
bash Copy Edit sudo systemctl restart httpd Stop Apache:
bash Copy Edit sudo systemctl stop httpd Check Apache status:
bash Copy Edit sudo systemctl status httpd Disable Apache on boot:
bash Copy Edit sudo systemctl disable httpd Conclusion You have successfully learned how to install Apache Webserver on Rocky Linux 9 and perform basic setup and management. Your web server is now ready to host websites and web applications.
Next Steps: Configure Apache virtual hosts to host multiple websites.
Set up SSL certificates for secure HTTPS connections.
Optimize Apache performance for high-traffic websites.
|