rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等)

cd /zabbix/4.0
yum install -y zabbix-server-mysql-4.0.5-1.el7.x86_64.rpm
 zabbix-web-mysql-4.0.5-1.el7.noarch.rpm
 zabbix-web-4.0.5-1.el7.noarch.rpm 
 zabbix-sender-4.0.5-1.el7.x86_64.rpm
 php-mbstring-5.4.16-42.el7.x86_64.rpm php-bcmath-5.4.16-42.el7.x86_64.rpm
fping-3.10-1.el7.x86_64.rpm
 iksemel-1.4-2.el7.centos.x86_64.rpm -y

在rhel7.2的环境下会出现以下报错:

Error: Package: php-bcmath-5.4.16-42.el7.x86_64 (/php-bcmath-5.4.16-42.el7.x86_64)
           Requires: php-common(x86-64) = 5.4.16-42.el7
           Installing: php-common-5.4.16-36.el7_1.x86_64 (rhel7.2)
               php-common(x86-64) = 5.4.16-36.el7_1
Error: Package: php-mbstring-5.4.16-42.el7.x86_64 (/php-mbstring-5.4.16-42.el7.x86_64)
           Requires: php-common(x86-64) = 5.4.16-42.el7
           Installing: php-common-5.4.16-36.el7_1.x86_64 (rhel7.2)
               php-common(x86-64) = 5.4.16-36.el7_1
Error: Package: php-mbstring-5.4.16-42.el7.x86_64 (/php-mbstring-5.4.16-42.el7.x86_64)
           Requires: php-common(x86-64) = 5.4.16-42.el7
           Available: php-common-5.4.16-36.el7_1.x86_64 (rhel7.2)
               php-common(x86-64) = 5.4.16-36.el7_1
Error: Package: php-bcmath-5.4.16-42.el7.x86_64 (/php-bcmath-5.4.16-42.el7.x86_6

解决办法
首先如果是在虚拟机中,那么虚拟机一定要能连接外网

rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等)_第1张图片

这是zabbix官方镜像zabbix.repo
在这里插入图片描述

yum-config-manager --enable rhel-7-server-optional-rpms

报错

yum-config-manager: command not found

解决办法

yum whatprovides */yum-config-manager

yum install yum-utils-1.1.31-34.el7.noarch -y

再次安装

yum-config-manager --enable rhel-7-server-optional-rpms

报错

[root@server3 yum.repos.d]# yum-config-manager --enable rhel-7-server-optional-rpms
Loaded plugins: product-id

按照官网执行这条命令出现会出现以上报错,这个我也不知道怎么解决…但是我直接跳过这一步,尝试安装下一步的时候发现了更具体的问题报错

yum clean all ##清除缓存
yum repolist  

出现这个报错:
查询了半天,发现这是因为被墙了
rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等)_第2张图片
解决办法:尝试在国内的网站中寻找镜像,清华大学的镜像网站上有
这里附上我找到答案的原文链接
参考链接

vim /etc/yum.repos.d/zabbix.repo
将配置文件进行修改

[zabbix]
name=Zabbix Official Repository - $basearch
#baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

#[zabbix-non-supported]
#name=Zabbix Official Repository non-supported - $basearch 
#baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
#enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
#gpgcheck=1

rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等)_第3张图片
再次yum安装

yum install -y zabbix-server-mysql-4.0.5-1.el7.x86_64.rpm
 zabbix-web-mysql-4.0.5-1.el7.noarch.rpm
 zabbix-web-4.0.5-1.el7.noarch.rpm 
 zabbix-sender-4.0.5-1.el7.x86_64.rpm
 php-mbstring-5.4.16-42.el7.x86_64.rpm php-bcmath-5.4.16-42.el7.x86_64.rpm
fping-3.10-1.el7.x86_64.rpm
 iksemel-1.4-2.el7.centos.x86_64.rpm -y

依然报错

Error: Package: php-bcmath-5.4.16-42.el7.x86_64 (/php-bcmath-5.4.16-42.el7.x86_64)
           Requires: php-common(x86-64) = 5.4.16-42.el7
           Installing: php-common-5.4.16-36.el7_1.x86_64 (rhel7.2)
               php-common(x86-64) = 5.4.16-36.el7_1
Error: Package: php-mbstring-5.4.16-42.el7.x86_64 (/php-mbstring-5.4.16-42.el7.x86_64)
           Requires: php-common(x86-64) = 5.4.16-42.el7
           Installing: php-common-5.4.16-36.el7_1.x86_64 (rhel7.2)
               php-common(x86-64) = 5.4.16-36.el7_1
Error: Package: php-mbstring-5.4.16-42.el7.x86_64 (/php-mbstring-5.4.16-42.el7.x86_64)
           Requires: php-common(x86-64) = 5.4.16-42.el7
           Available: php-common-5.4.16-36.el7_1.x86_64 (rhel7.2)
               php-common(x86-64) = 5.4.16-36.el7_1
Error: Package: php-bcmath-5.4.16-42.el7.x86_64 (/php-bcmath-5.4.16-42.el7.x86_64)
           Requires: php-common(x86-64) = 5.4.16-42.el7
           Available: php-common-5.4.16-36.el7_1.x86_64 (rhel7.2)
               php-common(x86-64) = 5.4.16-36.el7_1
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

由于上一步yum-config-manager --enable rhel-7-server-optional-rpms没有执行成功导致的
解决方法
这两个模块的yum源比较少,在网上发现163的yum源包含它们,那么就需要替换yum源,步骤如下:


cd /etc/yum.repos.d/
yum whatprovides */wget
[root@server3 yum.repos.d]# yum install wget-1.14-10.el7_0.1.x86_64
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等)_第4张图片
在这里插入图片描述
修改文件CentOS7-Base-163.repo
增加三行,注释三行
rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等)_第5张图片
rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等)_第6张图片
rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等)_第7张图片
rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等)_第8张图片

yum clean all 
yum makecache

rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等)_第9张图片
这次没有报错
再次尝试安装,记得加上依赖性包

[root@server3 4.0]# yum install zabbix-server-mysql zabbix-web-mysql   fping-3.10-1.el7.x86_64.rpm iksemel-1.4-2.el7.centos.x86_64.rpm -y

fping-3.10-1.el7.x86_64.rpm
https://centos.pkgs.org/7/epel-x86_64/pptpd-1.4.0-2.el7.x86_64.rpm.html
安装成功
问题解决!
如果不放心还可以重新再安装一遍所有的软件

yum install -y zabbix-server-mysql-4.0.5-1.el7.x86_64.rpm
 zabbix-web-mysql-4.0.5-1.el7.noarch.rpm
 zabbix-web-4.0.5-1.el7.noarch.rpm 
 zabbix-sender-4.0.5-1.el7.x86_64.rpm
 php-mbstring-5.4.16-42.el7.x86_64.rpm php-bcmath-5.4.16-42.el7.x86_64.rpm
fping-3.10-1.el7.x86_64.rpm
 iksemel-1.4-2.el7.centos.x86_64.rpm -

rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等)_第10张图片
成功安装!!!只要按照上述步骤进行yum源的添加,可以虚拟机中尝试以下,能成功安装.。
接下去配置Zabbix以及Zabbix监控请参照https://blog.csdn.net/monster_warm/article/details/102876919

你可能感兴趣的:(rhel7.2安装Zabbix及报错解决(php安装报错、yum源问题、zabbix-web-mysql安装报错等))