If you’re planning to create a website or run a web application, you need a web server like Apache. Apache is a popular open-source web server known for its stability and security. This step-by-step tutorial will demonstrate how to install and configure Apache on your Almalinux 8 / Rocky Linux 8 server.
Steps to Install and Configure Apache on Almalinux 8 / Rocky Linux 8
Before we start, here’s what you’ll need:
- A working Almalinux 8 / Rocky Linux 8 installation
- Root access or a user account with sudo privileges
1. Update Your Operating System
Ensure that your operating system is up to date by entering this command:
sudo dnf update
2. Install Apache
Use this command to install Apache:
sudo dnf install httpd
After installation, activate and enable Apache with these commands:
sudo systemctl start httpd
sudo systemctl enable httpd
3. Configure Firewall Rules
Configure your firewall rules to allow HTTP and HTTPS traffic through ports 80 and 443 with the following commands:
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
Reload the firewall to apply your changes:
sudo firewall-cmd --reload
4. Test Your Web Server
To test your web server, go to your web browser and enter your server’s IP address:
http://your_server_IP_address
Frequently Asked Questions
What is Apache?
Apache is a widely used, free and open-source web server software powering more than 60% of websites on the internet.
What is Almalinux 8 / Rocky Linux 8?
Almalinux 8 / Rocky Linux 8 is a secure and stable Linux distribution built through a community-driven process that offers free and open-source code.
Why are firewall rules important?
Configuring firewall rules will enable you to control the inbound and outbound traffic on your web server. It’ll ensure that only authorized traffic can gain access to your web application or website.
How do I know if Apache is running?
You can check the status of your Apache installation by entering this command:
sudo systemctl status httpd
You should see a message confirming that the service is active and running if it is.
Conclusion
You’ve learned how to install and configure Apache on Almalinux / Rocky Linux. Now that you’ve completed these steps, you can deploy web applications and sites on your server with confidence. If you require any assistance with the process, please feel free to contact us.