Install Zabbix 2.2.6 From Sources (CentOS 6.4)
1. Add Zabbix and MySQL Repositoryrpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpmrpm -ivh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpmyum clean metadatayum clean dbcacheyum makecache2. Install MySQLrpm -e --nodeps mysql-libs-5.1.66-2.el6_3.x86_64yum 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-odbcchkconfig mysqld on
3. Install Apacheyum install -y httpdchkconfig httpd on
4. Install PHPyum install -y php php-gd php-bcmath php-xml php-mbstring php-mysql php-common php-cli
5. Install Dependenciesyum 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 Sourcecd /root/Downloadswget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.6/zabbix-2.2.6.tar.gz
7. Create User Account of Zabbixgroupadd zabbix
useradd -g zabbix zabbix
8. Create Zabbix Databasetar xvzf zabbix-2.2.6.tar.gzservice mysqld startcd /root/Downloads/zabbix-2.2.6/database/mysql/mysql -urootcreate database zabbix character set utf8 collate utf8_bin;grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY 'zabbix';FLUSH PRIVILEGES;quitmysql -uroot zabbix < schema.sqlmysql -uroot zabbix < images.sqlmysql -uroot zabbix < data.sql
9. Configure Zabbix Sourcecd /root/Downloads/zabbix-2.2.6./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 Zabbixmake installNote: 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 Servicegedit /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 onchmod 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 onchmod 755 /etc/init.d/zabbix-agent
12. Setup Zabbix Servergedit /usr/local/etc/zabbix_server.confSetup parameters as following:
DBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=zabbix
13. Install Zabbix Frontendmkdir /var/www/html/zabbixcp -a /root/Downloads/zabbix-2.2.6/frontends/php/* /var/www/html/zabbix/chown -R apache.apache /var/www/html/zabbix
14. Setup PHPgedit /etc/php.iniSetup parameters as following:
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
15. Setup unixODBCln -s /usr/lib64/libmyodbc5w.so /usr/lib64/libmyodbc5.so
gedit /etc/odbcinst.ini
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
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
Driver = /usr/lib64/libmyodbc5w.so
UsageCount = 1
Driver = /usr/lib64/libmyodbc5a.so
UsageCount = 1
gedit /etc/odbc.ini
Description = MySQL test database
Driver = MySQL
Server = 127.0.0.1
User = zabbix
Password = zabbix
Port = 3306
Database = zabbix
16. Test ODBC Configurationisql -v testThe output message are shown below:
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help |
| quit |
| |
+---------------------------------------+
SQL>
16. Start Related Serviceservice zabbix-server startservice zabbix-agent startservice httpd start
页:
[1]