centos6中zabbix的安装

[不指定 2016/05/09 14:48 | by xiaoyuwxz ]
| |
以下是在centos6_64环境下安装

1、添加zabbix运行所使用的用户
useradd -M -s /sbin/nologin zabbix
2、安装扩展支持
yum -y install net-snmp-devel curl-devel
  安装bcmath的php扩展
tar zxvf php-5.4.45.tar.gz
cd php-5.4.45/ext/bcmath/
/home/web/php/bin/phpize
./configure --with-php-config=/home/web/php/bin/php-config
make && make install
生成 /home/web/php/lib/php/extensions/no-debug-non-zts-20100525/
echo "extension=bcmath.so" >/home/web/php/etc/php.d/bcmath.ini
sed -i 's/max_execution_time = 60/max_execution_time = 300/g' /home/web/php/etc/php.ini
sed -i 's/max_input_time = 60/max_input_time = 300/g' /home/web/php/etc/php.ini
service php-fpm restart

3、创建所使用的数据库用户密码和库,然后导入
cat >>zabbix.txt <CREATE USER zabbix@localhost IDENTIFIED BY "123654";
GRANT USAGE ON *.* TO zabbix@localhost IDENTIFIED BY "123654" WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
CREATE DATABASE IF NOT EXISTS zabbix ;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost;
FLUSH PRIVILEGES;
EOF
/home/web/mysql/bin/mysql -u root -pno123654 -h localhost < zabbix.txt

tar zxvf zabbix-3.0.2.tar.gz
/home/web/mysql/bin/mysql -uroot -pno123654 zabbix < zabbix-3.0.2/database/mysql/schema.sql
/home/web/mysql/bin/mysql -uroot -pno123654 zabbix < zabbix-3.0.2/database/mysql/images.sql
/home/web/mysql/bin/mysql -uroot -pno123654 zabbix < zabbix-3.0.2/database/mysql/data.sql
4、安装zabbix
cd zabbix-3.0.2
./configure --prefix=/home/web/zabbix/ --sysconfdir=/home/web/zabbix/etc/ --enable-server --enable-agent --with-net-snmp --with-libcurl --with-mysql=/home/web/mysql/bin/mysql_config
make && make install
sed -i 's/# DBPassword=/ DBPassword=123654/g' /home/web/zabbix/etc/zabbix_server.conf
sed -i 's~# DBSocket=/tmp/mysql.sock~ DBSocket=/tmp/mysql.sock~g' /home/web/zabbix/etc/zabbix_server.conf
装为服务
cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
sed -i "s~BASEDIR=/usr/local~BASEDIR=/home/web/zabbix~g" /etc/init.d/zabbix_server
sed -i "s~BASEDIR=/usr/local~BASEDIR=/home/web/zabbix~g" /etc/init.d/zabbix_agentd
chmod +x /etc/init.d/zabbix_*
chkconfig --add zabbix_server
chkconfig --add zabbix_agentd
chkconfig zabbix_server on
chkconfig zabbix_agentd on
ln -s /home/web/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
5、把网页文件移入网站目录并打开中文支持
mv frontends/php /home/wwwroot/default/zabbix
sed -i "s#false\]#true\]#g" include/locales.inc.php

#安装结束
Admin
zabbix
进入后点右上角人形图标,更改语言为zh_CN


注:
1、zabbix3需配置php5.4或更高版本
2、如防火墙设置严格还要开放server使用的端口10050-10051
Tags:
电脑类 | 评论(0) | 引用(0) | 阅读(348)