Step 1 – SetUp Apache, MySQL and PHP MySQL建议使用5.6版本,CentOS6默认为5.1,不建议使用,性能偏低
# rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
# yum install httpd httpd-devel mysql mysql-server
Zabbix 3.0对PHP的要求最低为5.4,而CentOS6默认为5.3.3,完全不满足要求,故需要利用第三方源,将PHP升级到5.4以上,注意,不支持PHP7
# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
# yum install php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap
# service httpd start
# service mysqld start
# chkconfig httpd on
# chkconfig mysqld on
Step 2 – Configure Yum Repository
# yum install http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
Step 3 – Install Zabbix Server with MySQL
# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway -y
Step 4 – Setup Zabbix Apache Configuration
# cp /usr/share/doc/zabbix-web-3.0.7/httpd22-example.conf /etc/httpd/conf.d/zabbix.conf
# vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
# After changing value restart Apache service.
# service httpd restart
Step 5 – Create Zabbix MySQL Database
# mysql -u root -p
mysql> CREATE DATABASE zabbixdb CHARACTER SET UTF8;
mysql> GRANT ALL PRIVILEGES on zabbixdb.* to zabbix@localhost IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> quit
# cd /usr/share/doc/zabbix-server-mysql-3.0.0/
# zcat create.sql.gz | mysql -uroot -p zabbix
Step 6 Zabbix and JMX Config
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
JavaGateway=192.168.56.12
JavaGatewayPort=10052
StartJavaPollers=5
# vi /etc/zabbix/zabbix_java_gateway.conf
LISTEN_IP="0.0.0.0"
LISTEN_PORT=10052
PID_FILE="/var/run/zabbix/zabbix_java.pid"
START_POLLERS=5
TIMEOUT=3
Step 7 – Start Zabbix Server
# service zabbix-server start
# service zabbix-java-gateway start
# chkconfig zabbix-server on
# chkconfig zabbix-java-gateway on
Step 8 – Start Zabbix Web Installer http://localhost/zabbix/
Step 9 Tomcat 配置 JMX 支持 安装jdk,下载tomcat (系统自带jdk1.6不支持tomcat 8/9的版本)
# 修改 apache-tomcat/bin/catalina.sh
# 在 Execute The Requested Command 前加入如下代码(未采用认证加密方式):
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=12345
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=(Tomcat所在主机的公网ip)"