Pages

Sunday, June 10, 2018

Installing and Configuring Apache HTTP server on Linux (RHEL)

Hello There,

In today's post I will show:


How to install and configure Apache HTTP server on Linux server



Prerequisite:

1. A linux server an version (I have taken RHEL for my confort)
2. Root (Sudo) access on the Linux machine to install Apache
3. Internet connection on Linux box to connect and download repositories (Apache)
4. A client machine to test the website and connectivity to Apache Web server.

Steps:


  • Log on to your Linux machine and get sudo access


  • Now install Apache HTTP server Linux using Yum command
  • Execute following command on your Linux terminal 
        yum -y install httpd
  • This command will search for binaries on the online yum repositories and will install the dependencies before installing Apahce HTTP service (httpd)



  • Once all dependencies and packages required for installing apache http server are installed, the screen will look like following : 

  • Once Apache HTTP server is installed on your Linux machine you need to enable the httpd service because by default all external services are disabled in Linux. Execute following command to enable httpd service
      systemctl enable httpd


  • Now start the httpd service by following command: 
     systemctl start httpd


  • Now you need to add a firewall rule in your Linux IPTables to allow HTTP traffic on Port 80. Otherwise clients will not be able to access the websites running on your Apache webserver.
  • Shoot following command to enable HTTP access on port 80 on your Linux machine.
       firewall-cmd --zone=public --add-port=80/tcp --permanent

  • Once you successfully add the firewall rule on your Linux machine, you will need to reload your firewall services to make this change in to effect:
  • Shoot following command to reload your your firewall service on Linux instance:
      firewall-cmd --reload

  • Now check if your Firewall has really allowed port 80 and if the Rule has been added to IPTables or not This command is just to double check that your firewall is allowing port 80 (http), if port 80 is allowed then you should get result as shown in following screenshot:
       iptables-save | grep 80


  • And that's it, You have taken all the necessary steps to Install & Configure Apache HTTP server on a Linux box.

Testing :

  • To test that Apache is now configured on Linux box and can serve the HTTP requests successfully, try to access your Linux server's IP from browser of client machine (In my case it is a windows XP Virtual Machine) like http://192.168.75.136
  • You should get the Apache Test page on client machine's browser.



Voila!!!!! Apache HTTP server is not successfully set up on your Linux machine

Happy Blogging !!!!







No comments:

Post a Comment