How to Install Apache (httpd) webserver on Linux 7


In post, I will how to install an apache webserver on OEL 7/oel7.

1)Install http package
[root@oel7 ~]# yum install httpd

2)Start httpd service
[root@oel7 ~]# service httpd start
Redirecting to /bin/systemctl start  httpd.service

3)Check the status of httpd service:
[root@oel7 ~]# service httpd status

4)Enable service to be started after reboot
[root@oel7 ~]#systemctl enable httpd

5)Add hostname:IP in http configuration 
[root@oel7 ~]# echo 'ServerName oel7.lab:80' >> /etc/httpd/conf/httpd.conf
[root@oel7 ~]# service httpd restart

6)Enable firewall
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

7)Now try to access the IP or host name

http://oel7.lab:80
http://192.168.56.110

8)We can also create simple index page to test
[root@oel7 ~]# echo "APACHE Testing on oel7" > /var/www/html/index.html

Reload your browser to see your new index.html page


Note: Configuration file for Apache is /etc/httpd/conf/httpd.conf


If you like please follow and comment