1.部署zabbix
1.1 下载安装zabbix
[root@zabbix ~]# wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
[root@zabbix ~]# rpm -ivh zabbix-release-4.0-2.el7.noarch.rpm
# 使用清华源
[root@zabbix ~]# vim /etc/yum.repos.d/zabbix.repo
[root@zabbix ~]# yum install zabbix-server-mysql zabbix-web-mysql -y
[root@zabbix ~]# yum install mariadb-server -y
[root@zabbix ~]# systemctl start mariadb
[root@zabbix ~]# systemctl enable mariadb
1.2 初始化数据库
[root@zabbix ~]# mysql_secure_installation
1.3 授权数据库用户
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by 'cecej.com';
1.4 导入zabbix表结构和初始化数据
[root@zabbix ~]# rpm -ql zabbix-server-mysql | grep mysql
[root@zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql-4.0.27/create.sql.gz | mysql -uzabbix -p'cecej.com' zabbix
# 检查zabbix库是否导入成功
[root@zabbix ~]# mysql zabbix -e 'show tables'
1.5 配置zabbix-server
[root@zabbix ~]# vim /etc/zabbix/zabbix_server.conf
1.6 启动zabbix
[root@zabbix ~]# systemctl start zabbix-server
[root@zabbix ~]# systemctl enable zabbix-server