yum 安装报错:*epel: mirrors.aliyun.comError: xzcompressionnot available

环境背景:epel源下载地址:

http://mirrors.aliyun.com/Centos内核内核版本[root@nfs01 ~]# uname -r2.6.32-642.el6.x86_64==集群架构批量执行

yum install ipvsadm -y

报错:

*epel: mirrors.aliyun.comError: xzcompressionnot available

[root@web01 tmp]# cat /server/scripts/plzs.shyum install -y ipvsadm[root@m01 ~]# ansible oldboy -m shell -a "/bin/sh/server/scripts/plzs.sh"172.16.1.31 | FAILED | rc=1 >>Loaded plugins: fastestmirror, securitySetting up Install ProcessLoading mirror speeds from cached hostfile * epel: mirrors.aliyun.comError:xz compression not available…………此处略=

追寻错误根源:

 相同epel源下的其他机器执行

yum install ipvsadm -y正常 

猜想:本机epel执行过的yummakecache导致epel源改变2、更新本机所有软件版本:

[root@nfs01 ~]# yum updateLoaded plugins: fastestmirror, securitySetting up Update ProcessLoading mirror speeds from cached hostfile * epel: mirrors.aliyun.comepel

| 4.3 kB    00:00    Error: xz compression not available

结论:同样的问题,并且下载其他软件同样报错

通过错误基本判断出错方向

*epel: mirrors.aliyun.comError: xz compression not available

(epel源不符,xz压缩不可用)

猜想结论

 yum中“repomd.xml”作用,是提供了“更新.xml.gz”的下载信息和SHA校验值。若执行yum makecache将服务器上的软件包本地缓存,后将*.xml中的检验值更改,导致yum下载校验出错

验证结论:

方法:找出本地服务器中的所有repomd.xml尾的文件和正常环境中repomd.xml进行比对

[root@web01 ~]# find / -type f -name "*repomd.xml*"

/var/cache/yum/x86_64/6/epel/repomd.xml

/var/cache/yum/x86_64/6/base/repomd.xml

/var/cache/yum/x86_64/6/extras/repomd.xml

/var/cache/yum/x86_64/6/updates/repomd.xml

 验证结果:多处存在改动

diff repomd.xml /var/cache/yum/x86_64/6/epel/repomd.xml

3c3<  <revision>1489581919</revision>--->  <revision>1489581221</revision>8,11c8,11<    <checksumtype="sha256">086a4493b8fff841a620dc106fbc01ee1cd706fdee44c20a61f96ed18f0b521d</checksum><    <locationhref="repodata/086a4493b8fff841a620dc106fbc01ee1cd706fdee44c20a61f96ed18f0b521d-comps-el6.xml"/><    <timestamp>1489582011</timestamp><    <size>1319051</size>---略=============================================================================

执行解决方法:

1) 备份后将比对出入文件进行删除

m/var/cache/yum/x86_64/6/{base,extras,updates,epel}/repomd.xml -f

2) yum clean all清理下yum缓存

3) 更新yum updateyum

updateLoaded plugins: fastestmirror, securitySetting up Update ProcessLoading mirror speeds from cached hostfile *base: mirrors.aliyun.com *epel: mirrors.aliyun.com *extras: mirrors.aliyun.com *updates: mirrors.aliyun.com···························略

4) 重新执行

yum install ipvsadm -y

Loaded plugins: fastestmirror, securitySetting up Install ProcessLoading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.aliyun.com·······················略                                                           

Complete!原命令执行成功yum问题解决!

结论:

  yum中“repomd.xml”作用,是提供了“更新.xml.gz”的下载信息和SHA校验值。若执行yum makecache将服务器上的软件包本地缓存,后将*.xml中的检验值更改,导致yum下载校验出错,用的时候慎重(yum makecache问题目前解释短浅,会继续跟踪,排错仅供临时解决问题)

原文地址:https://www.cnblogs.com/wang-xd/p/6596435.html