安装zabbix
安装数据库
[root@iZgt88z6l1kvd7Z html]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
清除缓存
[root@iZgt88z6l1kvd7Z html]# dnf clean all
安装Zabbix server,Web前端,agent
[root@iZgt88z6l1kvd7Z html]# dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent
出现报错
![](https://img2020.cnblogs.com/blog/1794787/202005/1794787-20200518213223061-987369386.png)
可能是因为网络的原因,换成阿里云源试一下,把原地址注释掉
阿里云地址
[root@iZgt88z6l1kvd7Z html]# vim /etc/yum.repos.d/zabbix.repo
创建数据库
[root@iZgt88z6l1kvd7Z html]# mysql -uroot -p
Enter password:
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> create user zabbix@localhost identified by 'password';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> quit;
Bye
导入框架和数据,系统会提示输入密码,我这里设的是password
[root@iZgt88z6l1kvd7Z html]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:
为Zabbix server配置数据库,添加到配置文件 /etc/zabbix/zabbix_server.conf
[root@iZgt88z6l1kvd7Z html]# echo "DBPassword=password" >>/etc/zabbix/zabbix_server.conf
为Zabbix前端配置PHP,编辑配置文件 /etc/nginx/conf.d/zabbix.conf,(去掉 listen和server_name的注释)
编辑配置文件 /etc/php-fpm.d/zabbix.conf,去掉注释,获取正确的时区设置
启动Zabbix server和agent进程
[root@iZgt88z6l1kvd7Z html]# systemctl restart zabbix-server zabbix-agent nginx php-fpm