环境需求:
新的zabbix3.0.3要求:
Apache 1.3.12 or later
PHP 5.4.0 or later
gd 2.0 or later
libXML 2.6.15 or later
yum 源配置
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm#有最新的PHP
基础环境安装
yum install wget vim tree gcc gcc-c++ autoconf httpd MysqL MysqL-server httpd-manual mod_ssl mod_perl mod_auth_MysqL MysqL-connector-odbc MysqL-devel libdbi-dbd-MysqL net-snmp net-snmp-devel curl-devel libxml2-devel PHP55w PHP55w-bcmath PHP55w-cli PHP55w-common PHP55w-devel PHP55w-fpm PHP55w-gd PHP55w-imap PHP55w-ldap PHP55w-mbstring PHP55w-mcrypt PHP55w-MysqL PHP55w-odbc PHP55w-pdo PHP55w-pear PHP55w-pecl-igbinary PHP55w-xml PHP55w-xmlrpc PHP55w-opcache PHP55w-intl PHP55w-pecl-memcache libmcrypt-devel libmcrypt lrzsz
在 iptables 中放行 80,10050,10051 端口
# iptables -I INPUT -p tcp -m multiport --destination-port 80,10050:10051 -j ACCEPT
查看防火墙结果
# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 multiport dports 80,10050:10051
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
保存iptables规则
# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
配置PHP参数
这里如果不配置,在web安装的时候会提示,报错
sed -i "s@;date.timezone =@date.timezone = Asia/Shanghai@g" /etc/PHP.ini
sed -i "s@max_execution_time = 30@max_execution_time = 300@g" /etc/PHP.ini
sed -i "s@post_max_size = 8M@post_max_size = 32M@g" /etc/PHP.ini
sed -i "s@max_input_time = 60@max_input_time = 300@g" /etc/PHP.ini
sed -i "s@memory_limit = 128M@memory_limit = 128M@g" /etc/PHP.ini
sed -i "s@;mbstring.func_overload = 0@ambstring.func_overload = 2@g" /etc/PHP.ini
解决http的FQDN问题
vim /etc/httpd/conf/httpd.conf
把ServerName 这一行修改成ServerName 127.0.0.1:80
下载zabbix-3.0.3.tar.gz源码包
上传源码包到/usr/local/src目录下
使用lrzsz或者其他上传工具
groupadd -g 888 zabbix
useradd -g zabbix -u 888 -s /sbin/nologin zabbix
解压zabbix软件包,并安装
tar xf zabbix-3.0.3.tar.gz
cd zabbix-3.0.3
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-MysqL=/usr/bin/MysqL_config --with-net-snmp --with-libcurl --with-libxml2 --enable-proxy
make && make install
创建数据库和相关表
[root@MB zabbix-3.0.3]# pwd
/usr/local/src/zabbix-3.0.3
MysqL -e "create database zabbix default charset utf8;"
MysqL -e "grant all on zabbix.* to zabbix@localhost identified by 'zabbix';"
MysqL -uzabbix -pzabbix zabbix<./database/MysqL/schema.sql
MysqL -uzabbix -pzabbix zabbix<./database/MysqL/images.sql
MysqL -uzabbix -pzabbix zabbix<./database/MysqL/data.sql
配置软连接和启动文件信息
mkdir /var/log/zabbix
chown zabbix.zabbix /var/log/zabbix
ln -s /usr/local/zabbix/etc/ /etc/zabbix
ln -s /usr/local/zabbix/bin/* /usr/bin/
ln -s /usr/local/zabbix/sbin/* /usr/sbin/
cp /usr/local/src/zabbix-3.0.3/misc/init.d/fedora/core/zabbix_* /etc/init.d
chmod 755 /etc/init.d/zabbix_*
sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_server
sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_agentd
修改/etc/zabbix/zabbix_server.conf
DBUser=zabbix
DBPassword=zabbix
修改/etc/zabbix/zabbix_agentd.conf,
这里的 IP 地址写的是 zabbix_server 的 IP 地址,即10.0.0.222
sed -i "s@Server=127.0.0.1@Server=10.0.0.222@g" /etc/zabbix/zabbix_agentd.conf
#sed -i "s@ServerActive=127.0.0.1@ServerActive=$IP:10051@g" /etc/zabbix/zabbix_agentd.conf
sed -i "s@tmp/zabbix_agentd.log@var/log/zabbix/zabbix_agentd.log@g" /etc/zabbix/zabbix_agentd.conf
复制 zabbix 站点的文件到/var/www/html 目录下
cp -r /usr/local/src/zabbix-3.0.3/frontends/PHP/ /var/www/html/zabbix/
chown -R apache.apache /var/www/html/zabbix/
chkconfig zabbix_server on
chkconfig zabbix_agentd on
# service zabbix_server start
Starting zabbix_server: [ OK ]
# service zabbix_agentd start
Starting zabbix_agentd: [ OK ]通过 web 站点配置 zabbix
打开浏览器显示的界面,点击下一步
这里会出现安装环境是否符合他的要求,上面我们调整PHP参数的时候就是把这里的要求调整到zabbix的要求
输入数据库zabbix的密码
zabbix服务器的配置详细信息,这里可以设置zabbix的服务器地址
最后的确认信息
提示安装成功
其他故障问题
通过#find / -name locales.inc.PHP查找到文件地址
将false改成true
更改一下时区
#cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
2. 正常安装完zabbix后,登录后zabbix监控报错zabbix server is not running: the information displayed may not be current
selinux是否关闭。一定要关闭这个,开启selinux会引起一连串问题,甚至zabbix的discovery功能也不能正常使用
修改/etc/selinux/config文件中的SELINUX="" 为 disabled ,然后重启
3. 字体乱码
解决方法一:
1.从 windows 下控制面板->字体->选择一种中文字库例如“楷体”
2.将字体上传至/var/www/html/zabbix/fonts 目录下
# vim /var/www/html/zabbix/include/defines.inc.PHP
#修改如下 2 行
define('ZBX_FONT_NAME','simkai');
define('ZBX_GRAPH_FONT_NAME','simkai');
解决方法二:
yum -y --nogpgcheck install wqy-microhei-fonts
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
原文链接:https://www.f2er.com/centos/381581.html