You want to install Apache 2 on CentOS 8 (or other RHEL forks like Rocky Linux or AlmaLinux OS)? Perfect 🙂
sudo dnf install httpd
sudo systemctl start httpd
Enable Apache as a CentOS service to start automatically
sudo systemctl enable httpd.service
Let’s enable Apache through the firewall
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --list-all
sudo firewall-cmd --reload
Now test it by typing your server’s IP in the browser.
That’s it 🙂