安装 Zabbix 前端包,提示cannot find a valid baseurl for repo:centos-sclo-rh/x86 64
安装zabbix前端包
# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
解决办法:
原因是:CentOS7的SCL源在2024年6月30日停止维护了。
1.将之前的源进行备份
cd /etc/yum.repos.d/
mv CentOS-SCLo-scl.repo CentOS-SCLo-scl.repo.bak
mv CentOS-SCLo-scl-rh.repo CentOS-SCLo-scl-rh.repo.bak
2.创建一个新的文件
vim CentOS-SCLo-rh.repo
写入下面信息
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
3.然后清理缓存,生成新的缓存,重新下载安装zabbix的前端包即可。
yum clean all
yum makecache
启动zabbix-server报错
[root@localhost ~]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
Job for zabbix-server.service failed. See "systemctl status zabbix-server.service" and "journalctl -xe" for details.
查看状态
查看日志找到问题
connection to database 'zabbix' failed: [2059] Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.
这是由于
原因:
身份验证插件找不到。原来,MySql 8.0.23 换了新的身份验证插件(caching_sha2_password),原来的身份验证插件为(mysql_native_password)。zabbix找不到新的身份验证插件(caching_sha2_password)
我们将mysql用户使用的登录密码加密规则 还原成 mysql_native_password,即可登陆成功。
解决办法:
1.查看zabbix用户是否是caching_sha2_password
mysql> use mysql;
mysql> select user,host,plugin,authentication_string from user;
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| user | host | plugin | authentication_string |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| mysql.infoschema | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.session | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.sys | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| root | localhost | caching_sha2_password | $A$005$IIAg]pS0qSl?MX8 MR6PV3wPTeb2KWmw0nAS2chotfYlSM4Th30lSQKvGQB |
| zabbix | localhost | caching_sha2_password | $A$005$*JV0Ai0&ufL?<oI,UySKFiS/jjZRXR3YQA7H6TBcrduPFUPHWe/IEkV8Rjp4 |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
5 rows in set (0.00 sec)
我们尝试直接对他进行修改,发现会报错
2.确认mysql_native_password插件是否已经安装
安装mysql_native_password插件
INSTALL PLUGIN mysql_native_password SONAME 'mysql_native_password';
如果已经安装,会显示该插件已经存在
3.查看插件状态
看看mysql_native_password插件的状态是不是ACTIVE,如果状态值为DISABLED则说明插件没有激活
4.那么需要对插件进行激活
不要添加default_authentication_plugin=mysql_native_password,否则mysql会无法启动。
修改my.cnf或my.ini配置文件
[mysqld]
mysql_native_password=ON #添加此行
之后重启MySQL服务
systemctl restart mysqld
5.登录数据库,再次查看他的插件状态,如果是ACTIVE,则说明插件已经被激活
6.修改密码认证方式
ALTER USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your password'; 你的zabbix用户的数据库密码
FLUSH PRIVILEGES; #刷新权限
mysql> use mysql;
mysql> select user,host,plugin from mysql.user;
+------------------+-----------+-----------------------+
| user | host | plugin |
+------------------+-----------+-----------------------+
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session | localhost | caching_sha2_password |
| mysql.sys | localhost | caching_sha2_password |
| root | localhost | mysql_native_password |
| zabbix | localhost | caching_sha2_password |
+------------------+-----------+-----------------------+
修改密码认证
mysql> ALTER USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Aa@123456';
Query OK, 0 rows affected (0.00 sec)
刷新权限
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
7.查看权限
mysql> select user,host,plugin from mysql.user;
+------------------+-----------+-----------------------+
| user | host | plugin |
+------------------+-----------+-----------------------+
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session | localhost | caching_sha2_password |
| mysql.sys | localhost | caching_sha2_password |
| root | localhost | mysql_native_password |
| zabbix | localhost | mysql_native_password |
+------------------+-----------+-----------------------+
5 rows in set (0.00 sec)
8.重新启动zabbix-server,可以正常启动了
[root@localhost etc]# systemctl restart zabbix-server
部署zabbix详细文档可以参考此文
https://blog.csdn.net/m0_59933574/article/details/134398356?spm=1001.2014.3001.5501
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 部署zabbix遇到问题: cannot find a valid baseurl for repo:centos-sclo-rh/x86 64 怎么解决 ?
发表评论 取消回复