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
NOTE: To get a specific version replace httpd with the version you would like. Example: httpd-2.2.14-1.2.6.jdk6.ep5.el5.x86_64
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