最近在使用yum安装包的时候,一直报错,错误如下:
One of the configured repositories failed (CentOS-7 - Ceph Hammer),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=centos-ceph-hammer ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable centos-ceph-hammer
or
subscription-manager repos --disable=centos-ceph-hammer
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
然后折腾了好久之后,觉得应该是yum配置的源出了问题,但是我没能解决。于是决定将将yum卸载重新安装。卸载重新安装的方法可见此篇博客:yum卸载重装 。接下来我讲一下这里遇到的问题,在下载包之后,执行rpm -ivh yum-*时,会报错 rpm >= 0:4.11.3-22 被 yum-3.4.3-154.el7.centos.noarch 需要,而查此问题给出的答案均是下载rpm-4.11.3-22.el7.x86_64.rpm,问题来了,这个包在网易、阿里、centos等源中均无法找到(貌似只能找到最新版本的源),下载其他版本的源由无法避免这种错误。
然后网上查到可以用yumdownloader下载rpm包,我试了一下这样下载过来的rpm包可以满足要求,具体如下
1.执行yumdownloader rpm
可通过ls命令查看是否下载了rpm包,我这里下载成功的是rpm-4.11.3-43.el7.x86_64.rpm
2.执行rpm -Uvh rpm-4.11.3-43.el7.x86_64.rpm --nodeps
3.接下来就是按照上面重新安全安装yum的步骤了