1.安装PHP
Zabbix 3.0对PHP的要求最低为5.4,而CentOS6默认为5.3.3,完全不满足要求,故需要利用第三方源,将PHP升级到5.4以上,注意,不支持PHP7
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm yum install php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap vim /etc/php.ini date.timezone = Asia/Shanghai post_max_size = 32M max_execution_time = 300 max_input_time = 300 always_populate_raw_post_data = -1
2.安装MySQL
MySQL建议使用5.6版本,CentOS6默认为5.1,不建议使用,性能偏低
rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm yum install -y mysql-server mysql-devel vim /etc/my.cnf [mysqld] innodb_file_per_table #独立表空间模式 service mysqld start mysql_secure_installation #MySQL安全配置向导 Enter current password for root (enter for none): <–初次运行直接回车 Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车 Remove anonymous users? [Y/n] <– 是否删除匿名用户,生产环境建议删除,所以直接回车 Disallow root login remotely? [Y/n] <–是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止 Remove test database and access to it? [Y/n] <– 是否删除test数据库,直接回车 Reload privilege tables now? [Y/n] <– 是否重新加载权限表,直接回车 mysql -uroot -p mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin; mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix'; mysql> flush privileges; mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | zabbix | +--------------------+
3.安装Zabbix
yum install httpd libxml2-devel net-snmp-devel libcurl-devel groupadd -g 201 zabbix useradd -g zabbix -u 201 -m zabbix wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz tar zxvf zabbix-3.0.3.tar.gz cd zabbix-3.0.3 /usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql /usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/p_w_picpaths.sql /usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql ./configure --prefix=/usr/local/zabbix --sysconfdir=/etc/zabbix/ --enable-server --enable-agent --with-net-snmp --with-libcurl --with-mysql --with-libxml2 make &&make install (编译 zabbix 如果报下面错误,就做以下操作 configure: error: Not found mysqlclient library #find / -name libmysqlclient* ln -s /usr/lib64/mysql/libmysqlclient.so.18.1.0 /usr/lib64/mysql/libmysqlclient.so ln -s /usr/lib64/mysql/libmysqlclient_r.so.18.1.0 /usr/lib64/mysql/libmysqlclient_r.so)
4.配置Zabbix
vim /etc/zabbix/zabbix_server.conf DBHost=localhost 数据库ip地址 DBName=zabbix DBUser=zabbix DBPassword=zabbix ListenIP=127.0.0.1,192.168.10.10 zabbix server ip地址 iptables -I INPUT -p tcp -m multiport --dports 10050:10051 -j ACCEPT service iptables save &&service iptables restart ln -s /usr/local/zabbix/sbin/* /usr/sbin/ cp /home/sources/zabbix-3.0.3/misc/init.d/fedora/core/zabbix_* /etc/init.d/ chmod +x /etc/init.d/zabbix_* sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_server 配置WEB vim /etc/httpd/conf/httpd.conf ServerName 127.0.0.1 ServerName 192.168.10.10 DocumentRoot "/var/www/html" mkdir -p /var/www/html/zabbix cp -r /home/sources/zabbix-3.0.3/frontends/php/* /var/www/html/zabbix/ chown -R apache.apache /var/www/html/zabbix/ chkconfig zabbix_server on /etc/init.d/zabbix_server start service httpd restart
用浏览器访问http://192.168.10.10/zabbix,并按照提示安装:
登录之后