Install And Configure Apache Web Server In Linux

Apache is the most popular and stable web server on the internet. It support multiple languages and supports SSL/TLS and many more features.
Follow the steps to install and configure an Apache web server (httpd) in a RPM based linux distribution.
In this example i used CentOS 6, but it should work same way in all RPM based distros like Redhat, Fedora, CentOS, etc

Install Apache Server from Yum

[root@server ~]# yum install httpd
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.2.15-15.el6.centos.1 set to be updated
--> Processing Dependency: httpd-tools = 2.2.15-15.el6.centos.1 for package: htt                               pd-2.2.15-15.el6.centos.1.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.2.15-15.el6.centos.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

 Package          Arch        Version                        Repository    Size
 httpd            x86_64      2.2.15-15.el6.centos.1         updates      813 k
Updating for dependencies:
 httpd-tools      x86_64      2.2.15-15.el6.centos.1         updates       70 k

Transaction Summary
Install       0 Package(s)
Upgrade       2 Package(s)

Total download size: 882 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): httpd-2.2.15-15.el6.centos.1.x86_64.rpm           | 813 kB     00:26
(2/2): httpd-tools-2.2.15-15.el6.centos.1.x86_64.rpm     |  70 kB     00:01
Total                                            30 kB/s | 882 kB     00:29
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
updates/gpgkey                                           | 3.3 kB     00:00 ...
Importing GPG key 0xC105B9DE "CentOS-6 Key (CentOS 6 Official Signing Key) <cent                     >" from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : httpd-tools-2.2.15-15.el6.centos.1.x86_64                1/4
  Updating       : httpd-2.2.15-15.el6.centos.1.x86_64                      2/4
  Cleanup        : httpd-2.2.15-5.el6.centos.x86_64                         3/4
  Cleanup        : httpd-tools-2.2.15-5.el6.centos.x86_64                   4/4

  httpd.x86_64 0:2.2.15-15.el6.centos.1

Dependency Updated:
  httpd-tools.x86_64 0:2.2.15-15.el6.centos.1


Now the installation process is completed. The CentOS 6 has Apache preinstalled. But above i updated the httpd package and dependencies to the latest version.

Start Apache server
[root@server ~]# service httpd start
Starting httpd:                                            [  OK  ]

Configure Firewall for Apache
By default Apache server will listen on port 80/TCP, so you need to open that port for giving web server access to clients or Disable linux firewall 
Or temporarily stop firewall
[root@server ~]# service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]

Test Apache Web server
go to Webserver's web browser and go the address http://localhost/
Or access from another machine by server's ip address. If the Apache serrver's ip address is then try
Click on screenshot to enlarge

Was this helpfull ?


Anonymous said...

Very nice post, impressive. its quite different from other posts. Plz visit my site...!
Thanks for sharing.

Related Posts Plugin for WordPress, Blogger...

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons