操作系统:centos mini 6.5
yum install httpd.x86_64 httpd-manual.x86_64 php-xml php-mbstring mysql-server.x86_64 mysql.x86_64 php-mysql.x86_64 php.x86_64 php-bcmath.x86_64 php-gd.x86_64 mysql-devel.x86_64 curl-devel gcc.x86_64 libgcc.x86_64 make net-snmp.x86_64 net-snmp-devel.x86_64 net-snmp-utils.x86_64 wget ntp vim
这里需要两个 Y
ntpdate 202.120.2.101
date ; hwclock -w
sed -i "s/#ServerName www.example.com:80/ServerName localhost:80/g" /etc/httpd/conf/httpd.conf
service httpd restart
service mysqld start
mysqladmin -uroot -p password
mysql密码(和password中间有个空格)
这里需要一个回车
chkconfig --add httpd
chkconfig --level 345 httpd on
chkconfig --add mysqld
chkconfig --level 345 mysqld on
wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.0/zabbix-2.2.0.tar.gz
(tar包也可以更换为其它版本,安装方法是一样的,如果tar包更换,下面的目录也变成和tar包一样的名字就行)
tar zxvf zabbix-2.2.0.tar.gz
useradd -d /home/zabbix -p zabbix zabbix
mysql -uroot -p
mysql密码
create database zabbix character set utf8;
flush privileges;
quit;
mysql -uroot -p'
mysql密码' zabbix < /root/zabbix-2.2.0/database/mysql/schema.sql
mysql -uroot -p'
mysql密码' zabbix < /root/zabbix-2.2.0/database/mysql/images.sql
mysql -uroot -p'
mysql密码' zabbix < /root/zabbix-2.2.0/database/mysql/data.sql
cd zabbix-2.2.0
./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --enable-proxy
make install
echo "zabbix-agent 10050/tcp #Zabbix Agent" >> /etc/services
echo "zabbix-agent 10050/udp #Zabbix Agent" >> /etc/services
echo "zabbix-trapper 10051/tcp #Zabbix Trapper" >> /etc/services
echo "zabbix-trapper 10051/udp #Zabbix Trapper" >> /etc/services
wget http://www.fping.org/dist/fping-3.4.tar.gz
gunzip fping-3.4.tar.gz
tar xvf fping-3.4.tar
cd fping-3.4
./configure
make install
sed -i "s/# DBUser=/DBUser=root/g" /usr/local/etc/zabbix_server.conf
sed -i "s/# DBPassword=/DBPassword=
mysql密码/g" /usr/local/etc/zabbix_server.conf
sed -i "s/\# FpingLocation\=\/usr\/sbin\/fping/FpingLocation\=\/usr\/local\/sbin\/fping/g" /usr/local/etc/zabbix_server.conf
cp -r /root/zabbix-2.2.0/frontends/php/* /var/www/html
sed -i "s/max_execution_time = 30/max_execution_time = 300/g" /etc/php.ini
sed -i "s/max_input_time = 60/max_input_time = 300/g" /etc/php.ini
sed -i "s/post_max_size = 8M/post_max_size = 16M/g" /etc/php.ini
sed -i "s/;date.timezone =/date.timezone = PRC/g" /etc/php.ini
service httpd restart
/usr/local/sbin/zabbix_server
/usr/local/sbin/zabbix_agentd
echo "/usr/local/sbin/zabbix_server" >> /etc/rc.local
echo "/usr/local/sbin/zabbix_agentd" >> /etc/rc.local
vim /var/www/html/conf/zabbix.conf.php
(把下面的文本复制到zabbix.conf.php中)
<?php
// Zabbix GUI configuration file
global $DB;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'localhost';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'root';
$DB['PASSWORD'] = '
mysql密码';
// SCHEMA is relevant only for IBM_DB2 database
$DB['SCHEMA'] = '';
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = '';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
?>
ok,大功告成,完成后直接在浏览器中输入服务器的IP地址就可以登录zabbix了,更换版本的话,把上面的tar包直接更换就可以了,其它的不需要更改,经过测试,这个安装方法使用于zabbix的2.0.X和2.2.X版本,更过资料可以参考https://www.zabbix.com/documentation