Zabbix安装部署文档
Zabbix安装部署文档
https://blog.csdn.net/m0_56055257/article/details/131260948
以上文档可以直接复制内容部署,写的非常好用
在本教程中,展示如何在 CentOS 8 / RHEL 8 / Oracle Linux 8 / Alma Linux 8/ Rocky Linux 8 上安装最新的 Zabbix 6.4 版本。
1、基本配置
1.0关闭防火墙和SELINUX
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i "s/enforcing/permissive/g" /etc/selinux/config
1.1更换源
#更换源根据自己实际情况
cd /etc/yum.repos.d
rm -rf *
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all
yum makecache
二、安装zabbix服务器前端和agent
2.1安装zabbix存储库
rpm -Uvh https://repo.zabbix.com/zabbix/6.4/rhel/8/x86_64/zabbix-release-6.4-1.el8.noarch.rpm
dnf clean all
2.2切换PHP的DNF模块版本
dnf module switch-to php:7.4
三、安装和配置数据库
3.1安装MariDB10.6
curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
sudo bash mariadb_repo_setup --mariadb-server-version=10.6
dnf -y install mariadb-server && systemctl start mariadb && systemctl enable mariadb
\#安装完成后启动并且设置为开机启动
3.2重置数据库的root密码
初始化数据库
mariadb-secure-installation
Enter current password for root (enter for none): Press Enter
Switch to unix_socket authentication [Y/n] y
Change the root password? [Y/n] y
New password: <Enter root DB password> #设置新的密码
Re-enter new password: <Repeat root DB password>
Remove anonymous users? [Y/n]: Y #删除anonymous账户
Disallow root login remotely? [Y/n]: Y #是否需要远程登录
Remove test database and access to it? [Y/n]: Y #删除test库
Reload privilege tables now? [Y/n]: Y #重新加载表
3.3创建数据库
mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'password'; #要设置的zabbix密码
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
3.4导入舒适架构和数据 #提供提示你输入新创建的密码就是上面设置的zabbix密码
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
3.5导入数据库模式后禁用log_bin_trust_function_creators选项
mysql -uroot -p
password #你的root用户密码
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
四、zabbix-server配置数据库及前端配置PHP
4.1配置zabbix_server
vim /etc/zabbix/zabbix_server.conf

4.2配置php
vim /etc/php.ini
post_max_size = 16M #由8M改为16M
max_execution_time = 300 #由30改为300
max_input_time = 300 #由60改为300
4.3配置Nginx
vim /etc/nginx/conf.d/zabbix.conf
listen 8080;
server_name example.com;
#取消注释并设置保存
4.4启动zabbix server和agent进程
systemctl restart zabbix-server zabbix-agent nginx php-fpm
systemctl enable zabbix-server zabbix-agent nginx php-fpm
报错:
1.问题
在安装zabbix5.0时使用的mysql80作为后端数据库配置好了数据之后开启zabbix-server服务的时候出现如下的错误:


就是如下报错:caching_sha2_password
connection to database 'zabbix' failed: [2059] Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.
2.分析
无法加载身份验证插件,身份验证插件找不到,MySql 8.0.32 换了新的身份验证插件(caching_sha2_password);之前的身份验证插件为(mysql_native_password)。zabbix找不到换了之后的验证插件身份。
可以尝试将mysql用户使用的登录密码加密规则 还原成 mysql_native_password。
3.解决
mysql> use mysql;
mysql> select user,host,plugin,authentication_string from user;

mysql>alter user 'zabbix'@'localhost' identified with mysql_native_password by 'Lyg@123.com';
mysql> select user,host,plugin,authentication_string from user;

重启zabbix:

其他报错:
8.0的mysql数据库再第一次登录进去需要输入密码:密码再/var/log/mysqld.log这个文件中。
登录后,第一次需要强制修改密码:命令如下:
MYSQL#> alter user 'root'@'localhost' IDENTIFIED BY '密码';
切记:密码有安全限制,需要有大小写和特殊字符和数字。否则修改失败。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南