Question: How to install Apache and configure Apache httpd to run as a service?
Installing the Apache package
If you have the apache package downloaded, you can install it using rpm command as root user.
# rpm -ivh httpd
If you have yum repository configured, use the recommended way of installing Apache httpd, i.e. with “yum install” command.
# yum install httpd
Installing httpd as a service
Enable the http service on startup with the below command. This will enable it for runlevels 2,3,4 & 5 :
# chkconfig httpd on
To start the httpd service :
# service httpd start
For RHEL 7
With RHEL 7 you use the systemctl command to enable the service:
# systemctl enable httpd.service
With RHEL 7 you use the systemctl command to start the service:
# systemctl start httpd.service