一、使用zabbix官方源
rpm -Uvh https://repo.zabbix.com/zabbix/6.4/rhel/9/x86_64/zabbix-release-6.4-1.el9.noarch.rpm
dnf clean all
dnf install zabbix-server-pgsql zabbix-web-pgsql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
二、安装MariaDB并设置成开机启动(安装包是“mariadb-server”,不是“mariadb”)
sudo dnf install mariadb-server
sudo systemctl start mariadb
sudo systemctl enable mariadb
三、设置数据库,导入模板
1.登录数据库,输入root账号密码
mysql -uroot -p
2.把单引号中的Password换成你要设置的密码
create database zabbix character set utf8mb4 collate utf8mb4_bin;
create user zabbix@localhost identified by 'Password';
grant all privileges on zabbix.* to zabbix@localhost;
set global log_bin_trust_function_creators = 1;
quit;
3.导入模板,会提示你输入密码。
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
4.导入数据库架构后禁用log_bin_trust_function_creators选项。
mysql -uroot -p
set global log_bin_trust_function_creators = 0;
quit;
四、配置zabbix前端和数据库连接密码
vi /etc/zabbix/zabbix_server.conf
找到“DBPassword”,在等号后面填入刚才设置的密码
vi /etc/nginx/conf.d/zabbix.conf
取消 “listen”和 “server_name” 前面的注释,如果要修改的话自行修改
五、安装PHP-7.4.33
不支持PHP8以上,网上很多都不说这个问题,只是叫你去重新编译。
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
sudo dnf module enable php:remi-7.4
yum install php -y
六、关闭SELinux,打开防火墙端口
setenforce 0
firewall-cmd --zone=public --add-port=8080/tcp --permanent #permanent
firewall-cmd --reload
七、重启相关服务并设置开机启动
systemctl restart zabbix-server zabbix-agent nginx php-fpm
systemctl enable zabbix-server zabbix-agent nginx php-fpm
八、设置MariaDB数据库安全性
sudo mysql_secure_installation
第一次运行 MariaDB,所以 root 用户还没有密码,直接按回车键继续,以下几个选项Y。其余N
Set root password? [Y/n]
Remove anonymous users? [Y/n]
Disallow root login remotely? [Y/n]
Remove test database and access to it? [Y/n]
Reload privilege tables now? [Y/n]
相关文档:
1.下载Zabbix 6.4 for Rocky Linux 9, MySQL, Nginx
发文助手
共 1 条建议
重新检测
发文建议
基础信息