Centos8 部署 Zabbix
官方下载地址:https://www.zabbix.com/download
1.下载rpm包
wget -P /home https://repo.zabbix.com/zabbix/6.2/rhel/8/x86_64/zabbix-release-6.2-3.el8.noarch.rpm
2.安装
cd /home
dnf clean all rpm -Uvh zabbix-release-6.2-3.el8.noarch.rpm
3.切换 PHP 模块版本
dnf module switch-to php:7.4
4.安装 Zabbix 服务器、前端、代理
dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
5.初始化数据库,我选择的是mysql
1.创建数据库、用户及相应的赋权
# mysql -uroot -p password mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin; mysql> create user zabbix@localhost identified by 'password'; mysql> grant all privileges on zabbix.* to zabbix@localhost; mysql> set global log_bin_trust_function_creators = 1; mysql> quit;
2.初始化数据
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
3.导入完成后禁用 log_bin_trust_function_creators 选项
# mysql -uroot -p password mysql> set global log_bin_trust_function_creators = 0; mysql> quit;
6.配置Zabbix
1.修改数据库连接配置
编辑文件 /etc/zabbix/zabbix_server.conf
DBPassword=password
7.设置开机启动并启动 Zabbix 服务器和代理进程
systemctl restart zabbix-server zabbix-agent httpd php-fpm
systemctl enable zabbix-server zabbix-agent httpd php-fpm
8.开放端口
firewall-cmd --zone=public --add-port=80/tcp --permanent //添加端口 firewall-cmd --reload //重载 firewall-cmd --zone=public --query-port=80/tcp //查询端口开放是否成功
9.访问Zabbix UI
Zabbix UI 的默认 URL 是 http://host/zabbix