How to Install Httpd on CentOS 6.3

This post will show you the quick steps to install apache httpd on linux CentOS 6.3 server. Apache httpd is one of the most popular web servers and has a lot of features that make it very extensible and useful for many different types of websites.

1. Install httpd using yum command :

[root@centos63 ~]# yum install httpd -y

Examples :

[root@centos63 ~]# yum install httpd -y
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: mirrors.hostemo.com
 * extras: mirrors.hostemo.com
 * updates: mirrors.hostemo.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.i686 0:2.2.15-15.el6.centos.1 will be installed
--> Processing Dependency: httpd-tools = 2.2.15-15.el6.centos.1 for package: httpd-2.2.15-15.el6.centos.1.i686
--> Processing Dependency: libaprutil-1.so.0 for package: httpd-2.2.15-15.el6.centos.1.i686
--> Processing Dependency: libapr-1.so.0 for package: httpd-2.2.15-15.el6.centos.1.i686
--> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-15.el6.centos.1.i686
--> Processing Dependency: /etc/mime.types for package: httpd-2.2.15-15.el6.centos.1.i686
--> Running transaction check
---> Package apr.i686 0:1.3.9-5.el6_2 will be installed
---> Package apr-util.i686 0:1.3.9-3.el6_0.1 will be installed
---> Package apr-util-ldap.i686 0:1.3.9-3.el6_0.1 will be installed
---> Package httpd-tools.i686 0:2.2.15-15.el6.centos.1 will be installed
---> Package mailcap.noarch 0:2.1.31-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                 Arch             Version                           Repository         Size
====================================================================================================
Installing:
 httpd                   i686             2.2.15-15.el6.centos.1            base              819 k
Installing for dependencies:
 apr                     i686             1.3.9-5.el6_2                     updates           129 k
 apr-util                i686             1.3.9-3.el6_0.1                   base               89 k
 apr-util-ldap           i686             1.3.9-3.el6_0.1                   base               15 k
 httpd-tools             i686             2.2.15-15.el6.centos.1            base               70 k
 mailcap                 noarch           2.1.31-2.el6                      base               27 k

Transaction Summary
====================================================================================================
Install       6 Package(s)

Total download size: 1.1 M
Installed size: 3.4 M
Downloading Packages:
Setting up and reading Presto delta metadata
http://mirrors.hostemo.com/CentOS/6.3/updates/i386/repodata/1dbb6d68b2b39e2eab5888b04cfa0f20a86cb7c4ee54420384eaf8fa0f3d326d-prestodelta.xml.gz: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.
updates/prestodelta                                                          |  18 kB     00:00
Processing delta metadata
Package(s) data still to download: 1.1 M
(1/6): apr-1.3.9-5.el6_2.i686.rpm                                            | 129 kB     00:00
(2/6): apr-util-1.3.9-3.el6_0.1.i686.rpm                                     |  89 kB     00:00
(3/6): apr-util-ldap-1.3.9-3.el6_0.1.i686.rpm                                |  15 kB     00:00
(4/6): httpd-2.2.15-15.el6.centos.1.i686.rpm                                 | 819 kB     00:07
(5/6): httpd-tools-2.2.15-15.el6.centos.1.i686.rpm                           |  70 kB     00:00
(6/6): mailcap-2.1.31-2.el6.noarch.rpm                                       |  27 kB     00:00
----------------------------------------------------------------------------------------------------
Total                                                               104 kB/s | 1.1 MB     00:11
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) 
 Package: centos-release-6-3.el6.centos.9.i686 (@anaconda-CentOS-201207051201.i386/6.3)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : apr-1.3.9-5.el6_2.i686                                                           1/6
  Installing : mailcap-2.1.31-2.el6.noarch                                                      2/6
  Installing : apr-util-1.3.9-3.el6_0.1.i686                                                    3/6
  Installing : apr-util-ldap-1.3.9-3.el6_0.1.i686                                               4/6
  Installing : httpd-tools-2.2.15-15.el6.centos.1.i686                                          5/6
  Installing : httpd-2.2.15-15.el6.centos.1.i686                                                6/6
  Verifying  : apr-util-1.3.9-3.el6_0.1.i686                                                    1/6
  Verifying  : httpd-2.2.15-15.el6.centos.1.i686                                                2/6
  Verifying  : apr-1.3.9-5.el6_2.i686                                                           3/6
  Verifying  : apr-util-ldap-1.3.9-3.el6_0.1.i686                                               4/6
  Verifying  : httpd-tools-2.2.15-15.el6.centos.1.i686                                          5/6
  Verifying  : mailcap-2.1.31-2.el6.noarch                                                      6/6

Installed:
  httpd.i686 0:2.2.15-15.el6.centos.1

Dependency Installed:
  apr.i686 0:1.3.9-5.el6_2                       apr-util.i686 0:1.3.9-3.el6_0.1
  apr-util-ldap.i686 0:1.3.9-3.el6_0.1           httpd-tools.i686 0:2.2.15-15.el6.centos.1
  mailcap.noarch 0:2.1.31-2.el6

Complete!

2. Check httpd status :

[root@centos63 ~]# /etc/init.d/httpd status
httpd is stopped

3. Start httpd service :

[root@centos63 ~]# /etc/init.d/httpd start

Examples

[root@centos63 ~]# /etc/init.d/httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed for centos63.ehowstuff.local
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                           [  OK  ]

4. To remove above warning when starting httpd, follow the following steps. Go to line 276, change ServerName as below :

ServerName centos63.ehowstuff.local:80

5. Stop httpd service :

[root@centos63 ~]# /etc/init.d/httpd stop
Stopping httpd:                                            [  OK  ]

6. Restart httpd service :

[root@centos63 ~]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

7. Make httpd start at boot :

[root@centos63 ~]# chkconfig httpd on

How to Install Apache, PHP and MySQL on CentOS 6.2

CentOS 6.2

Install Apache, PHP and MySQL on centOS 6.2

In this post, i will share with you on how to install Apache Httpd, PHP and MySQL on linux CentOS 6.2 server. All these steps has been tested on CentOS 6.2. Assume that you have installed minimal installation type CentOS 6.2 and has setup your own local yum repository. You can use internet CentOS yum repository instead if you have direct internet connection to your server.

How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on CentOS 6.2

1.0 How to Install Httpd on CentOS 6.2

Apache httpd is one of the most popular web servers and has a lot of features that make it very extensible and useful for many different types of websites.

[root@centos6 ~]# yum install httpd
Loaded plugins: fastestmirror
Determining fastest mirrors
CentOS6.2-Repository                                                        | 1.3 kB     00:00 ...
CentOS6.2-Repository/primary                                                | 1.2 MB     00:00 ...
CentOS6.2-Repository                                                                     3042/3042
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.i686 0:2.2.15-15.el6.centos will be installed
--> Processing Dependency: httpd-tools = 2.2.15-15.el6.centos for package: httpd-2.2.15-15.el6.centos.i686
--> Processing Dependency: libaprutil-1.so.0 for package: httpd-2.2.15-15.el6.centos.i686
--> Processing Dependency: libapr-1.so.0 for package: httpd-2.2.15-15.el6.centos.i686
--> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-15.el6.centos.i686
--> Processing Dependency: /etc/mime.types for package: httpd-2.2.15-15.el6.centos.i686
--> Running transaction check
---> Package apr.i686 0:1.3.9-3.el6_1.2 will be installed
---> Package apr-util.i686 0:1.3.9-3.el6_0.1 will be installed
---> Package apr-util-ldap.i686 0:1.3.9-3.el6_0.1 will be installed
---> Package httpd-tools.i686 0:2.2.15-15.el6.centos will be installed
---> Package mailcap.noarch 0:2.1.31-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================
 Package              Arch          Version                      Repository                   Size
===================================================================================================
Installing:
 httpd                i686          2.2.15-15.el6.centos         CentOS6.2-Repository        818 k
Installing for dependencies:
 apr                  i686          1.3.9-3.el6_1.2              CentOS6.2-Repository        129 k
 apr-util             i686          1.3.9-3.el6_0.1              CentOS6.2-Repository         89 k
 apr-util-ldap        i686          1.3.9-3.el6_0.1              CentOS6.2-Repository         15 k
 httpd-tools          i686          2.2.15-15.el6.centos         CentOS6.2-Repository         70 k
 mailcap              noarch        2.1.31-2.el6                 CentOS6.2-Repository         27 k

Transaction Summary
===================================================================================================
Install       6 Package(s)

Total download size: 1.1 M
Installed size: 3.4 M
Is this ok [y/N]: y
Downloading Packages:
---------------------------------------------------------------------------------------------------
Total                                                              3.8 MB/s | 1.1 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : mailcap-2.1.31-2.el6.noarch                                                     1/6
  Installing : apr-1.3.9-3.el6_1.2.i686                                                        2/6
  Installing : apr-util-1.3.9-3.el6_0.1.i686                                                   3/6
  Installing : httpd-tools-2.2.15-15.el6.centos.i686                                           4/6
  Installing : apr-util-ldap-1.3.9-3.el6_0.1.i686                                              5/6
  Installing : httpd-2.2.15-15.el6.centos.i686                                                 6/6

Installed:
  httpd.i686 0:2.2.15-15.el6.centos

Dependency Installed:
  apr.i686 0:1.3.9-3.el6_1.2                     apr-util.i686 0:1.3.9-3.el6_0.1
  apr-util-ldap.i686 0:1.3.9-3.el6_0.1           httpd-tools.i686 0:2.2.15-15.el6.centos
  mailcap.noarch 0:2.1.31-2.el6

Complete!

2.0 How to Install php on CentOS 6.2

Next we proceed to Install the php packages on CentOS 6.2.

Simply run the following command :

[root@centos6 ~]# yum install php*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
CentOS6.2-Repository                                                            | 1.3 kB     00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.i686 0:5.3.3-3.el6_1.3 will be installed
---> Package php-cli.i686 0:5.3.3-3.el6_1.3 will be installed
--> Processing Dependency: libedit.so.0 for package: php-cli-5.3.3-3.el6_1.3.i686
---> Package php-common.i686 0:5.3.3-3.el6_1.3 will be installed
---> Package php-gd.i686 0:5.3.3-3.el6_1.3 will be installed
--> Processing Dependency: libpng12.so.0(PNG12_0) for package: php-gd-5.3.3-3.el6_1.3.i686
--> Processing Dependency: libpng12.so.0 for package: php-gd-5.3.3-3.el6_1.3.i686
--> Processing Dependency: libjpeg.so.62 for package: php-gd-5.3.3-3.el6_1.3.i686
--> Processing Dependency: libfreetype.so.6 for package: php-gd-5.3.3-3.el6_1.3.i686
--> Processing Dependency: libXpm.so.4 for package: php-gd-5.3.3-3.el6_1.3.i686
--> Processing Dependency: libX11.so.6 for package: php-gd-5.3.3-3.el6_1.3.i686
---> Package php-ldap.i686 0:5.3.3-3.el6_1.3 will be installed
---> Package php-mysql.i686 0:5.3.3-3.el6_1.3 will be installed
---> Package php-odbc.i686 0:5.3.3-3.el6_1.3 will be installed
--> Processing Dependency: libodbc.so.2 for package: php-odbc-5.3.3-3.el6_1.3.i686
---> Package php-pdo.i686 0:5.3.3-3.el6_1.3 will be installed
---> Package php-pear.noarch 1:1.9.4-4.el6 will be installed
---> Package php-pecl-apc.i686 0:3.1.3p1-1.2.el6.1 will be installed
---> Package php-pecl-memcache.i686 0:3.0.5-3.el6 will be installed
---> Package php-pgsql.i686 0:5.3.3-3.el6_1.3 will be installed
--> Processing Dependency: libpq.so.5 for package: php-pgsql-5.3.3-3.el6_1.3.i686
---> Package php-soap.i686 0:5.3.3-3.el6_1.3 will be installed
---> Package php-xml.i686 0:5.3.3-3.el6_1.3 will be installed
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.24) for package: php-xml-5.3.3-3.el6_1.3.i686
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18) for package: php-xml-5.3.3-3.el6_1.3.i686
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.13) for package: php-xml-5.3.3-3.el6_1.3.i686
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11) for package: php-xml-5.3.3-3.el6_1.3.i686
--> Processing Dependency: libxslt.so.1 for package: php-xml-5.3.3-3.el6_1.3.i686
--> Processing Dependency: libexslt.so.0 for package: php-xml-5.3.3-3.el6_1.3.i686
---> Package php-xmlrpc.i686 0:5.3.3-3.el6_1.3 will be installed
--> Running transaction check
---> Package freetype.i686 0:2.3.11-6.el6_1.7 will be installed
---> Package libX11.i686 0:1.3-2.el6 will be installed
--> Processing Dependency: libX11-common = 1.3-2.el6 for package: libX11-1.3-2.el6.i686
--> Processing Dependency: libxcb.so.1 for package: libX11-1.3-2.el6.i686
---> Package libXpm.i686 0:3.5.8-2.el6 will be installed
---> Package libedit.i686 0:2.11-4.20080712cvs.1.el6 will be installed
---> Package libjpeg.i686 0:6b-46.el6 will be installed
---> Package libpng.i686 2:1.2.46-1.el6_1 will be installed
---> Package libxslt.i686 0:1.1.26-2.el6 will be installed
---> Package postgresql-libs.i686 0:8.4.9-1.el6_1.1 will be installed
---> Package unixODBC.i686 0:2.2.14-11.el6 will be installed
--> Processing Dependency: libltdl.so.7 for package: unixODBC-2.2.14-11.el6.i686
--> Running transaction check
---> Package libX11-common.noarch 0:1.3-2.el6 will be installed
---> Package libtool-ltdl.i686 0:2.2.6-15.5.el6 will be installed
---> Package libxcb.i686 0:1.5-1.el6 will be installed
--> Processing Dependency: libXau.so.6 for package: libxcb-1.5-1.el6.i686
--> Running transaction check
---> Package libXau.i686 0:1.0.5-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================
 Package                 Arch         Version                         Repository                  Size
=======================================================================================================
Installing:
 php                     i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository       1.1 M
 php-cli                 i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository       2.2 M
 php-common              i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository       522 k
 php-gd                  i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository       102 k
 php-ldap                i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository        35 k
 php-mysql               i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository        76 k
 php-odbc                i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository        47 k
 php-pdo                 i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository        71 k
 php-pear                noarch       1:1.9.4-4.el6                   CentOS6.2-Repository       393 k
 php-pecl-apc            i686         3.1.3p1-1.2.el6.1               CentOS6.2-Repository        93 k
 php-pecl-memcache       i686         3.0.5-3.el6                     CentOS6.2-Repository        60 k
 php-pgsql               i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository        66 k
 php-soap                i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository       138 k
 php-xml                 i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository        98 k
 php-xmlrpc              i686         5.3.3-3.el6_1.3                 CentOS6.2-Repository        50 k
Installing for dependencies:
 freetype                i686         2.3.11-6.el6_1.7                CentOS6.2-Repository       362 k
 libX11                  i686         1.3-2.el6                       CentOS6.2-Repository       585 k
 libX11-common           noarch       1.3-2.el6                       CentOS6.2-Repository       188 k
 libXau                  i686         1.0.5-1.el6                     CentOS6.2-Repository        22 k
 libXpm                  i686         3.5.8-2.el6                     CentOS6.2-Repository        58 k
 libedit                 i686         2.11-4.20080712cvs.1.el6        CentOS6.2-Repository        73 k
 libjpeg                 i686         6b-46.el6                       CentOS6.2-Repository       133 k
 libpng                  i686         2:1.2.46-1.el6_1                CentOS6.2-Repository       184 k
 libtool-ltdl            i686         2.2.6-15.5.el6                  CentOS6.2-Repository        45 k
 libxcb                  i686         1.5-1.el6                       CentOS6.2-Repository       104 k
 libxslt                 i686         1.1.26-2.el6                    CentOS6.2-Repository       448 k
 postgresql-libs         i686         8.4.9-1.el6_1.1                 CentOS6.2-Repository       201 k
 unixODBC                i686         2.2.14-11.el6                   CentOS6.2-Repository       382 k

Transaction Summary
=======================================================================================================
Install      28 Package(s)

Total download size: 7.8 M
Installed size: 26 M
Is this ok [y/N]: y
Downloading Packages:
-------------------------------------------------------------------------------------------------------
Total                                                                  7.2 MB/s | 7.8 MB     00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : libX11-common-1.3-2.el6.noarch                                                     1/28
  Installing : php-common-5.3.3-3.el6_1.3.i686                                                    2/28
  Installing : php-pdo-5.3.3-3.el6_1.3.i686                                                       3/28
  Installing : libxslt-1.1.26-2.el6.i686                                                          4/28
  Installing : postgresql-libs-8.4.9-1.el6_1.1.i686                                               5/28
  Installing : libedit-2.11-4.20080712cvs.1.el6.i686                                              6/28
  Installing : php-cli-5.3.3-3.el6_1.3.i686                                                       7/28
  Installing : 1:php-pear-1.9.4-4.el6.noarch                                                      8/28
  Installing : libjpeg-6b-46.el6.i686                                                             9/28
  Installing : libtool-ltdl-2.2.6-15.5.el6.i686                                                  10/28
  Installing : unixODBC-2.2.14-11.el6.i686                                                       11/28
  Installing : 2:libpng-1.2.46-1.el6_1.i686                                                      12/28
  Installing : freetype-2.3.11-6.el6_1.7.i686                                                    13/28
  Installing : libXau-1.0.5-1.el6.i686                                                           14/28
  Installing : libxcb-1.5-1.el6.i686                                                             15/28
  Installing : libX11-1.3-2.el6.i686                                                             16/28
  Installing : libXpm-3.5.8-2.el6.i686                                                           17/28
  Installing : php-gd-5.3.3-3.el6_1.3.i686                                                       18/28
  Installing : php-odbc-5.3.3-3.el6_1.3.i686                                                     19/28
  Installing : php-pecl-apc-3.1.3p1-1.2.el6.1.i686                                               20/28
  Installing : php-pecl-memcache-3.0.5-3.el6.i686                                                21/28
  Installing : php-5.3.3-3.el6_1.3.i686                                                          22/28
  Installing : php-pgsql-5.3.3-3.el6_1.3.i686                                                    23/28
  Installing : php-xml-5.3.3-3.el6_1.3.i686                                                      24/28
  Installing : php-mysql-5.3.3-3.el6_1.3.i686                                                    25/28
  Installing : php-xmlrpc-5.3.3-3.el6_1.3.i686                                                   26/28
  Installing : php-ldap-5.3.3-3.el6_1.3.i686                                                     27/28
  Installing : php-soap-5.3.3-3.el6_1.3.i686                                                     28/28

Installed:
  php.i686 0:5.3.3-3.el6_1.3                        php-cli.i686 0:5.3.3-3.el6_1.3
  php-common.i686 0:5.3.3-3.el6_1.3                 php-gd.i686 0:5.3.3-3.el6_1.3
  php-ldap.i686 0:5.3.3-3.el6_1.3                   php-mysql.i686 0:5.3.3-3.el6_1.3
  php-odbc.i686 0:5.3.3-3.el6_1.3                   php-pdo.i686 0:5.3.3-3.el6_1.3
  php-pear.noarch 1:1.9.4-4.el6                     php-pecl-apc.i686 0:3.1.3p1-1.2.el6.1
  php-pecl-memcache.i686 0:3.0.5-3.el6              php-pgsql.i686 0:5.3.3-3.el6_1.3
  php-soap.i686 0:5.3.3-3.el6_1.3                   php-xml.i686 0:5.3.3-3.el6_1.3
  php-xmlrpc.i686 0:5.3.3-3.el6_1.3

Dependency Installed:
  freetype.i686 0:2.3.11-6.el6_1.7                libX11.i686 0:1.3-2.el6
  libX11-common.noarch 0:1.3-2.el6                libXau.i686 0:1.0.5-1.el6
  libXpm.i686 0:3.5.8-2.el6                       libedit.i686 0:2.11-4.20080712cvs.1.el6
  libjpeg.i686 0:6b-46.el6                        libpng.i686 2:1.2.46-1.el6_1
  libtool-ltdl.i686 0:2.2.6-15.5.el6              libxcb.i686 0:1.5-1.el6
  libxslt.i686 0:1.1.26-2.el6                     postgresql-libs.i686 0:8.4.9-1.el6_1.1
  unixODBC.i686 0:2.2.14-11.el6

Complete!

3.0 How to Install MySQL Database Server on CentOS 6.2

This post will show you on how to install MySQL server using yum command.

Simply run the following command :

[root@centos6 ~]# yum install mysql mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql.i686 0:5.1.52-1.el6_0.1 will be installed
---> Package mysql-server.i686 0:5.1.52-1.el6_0.1 will be installed
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.52-1.el6_0.1.i686
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.52-1.el6_0.1.i686
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.52-1.el6_0.1.i686
--> Running transaction check
---> Package perl-DBD-MySQL.i686 0:4.013-3.el6 will be installed
---> Package perl-DBI.i686 0:1.609-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================
 Package                Arch         Version                  Repository                    Size
=================================================================================================
Installing:
 mysql                  i686         5.1.52-1.el6_0.1         CentOS6.2-Repository         898 k
 mysql-server           i686         5.1.52-1.el6_0.1         CentOS6.2-Repository         8.3 M
Installing for dependencies:
 perl-DBD-MySQL         i686         4.013-3.el6              CentOS6.2-Repository         134 k
 perl-DBI               i686         1.609-4.el6              CentOS6.2-Repository         705 k

Transaction Summary
=================================================================================================
Install       4 Package(s)

Total download size: 10 M
Installed size: 27 M
Is this ok [y/N]: y
Downloading Packages:
-------------------------------------------------------------------------------------------------
Total                                                             13 MB/s |  10 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : perl-DBI-1.609-4.el6.i686                                                     1/4
  Installing : perl-DBD-MySQL-4.013-3.el6.i686                                               2/4
  Installing : mysql-5.1.52-1.el6_0.1.i686                                                   3/4
  Installing : mysql-server-5.1.52-1.el6_0.1.i686                                            4/4

Installed:
  mysql.i686 0:5.1.52-1.el6_0.1               mysql-server.i686 0:5.1.52-1.el6_0.1

Dependency Installed:
  perl-DBD-MySQL.i686 0:4.013-3.el6                  perl-DBI.i686 0:1.609-4.el6

Complete!

Hope all these three steps will be useful when installing Apache, PHP and MySQL on linux Centos 6.2 server

How to Install Cacti on CentOS 6.2 using EPEL Repository

Cacti is a complete network graphing solution that useful for network administrator to monitor their network bandwidth. It collect SNMP data as well as other data such as system load, network link status, hard disk space and etc.

From Cacti official site :

Cacti is a complete network graphing solution designed to harness the power of RRDTool’s data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.

In this post, i will show you on how to install Cacti on linux CentOS 6.2 server. This tutorial assumed that you already installed LAMP (Linux CentOS 6.2 x86, Apache httpd server, Mysql server and PHP) server.

How to Install and Configure EPEL Repository on CentOS 6.2

Cacti is very easy to use and have the following features if it properly configured:

  • Graphs
  • Data Sources
  • Data Gathering
  • Graph Display
  • User Management

1. Login to your CentOS 6.2 server as a root and install the following packages :

[root@centos62 ~]# yum install cacti httpd mysql-server mysql php-common php-mysql php-pear net-snmp php-gd php-devel php php-mbstring php-cli net-snmp-utils php-snmp php-pear-Net-SMTP -y

2. Make sure all these software/packages has been installed :

Package cacti-0.8.7i-2.el6.noarch already installed and latest version
Package httpd-2.2.15-15.el6.centos.1.i686 already installed and latest version
Package mysql-server-5.1.61-1.el6_2.1.i686 already installed and latest version
Package mysql-5.1.61-1.el6_2.1.i686 already installed and latest version
Package php-common-5.3.3-3.el6_2.6.i686 already installed and latest version
Package php-mysql-5.3.3-3.el6_2.6.i686 already installed and latest version
Package 1:php-pear-1.9.4-4.el6.noarch already installed and latest version
Package 1:net-snmp-5.5-37.el6_2.1.i686 already installed and latest version
Package php-gd-5.3.3-3.el6_2.6.i686 already installed and latest version
Package php-devel-5.3.3-3.el6_2.6.i686 already installed and latest version
Package php-5.3.3-3.el6_2.6.i686 already installed and latest version
Package php-mbstring-5.3.3-3.el6_2.6.i686 already installed and latest version
Package php-cli-5.3.3-3.el6_2.6.i686 already installed and latest version
Package 1:net-snmp-utils-5.5-37.el6_2.1.i686 already installed and latest version
Package php-snmp-5.3.3-3.el6_2.6.i686 already installed and latest version
Package php-pear-Net-SMTP-1.6.1-1.el6.noarch already installed and latest version

3. Starting the database :

[root@centos62 ~]# service mysqld start
Starting mysqld:                                           [  OK  ]

4. Login to mysql server and create the following database and user :

Database’s Name : cactidb
Database’s User : cactiuser
Database’s Password : cactipassword

[root@centos62 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE cactidb;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'cactipassword';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON cactidb.* to cactiuser@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW GRANTS FOR 'cactiuser'@'localhost';
+------------------------------------------------------------------------------------------------------------------+
| Grants for cactiuser@localhost                                                                                   |
+------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'cactiuser'@'localhost' IDENTIFIED BY PASSWORD '*6FF226B3BB20712FB42564D21683F5A0173DDD16' |
| GRANT ALL PRIVILEGES ON `cactidb`.* TO 'cactiuser'@'localhost'                                                   |
+------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> exit
Bye

5. Find out cacti.sql path using the following command :

[root@centos62 ~]# rpm -ql cacti | grep cacti.sql
/usr/share/doc/cacti-0.8.7i/cacti.sql

6. Populate and import the cacti database :

[root@centos62 ~]# /usr/bin/mysql cactidb -u cactiuser -p < /usr/share/doc/cacti-0.8.7i/cacti.sql
Enter password:

7. Configure cacti :

[root@centos62 ~]# vi /etc/cacti/db.php

Update the following details meet your configuration :

/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactipassword";
$database_port = "3306";
$database_ssl = false;

Original configuration

<Directory /usr/share/cacti/>
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
</Directory>

Change the configuration to :

<Directory /usr/share/cacti/>
        Order Deny,Allow
        Deny from all
        Allow from all
</Directory>

8. Start the apache httpd service if you haven't start :

[root@centos62 ~]# /etc/rc.d/init.d/httpd start
Starting httpd:                                            [  OK  ]

or just reload to update it:

[root@centos62 ~]# /etc/rc.d/init.d/httpd reload
Reloading httpd:

9. Make httpd and mysql service auto start at boot :

[root@centos62 ~]# chkconfig httpd on
[root@centos62 ~]# chkconfig mysqld on

10. Setting up the crontab :

Check where is poller.php :

[root@centos62 ~]# ls /usr/share/cacti/
about.php                graph_image.php             host_templates.php   rra
auth_changepassword.php  graph.php                   images               rra.php
auth_login.php           graph_settings.php          include              scripts
cdef.php                 graphs_items.php            index.php            script_server.php
cli                      graphs_new.php              install              settings.php
cmd.php                  graphs.php                  lib                  templates_export.php
color.php                graph_templates_inputs.php  log                  templates_import.php
data_input.php           graph_templates_items.php   logout.php           tree.php
data_queries.php         graph_templates.php         poller_commands.php  user_admin.php
data_sources.php         graph_view.php              poller_export.php    utilities.php
data_templates.php       graph_xport.php             poller.php
gprint_presets.php       host.php                    resource
[root@centos62 ~]# crontab -e
# Used to update Cacti
*/5 * * * * /usr/share/cacti/poller.php >> /var/log/cacti 2>&1

How to Setup and Configure Cacti on CentOS 6.2

How to Install Apache Httpd on CentOS 5.8

Apache httpd is one of the most popular web servers and has a lot of features that make it very extensible and useful for many different types of websites.This steps has been tested on CentOS 5.8. Assume that you have installed minimal installation type CentOS 5.8 and has setup your own local yum repository. You can use internet CentOS yum repository instead if you have direct internet connection to your server.

To install apache httpd, simply run the following command :

[root@centos58 ~]# yum install httpd -y

Example :

[root@centos58 ~]# yum install httpd -y
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirror.oscc.org.my
 * extras: mirror.oscc.org.my
 * updates: mirror.oscc.org.my
base                                                                         | 1.1 kB     00:00
extras                                                                       | 2.1 kB     00:00
updates                                                                      | 1.9 kB     00:00
updates/primary_db                                                           | 263 kB     00:01
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.i386 0:2.2.3-63.el5.centos.1 set to be updated
base/filelists                                                               | 3.0 MB     00:28
extras/filelists_db                                                          | 212 kB     00:02
updates/filelists_db                                                         | 1.1 MB     00:09
--> Processing Dependency: /etc/mime.types for package: httpd
--> Processing Dependency: libapr-1.so.0 for package: httpd
--> Processing Dependency: libaprutil-1.so.0 for package: httpd
--> Running transaction check
---> Package apr.i386 0:1.2.7-11.el5_6.5 set to be updated
---> Package apr-util.i386 0:1.2.7-11.el5_5.2 set to be updated
--> Processing Dependency: libpq.so.4 for package: apr-util
---> Package mailcap.noarch 0:2.1.23-1.fc6 set to be updated
--> Running transaction check
---> Package postgresql-libs.i386 0:8.1.23-1.el5_7.3 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                   Arch             Version                         Repository         Size
====================================================================================================
Installing:
 httpd                     i386             2.2.3-63.el5.centos.1           updates           1.2 M
Installing for dependencies:
 apr                       i386             1.2.7-11.el5_6.5                base              124 k
 apr-util                  i386             1.2.7-11.el5_5.2                base               80 k
 mailcap                   noarch           2.1.23-1.fc6                    base               14 k
 postgresql-libs           i386             8.1.23-1.el5_7.3                base              197 k

Transaction Summary
====================================================================================================
Install       5 Package(s)
Upgrade       0 Package(s)

Total download size: 1.6 M
Downloading Packages:
(1/5): mailcap-2.1.23-1.fc6.noarch.rpm                                       |  14 kB     00:00
(2/5): apr-util-1.2.7-11.el5_5.2.i386.rpm                                    |  80 kB     00:00
(3/5): apr-1.2.7-11.el5_6.5.i386.rpm                                         | 124 kB     00:00
(4/5): postgresql-libs-8.1.23-1.el5_7.3.i386.rpm                             | 197 kB     00:01
(5/5): httpd-2.2.3-63.el5.centos.1.i386.rpm                                  | 1.2 MB     00:12
----------------------------------------------------------------------------------------------------
Total                                                               108 kB/s | 1.6 MB     00:15
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : apr                                                                          1/5
  Installing     : postgresql-libs                                                              2/5
  Installing     : mailcap                                                                      3/5
  Installing     : apr-util                                                                     4/5
  Installing     : httpd                                                                        5/5

Installed:
  httpd.i386 0:2.2.3-63.el5.centos.1

Dependency Installed:
  apr.i386 0:1.2.7-11.el5_6.5                 apr-util.i386 0:1.2.7-11.el5_5.2
  mailcap.noarch 0:2.1.23-1.fc6               postgresql-libs.i386 0:8.1.23-1.el5_7.3

Complete!

Start httpd service :

[root@centos58 ~]# service httpd start

Stop httpd service :

[root@centos58 ~]# service httpd stop

Check httpd status :

[root@centos58 ~]# service httpd status
httpd (pid  2411) is running...

Make httpd auto start at boot :

[root@centos58 ~]# chkconfig httpd on

How to Configure and Create Apache httpd VirtualHost on Fedora 16

In this post, i will show on how to configure apache httpd and create VirtualHost on linux Fedora 16 server. Assumed that you already install apache httpd server.

1. Modify httpd.conf as below :

[root@fedora16 ~]# vim /etc/httpd/conf/httpd.conf

Update Admin’s address :

ServerAdmin root@fedora16.ehowstuff.local

Uncomment the serverName as below :

ServerName fedora16.ehowstuff.local:80

Add file name that can be access, example : index.php :

DirectoryIndex index.html index.html.var index.php

2. Uncomment NameVirtualHost :

# Use name-based virtual hosting.
#
NameVirtualHost *:80
#

3. Create Virtual host :

<VirtualHost *:80>
    ServerAdmin admin@fedora16.ehowstuff.local
    DocumentRoot /var/www/html/fedora16.ehowstuff.local
    ServerName fedora16.ehowstuff.local
    ErrorLog logs/fedora16.ehowstuff.local-error_log
    CustomLog logs/fedora16.ehowstuff.local-access_log common
</VirtualHost>

4. Create sample index.html file on DocumentRoot of your virtualHost :

[root@fedora16 ~]# vi /var/www/html/fedora16.ehowstuff.local/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page for Fedora.ehowstuff.local
</div>
</body>
</html>

5. Start httpd service :

[root@fedora16 ~]# systemctl restart httpd.service

6. Enable port 80 to go through linux iptables firewall :

[root@fedora16 ~]# vi /etc/sysconfig/iptables

Add this line :

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

7. Restart iptables to take effect :

[root@fedora16 ~]# systemctl restart iptables.service

How to Remove “Fedora Test Page” on Fedora 16 Linux Server

Question :
How to remove test page for the apache httpd server on Fedora 16 server. After installed apache and start the service, i will get this message :

Fedora Test Page

This page is used to test the proper operation of the Apache HTTP server after it has been installed. 
If you can read this page, it means that the web server installed at this site is working properly, 
but has not yet been configured.

Answer :
Comment out the following lines in welcome.conf :

[root@fedora16 ~]# vi /etc/httpd/conf.d/welcome.conf

Original welcome.conf :

#
# This configuration file enables the default "Welcome"
# page if there is no default index page present for
# the root URL.  To disable the Welcome page, comment
# out all the lines below.
#
<LocationMatch "^/+$">
    Options -Indexes
    ErrorDocument 403 /error/noindex.html
</LocationMatch>

Examples :

#
# This configuration file enables the default "Welcome"
# page if there is no default index page present for
# the root URL.  To disable the Welcome page, comment
# out all the lines below.
#
#<LocationMatch "^/+$">
#    Options -Indexes
#    ErrorDocument 403 /error/noindex.html
#</LocationMatch>

Reload the httpd service to take effect immediately :

[root@fedora16 ~]# systemctl reload httpd.service

How to Install Apache httpd on Linux Fedora 16 Server

This post will guide you how to install apache httpd service on linux Fedora 16. Apache HTTP is a popular web server for linux servers. Follow this steps to install apache httpd service.

Simply run this command :

[root@fedora16 ~]# yum install httpd -y
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.i686 0:2.2.21-1.fc16 will be installed
--> Processing Dependency: httpd-tools = 2.2.21-1.fc16 for package: httpd-2.2.21-1.fc16.i686
--> Processing Dependency: /etc/mime.types for package: httpd-2.2.21-1.fc16.i686
--> Processing Dependency: libaprutil-1.so.0 for package: httpd-2.2.21-1.fc16.i686
--> Processing Dependency: libapr-1.so.0 for package: httpd-2.2.21-1.fc16.i686
--> Processing Dependency: apr-util-ldap for package: httpd-2.2.21-1.fc16.i686
--> Running transaction check
---> Package apr.i686 0:1.4.5-1.fc16 will be installed
---> Package apr-util.i686 0:1.3.12-1.fc16 will be installed
---> Package apr-util-ldap.i686 0:1.3.12-1.fc16 will be installed
---> Package httpd-tools.i686 0:2.2.21-1.fc16 will be installed
---> Package mailcap.noarch 0:2.1.38-1.fc16 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                Arch            Version                  Repository                    Size
====================================================================================================
Installing:
 httpd                  i686            2.2.21-1.fc16            Fedora16-Repository          811 k
Installing for dependencies:
 apr                    i686            1.4.5-1.fc16             Fedora16-Repository          103 k
 apr-util               i686            1.3.12-1.fc16            Fedora16-Repository           82 k
 apr-util-ldap          i686            1.3.12-1.fc16            Fedora16-Repository           16 k
 httpd-tools            i686            2.2.21-1.fc16            Fedora16-Repository           69 k
 mailcap                noarch          2.1.38-1.fc16            Fedora16-Repository           29 k

Transaction Summary
====================================================================================================
Install       6 Packages

Total download size: 1.1 M
Installed size: 3.4 M
Downloading Packages:
----------------------------------------------------------------------------------------------------
Total                                                               2.1 MB/s | 1.1 MB     00:00
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mailcap-2.1.38-1.fc16.noarch                                                     1/6
  Installing : apr-1.4.5-1.fc16.i686                                                            2/6
  Installing : apr-util-1.3.12-1.fc16.i686                                                      3/6
  Installing : httpd-tools-2.2.21-1.fc16.i686                                                   4/6
  Installing : apr-util-ldap-1.3.12-1.fc16.i686                                                 5/6
  Installing : httpd-2.2.21-1.fc16.i686                                                         6/6

Installed:
  httpd.i686 0:2.2.21-1.fc16

Dependency Installed:
  apr.i686 0:1.4.5-1.fc16                           apr-util.i686 0:1.3.12-1.fc16
  apr-util-ldap.i686 0:1.3.12-1.fc16                httpd-tools.i686 0:2.2.21-1.fc16
  mailcap.noarch 0:2.1.38-1.fc16

Complete!

Configure your system to start Apache at boot time :

[root@fedora16 ~]# systemctl enable httpd.service

Start Apache service :

[root@fedora16 ~]# systemctl start httpd.service

How to Creates the /etc/httpd/passwords File and Configures a Password for Apache User?

Questions :
What command to creates the /etc/httpd/passwords file and configures a password for Apache Httpd user ?

Answers :
The command that creates the /etc/httpd/passwords file is :

[root@server ~]# htpasswd -c /etc/httpd/passwords ehowstuff

Assume that the username is ehowstuff.

If /etc/httpd/passwords already exists, the command to configures a password for Apache user ehowstuff is :

[root@server ~]# htpasswd ehowstuff

How to Check Apache Error Log and Access Log file

The purpose of logging in a server is to diagnose some issues. The common way to start the troubleshooting is to look at logs. For apache httpd server, all the log is normally stored at “/var/log/httpd” as below :

    [root@centos62 ~]# ls /var/log/httpd/
    access_log  error_log
    

How to Continuously Check Apache Error Log file :

    [root@centos62 ~]# tail -f /var/log/httpd/error_log
    

Example :

    [root@centos62 ~]# tail -f /var/log/httpd/error_log
    [Thu Feb 16 18:23:08 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
    [Thu Feb 16 18:23:08 2012] [notice] Digest: generating secret for digest authentication ...
    [Thu Feb 16 18:23:08 2012] [notice] Digest: done
    [Thu Feb 16 18:23:09 2012] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured -- resuming normal operations
    [Thu Feb 16 19:56:33 2012] [error] [client 192.168.1.52] File does not exist: /var/www/html/favicon.ico
    [Thu Feb 16 23:47:07 2012] [notice] caught SIGTERM, shutting down
    [Sat Feb 18 20:39:26 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
    [Sat Feb 18 20:39:26 2012] [notice] Digest: generating secret for digest authentication ...
    [Sat Feb 18 20:39:26 2012] [notice] Digest: done
    [Sat Feb 18 20:39:27 2012] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured -- resuming normal operations
    

How to Continuously Check Apache Access Log file :

    [root@centos62 ~]# tail -f /var/log/httpd/access_log
    

Example :

    [root@centos62 ~]# tail -f /var/log/httpd/access_log
    192.168.1.52 - - [16/Feb/2012:23:03:50 +0800] "GET /adminer/externals/jush/jush.css HTTP/1.1" 304 - "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:03:52 +0800] "GET /adminer/adminer/static/loader.gif HTTP/1.1" 200 673 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:03:52 +0800] "GET /adminer/adminer/?server=localhost&username=root&database= HTTP/1.1" 200 4739 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:03:52 +0800] "GET /adminer/adminer/static/plus.gif HTTP/1.1" 200 72 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root&database=" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:03:56 +0800] "GET /adminer/adminer/?server=localhost&username=root HTTP/1.1" 200 2977 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:03:56 +0800] "GET /adminer/adminer/?server=localhost&username=root&script=connect HTTP/1.1" 200 109 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [16/Feb/2012:23:04:16 +0800] "GET /adminer/adminer/?server=localhost&username=root&status= HTTP/1.1" 200 19629 "http://192.168.1.44/adminer/adminer/?server=localhost&username=root" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [18/Feb/2012:20:39:32 +0800] "GET / HTTP/1.1" 200 1394 "-" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [18/Feb/2012:20:39:32 +0800] "GET /icons/compressed.gif HTTP/1.1" 200 1038 "http://192.168.1.44/" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    192.168.1.52 - - [18/Feb/2012:20:44:17 +0800] "GET / HTTP/1.1" 200 1394 "-" "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
    

How to Install Apache Httpd Server on RHEL 6

In this post, i will show on how to install Apache Httpd server on Redhat Enterprise Linux 6 (RHEL 6). The Apache HTTP Server is an open-source HTTP server for modern operating systems such as Unix, Linux and windows platform. This post assumed that you have set up local yum repository using your DVDROM. If you haven’t set up the local yum repository, please proceed to this steps :
How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

Simply run this command to install Apache Httpd server :

    [root@rhel6 ~]# yum install httpd -y
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package httpd.i686 0:2.2.15-5.el6 set to be updated
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================
     Package           Arch             Version                  Repository                        Size
    ====================================================================================================
    Installing:
     httpd             i686             2.2.15-5.el6             DVD-RHEL6-Repository             813 k
    
    Transaction Summary
    ====================================================================================================
    Install       1 Package(s)
    Upgrade       0 Package(s)
    
    Total download size: 813 k
    Installed size: 2.8 M
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : httpd-2.2.15-5.el6.i686                                                      1/1
    
    Installed:
      httpd.i686 0:2.2.15-5.el6
    
    Complete!
    

Command to start Httpd service :

    [root@rhel6 ~]# service httpd start
    Starting httpd:                                            [  OK  ]
    

Command to stop Httpd service :

    [root@rhel6 ~]# service httpd stop
    Stopping httpd:                                            [  OK  ]
    

Command to restart Httpd service :

    [root@rhel6 ~]# service httpd restart
    Stopping httpd:                                            [  OK  ]
    Starting httpd:                                            [  OK  ]
    

Make Apache Httpd service auto start at boot :

    [root@rhel6 ~]# chkconfig httpd on
    

How to List Available Apache httpd Web Server Package and Info on CentOS 6.2

In this post, i will show on how to list available Apache httpd web server package that was install on your CentOS server. Beside that, i will show how to show the apache information using command line.

To list available Apache httpd web server package :

    [root@centos62 ~]# yum list *httpd*
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: centos.maulvi.net
     * extras: centos.maulvi.net
     * updates: centos.maulvi.net
    Installed Packages
    httpd.i686                             2.2.15-15.el6.centos                    @CentOS6.2-Repository
    httpd-tools.i686                       2.2.15-15.el6.centos                    @CentOS6.2-Repository
    Available Packages
    httpd-devel.i686                       2.2.15-15.el6.centos                    CentOS6.2-Repository
    httpd-manual.noarch                    2.2.15-15.el6.centos                    CentOS6.2-Repository
    

Use yum info httpd command to get more information about Apache httpd web server package :

    [root@centos62 ~]# yum info httpd
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: centos.maulvi.net
     * extras: centos.maulvi.net
     * updates: centos.maulvi.net
    Installed Packages
    Name        : httpd
    Arch        : i686
    Version     : 2.2.15
    Release     : 15.el6.centos
    Size        : 2.8 M
    Repo        : installed
    From repo   : CentOS6.2-Repository
    Summary     : Apache HTTP Server
    URL         : http://httpd.apache.org/
    License     : ASL 2.0
    Description : The Apache HTTP Server is a powerful, efficient, and extensible
                : web server.
    

How to remove “Red Hat Enterprise Linux Test Page”

Symptoms :
After i installed apache httpd on Red Hat Enterprise Linux (RHEL) server, i got the following message :
Red Hat Enterprise Linux Test Page

Solution :
Go to welcome.conf file :

    [root@rhel6 ~]# vi /etc/httpd/conf.d/welcome.conf
    

To disable the Welcome page, comment out all the lines below :

    # This configuration file enables the default "Welcome"
    # page if there is no default index page present for
    # the root URL.  To disable the Welcome page, comment
    # out all the lines below.
    #
    <LocationMatch "^/+$">
        Options -Indexes
        ErrorDocument 403 /error/noindex.html
    </LocationMatch>
    

Comment out all the lines as below :

    # This configuration file enables the default "Welcome"
    # page if there is no default index page present for
    # the root URL.  To disable the Welcome page, comment
    # out all the lines below.
    #
    #<LocationMatch "^/+$">
    #    Options -Indexes
    #    ErrorDocument 403 /error/noindex.html
    #</LocationMatch>
    

Reload the apache httpd service to take effect :

    [root@rhel6 ~]# service httpd reload
    Reloading httpd: