The purpose of this guide is to show the steps to install Apache web server on Red Hat Enterprise Linux versions 7 and 8. Then, we will show how to start httpd service in RHEL.
In this tutorial you will learn:
- How to install Apache web server on RHEL
- How to start httpd service on RHEL
- How to test web site implementation
|Requirements, Conventions or Software Version Used
|Red Hat Enterprise Linux
|Apache web server
|Privileged access to your Linux system as root or via the
|# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Install Apache on RHEL 7 and 8
Apache web server can be installed from Red Hat’s package manager using the following command.
# dnf install httpd
Start httpd on RHEL 7 and 8
Once the package has been installed, using the following systemctl command to start httpd.
# systemctl start httpd
You can check the status of httpd at any time by using the following command.
# systemctl status httpd
If you would like to make the Apache web server start automatically upon system reboot, execute the following command.
# systemctl enable httpd
Make a test website
You can now copy your files into the
/var/www/html directory and access your website. But first, make sure your firewall allows connections to the website.
# firewall-cmd --zone=public --add-port=80/tcp --permanent # firewall-cmd --reload
At this point, we can create some simple page. Once done this will also disable the above RHEL apache test page from appearing:
# echo "APACHE on RHEL7" > /var/www/html/index.html
In this tutorial, we saw how to install Apache web server on Red Hat Enterprise Linux 7 and 8. We also learned how to start the service, check its status, and optionally enable it to start up automatically upon boot.