1.环境准备
OS:CentOS Linux release 7.2.1511
Zabbix版本:4.0-1.el7
MySQL版本:5.6
2.安装步骤
2.1.安装zabbix-server-mysql和zabbix-web-mysql、agent
rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
2.2.安装mysql5.6
[root@linux-node2 ~]# rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm
[root@linux-node2 ~]# yum install -y mysql-community-server
[root@linux-node2 ~]# systemctl start mysqld
[root@linux-node2 ~]# /sbin/chkconfig mysqld on #开机启动
[root@linux-node2 ~]# mysql_secure_installation #初始化数据库信息
2.3.创建zabbix数据库,创建zabbix账号
[root@linux-node2 ~]# mysql -uroot -p
...
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
2.4 导入默认的zabbix数据库信息
zcat /usr/share/doc/zabbix-server-mysql-3.0.12/create.sql.gz | mysql zabbix -uzabbix -pzabbix
2.5 修改配置文件
修改zabbix_server.conf的配置文件为如下:
[root@linux-node2 ~]# grep ^DB /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
修改配置文件/etc/httpd/conf.d/zabbix.conf,时区改成 Asia/Shanghai:php_value date.timezone Asia/Shanghai
2.6 启动zabbix-server服务
[root@linux-node2 ~]# systemctl start httpd
[root@linux-node2 ~]# systemctl enable httpd
[root@linux-node2 ~]# netstat -an |grep 80
[root@linux-node2 ~]# systemctl start zabbix-server
[root@linux-node2 ~]# systemctl enable zabbix-server #设置开机启动
查看zabbix-server日志:tailf /var/log/zabbix/zabbix_server.log
访问网站,例如:http://本机IP/zabbix,进行一些默认配置即可。默认账号Admin 密码zabbix
参考官网:https://www.zabbix.com/download?zabbix=4.0&osdistribution=centos&osversion=7&db=MySQL
官方文档:https://www.zabbix.com/documentation/current/