How To Install Apache 2.2 on CentOS/RHEL 5/6/7?

How To Install Apache 2.2 on CentOS 5/6/7?

Apache is one the most in use web server around the world and still today it occupies 50 % of the web. We the introduction of other web servers like Nginx or lighthttpd its use is going down but still Apache is the king. By the end of this article, you will learn how to install Apache 2.2 on your server with Remi repository

Read comparison between Apache and Nginx

You just have to follow very simple steps, with YUM manager. YUM makes it really easy by avoiding the compilation process and install them easily with installing all other dependencies and also you are notified of updates.

Scenario: My Server IP is

So let’s start and Learn To Set Up  Apache 2.2

Step 1: Enable Remi Repository

The most f the updated package is available under Remi repository. Install it in your system using following commands.

Step 2: Install Apache

After adding Remi repository, install phpMyAdmin using yum package manager. All the dependencies will automatically be installed.

Step 3: Start Your Server

As Apache don’t start automatically when you install, you need to start it manually.

The following message is displayed:

Step 4: Apache VirtualHost Configuration

After this file is open make the following changes

Now save the file using the command  #: wq!

 Step 4: Allow iptables

If you don’t have iptables running then skip this step but sometimes it happens that Centos servers are running with iptables so we have to make some changes to allow Port 80 to get our apache server live for the public domain. else Port 80 and 443(SSL) will be blocked

Note: After saving iptables restart Apache server. if Apache page doesn’t show up reboot the server and follow from step 5.

Step 5: Restart Apache Server

Step 6: Check Your Installation

Now open a browser and Navigate to your Server IP address (for example,

How To Set Up LAMP Environment with Apache MySql and PHP ?

If you could see the page then you have successfully installed Apache on to you server

Step 7: Set for startUP configuration

As we have installed Apache and its up so make it get start automatically after every reboot you have to run following commands and your Apache server will start automatically when the server is rebooted.

Some Useful Command

  1. To check httpd configuration file syntax

  1. To check Apache automatic start at runlevel

output will be …

  1. To restart Apache server

Read How To Setup LAMP environment on your server