1. Add Zabbix and MySQL Repository
rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
rpm -ivh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
yum clean metadata
yum clean dbcache
yum makecache

2. Install MySQL
rpm -e --nodeps mysql-community-release-el6-5.noarch
rpm -e --nodeps mysql-libs-5.1.66-2.el6_3.x86_64
yum install -y mysql-community-client mysql-community-common mysql-community-devel mysql-community-libs mysql-community-libs-compat mysql-community-server mysql-utilities mysql-connector-odbc
chkconfig mysqld on

3. Install Apache
yum install -y httpd
chkconfig httpd on

4. Install PHP
yum install -y php php-gd php-bcmath php-xml php-mbstring php-mysql php-common php-cli

5. Install Dependencies
yum install -y OpenIPMI OpenIPMI-devel libssh2 libssh2-devel libcurl libcurl-devel net-snmp net-snmp-devel fping iksemel iksemel-devel libxml2 libxml2-devel openldap openldap-devel unixODBC unixODBC-devel

6. Download Zabbix Source
cd /root/Downloads
wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.5/zabbix-2.2.5.tar.gz

7. Create User Account of Zabbix
groupadd zabbix
useradd -g zabbix zabbix

8. Create Zabbix Database
tar xvzf zabbix-2.2.5.tar.gz
service mysqld start
cd /root/Downloads/zabbix-2.2.5/database/mysql/
mysql -uroot
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
GRANT ALL PRIVILEGES ON *.* TO 'zabbix'@'%' IDENTIFIED BY 'zabbix' WITH GRANT OPTION;
FLUSH PRIVILEGES;
quit
mysql -uroot zabbix < schema.sql
mysql -uroot zabbix < images.sql
mysql -uroot zabbix < data.sql

9. Configure Zabbix Source
cd /root/Downloads/zabbix-2.2.5
./configure --enable-server --enable-agent --enable-java --enable-ipv6 --with-mysql --with-jabber --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-ldap --with-libcurl --with-iconv --with-iconv-include --with-iconv-lib

10. Make Install Zabbix
make install
Note: Running make install will by default install the daemon binaries (zabbix_server, zabbix_agentd, zabbix_proxy) in /usr/local/sbin and the client binaries (zabbix_get, zabbix_sender) in /usr/local/bin.

11. Install Zabbix Server/Agent As Service
gedit /etc/init.d/zabbix-server
#!/bin/sh
#
# chkconfig: - 85 15
# description: Zabbix server daemon
# config: /etc/zabbix/zabbix_server.conf
#

### BEGIN INIT INFO
# Provides: zabbix
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop Zabbix server
# Description: Zabbix server
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

if [ -x /usr/local/sbin/zabbix_server ]; then
    exec=/usr/local/sbin/zabbix_server
else
    exit 5
fi

prog=${exec##*/}
conf=/usr/local/etc/zabbix_server.conf

if [ -f /etc/sysconfig/zabbix-server ]; then
    . /etc/sysconfig/zabbix-server
fi

lockfile=/var/lock/subsys/zabbix-server

start()
{
    echo -n $"Starting Zabbix server: "
    daemon $exec -c $conf
    rv=$?
    echo
    [ $rv -eq 0 ] && touch $lockfile
    return $rv
}

stop()
{
    echo -n $"Shutting down Zabbix server: "
    killproc $prog
    rv=$?
    echo
    [ $rv -eq 0 ] && rm -f $lockfile
    return $rv
}

restart()
{
    stop
    start
}

case "$1" in
    start|stop|restart)
        $1
        ;;
    force-reload)
        restart
        ;;
    status)
        status $prog
        ;;
    try-restart|condrestart)
        if status $prog >/dev/null ; then
            restart
        fi
        ;;
    reload)
        action $"Service ${0##*/} does not support the reload action: " /bin/false
        exit 3
        ;;
    *)
     echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
     exit 2
     ;;
esac

chkconfig zabbix-server on
chmod 755 /etc/init.d/zabbix-server

gedit /etc/init.d/zabbix-agent
#!/bin/sh
#
# chkconfig: - 86 14
# description: Zabbix agent daemon
# processname: zabbix_agentd
# config: /etc/zabbix/zabbix_agentd.conf
#

### BEGIN INIT INFO
# Provides: zabbix-agent
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: zabbix zabbix-proxy
# Should-Stop: zabbix zabbix-proxy
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop Zabbix agent
# Description: Zabbix agent
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

if [ -x /usr/local/sbin/zabbix_agentd ]; then
    exec=/usr/local/sbin/zabbix_agentd
else
    exit 5
fi

prog=${exec##*/}
conf=/usr/local/etc/zabbix_agentd.conf

if [ -f /etc/sysconfig/zabbix-agent ]; then
    . /etc/sysconfig/zabbix-agent
fi

lockfile=/var/lock/subsys/zabbix-agent

start()
{
    echo -n $"Starting Zabbix agent: "
    daemon $exec -c $conf
    rv=$?
    echo
    [ $rv -eq 0 ] && touch $lockfile
    return $rv
}

stop()
{
    echo -n $"Shutting down Zabbix agent: "
    killproc $prog
    rv=$?
    echo
    [ $rv -eq 0 ] && rm -f $lockfile
    return $rv
}

restart()
{
    stop
    start
}

case "$1" in
    start|stop|restart)
        $1
        ;;
    force-reload)
        restart
        ;;
    status)
        status $prog
        ;;
    try-restart|condrestart)
        if status $prog >/dev/null ; then
            restart
        fi
        ;;
    reload)
        action $"Service ${0##*/} does not support the reload action: " /bin/false
        exit 3
        ;;
    *)
     echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
     exit 2
     ;;
esac

chkconfig zabbix-agent on
chmod 755 /etc/init.d/zabbix-agent

12. Setup Zabbix Server
gedit /usr/local/etc/zabbix_server.conf
Setup parameters as following:

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix


13. Install Zabbix Frontend
mkdir /var/www/html/zabbix
cp -a /root/Downloads/zabbix-2.2.5/frontends/php/* /var/www/html/zabbix/
chown -R apache.apache /var/www/html/zabbix

14. Setup PHP
gedit /etc/php.ini
Setup parameters as following:

post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai


15. Setup unixODBC
ln -s /usr/lib64/libmyodbc5w.so /usr/lib64/libmyodbc5.so

gedit /etc/odbcinst.ini
[PostgreSQL]
Description          = ODBC for PostgreSQL
Driver          = /usr/lib/psqlodbc.so
Setup          = /usr/lib/libodbcpsqlS.so
Driver64          = /usr/lib64/psqlodbc.so
Setup64          = /usr/lib64/libodbcpsqlS.so
FileUsage          = 1

[MySQL]
Description          = ODBC for MySQL
Driver          = /usr/lib/libmyodbc5.so
Setup          = /usr/lib/libodbcmyS.so
Driver64          = /usr/lib64/libmyodbc5.so
Setup64          = /usr/lib64/libodbcmyS.so
FileUsage          = 1

[MySQL ODBC 5.3 Unicode Driver]
Driver          = /usr/lib64/libmyodbc5w.so
UsageCount          = 1

[MySQL ODBC 5.3 ANSI Driver]
Driver          = /usr/lib64/libmyodbc5a.so
UsageCount          = 1


gedit /etc/odbc.ini
[test]
Description = MySQL test database
Driver      = MySQL
Server      = 127.0.0.1
User        = zabbix
Password    = zabbix
Port        = 3306
Database    = zabbix


16. Test ODBC Configuration
isql -v test
The output message are shown below:

+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>


16. Start Related Service
service zabbix-server start
service zabbix-agent start
service httpd start