yum报错:failure: repodata/repomd.xml from xxxxxx: [Errno 256] No more mirrors to try.解决办法以及关于yum安装问题

yum报错:failure: repodata/repomd.xml from xxxxxx: [Errno 256] No more mirrors to try.解决办法以及关于Centos7.5 1804重新安装yum和python问题

  • 零. 前言
  • 一. yum报错:failure: repodata/repomd.xml from xxxxxx: [Errno 256] No more mirrors to try.解决办法
      • 问题截图:![在这里插入图片描述](https://img-blog.csdnimg.cn/8131a4764a43413a818e6f12ca481c41.png#pic_center)
      • 解决步骤:
        • 1.删除老仓库
        • 2.卸载yum包
        • 卸载
        • 卸载组件
        • 在查询没有了
      • 3.下载最新的rpm包
      • 4.重新安装yum(安装yum这有一个坑)
        • 首先安装 `yum-metadata-parser-1.1.4-10.el7.x86_64.rpm`
        • 其次安装`yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm`和`yum-3.4.3-168.el7.centos.noarch.rpm`
        • 查询yum是否正确安装
      • 5.导入证书
      • 6.设置阿里源
      • 7.清除缓存,生成新的缓存
  • 二. 关于Centos7.5 1804重新安装yum和python问题
      • 20201118新更:
        • 1. 发下一个安装yum巨坑的问题在安装yum时,
        • 2. 卸载python、yum
          • 1.卸载现有的Python,强制删除已安装程序及其关联:
          • 2.强制删除Python所有残余文件:
          • 3.卸载现有的yum:
          • 4.强制删除所有残余文件:
          • 5. 检查CentOS 7内核版本:`cat /etc/centos-release`。
          • 6.寻找对应的文件下载,在[http://vault.centos.org](http://vault.centos.org)找到对应的依赖下载。
          • 7.批量安装方式:
          • 8.完成测试
  • 三. 解决failure: repodata/repomd.xml from kubernetes: [Errno 256] No more mirrors to try
    • 问题:
    • 一 进行kubelet安装时,运行命令:
      • 出现下面提示及错误:
      • 翻译:
    • 二 解决方法:出现这个问题的主要原因是阿里的国内yum源出现问题了,应该是文件换路径或升级了,或者原来的文件不存在了;提示提供1-5种解决方案,
  • 四. Linux中yum源不能使用故障解决---网络yum配置
    • 问题:
      • 报错问题展示:
      • 无法使用YUM源的问题如下:
    • 解决方法:
      • 1.# 清除原有RHEL的YUM及相关软件包
      • 2.# 软件包下载地址
      • 下载centos7的相关软件包
      • 安装软件包
    • 安装过程所遇到的问题
      • 问题1
        • 错误:依赖检测失败:
        • 解决:,升级rpm,上一步已经下载了,直接升级
      • 问题解决了,继续安装
        • 下载配置文件并编辑
        • 查看命令:
        • 删除/var/cache/yum/下的x86_64目录
        • 清理yum缓存: `yum clean all`
        • 将服务器软件包信息缓存至本地,提高搜索安装效率:`yum makecache`
        • 测试:







零. 前言

笔者的方法可能不是最好的,但可以解决问题,如果有更好的解决方法欢迎留言、私信或加V

为了节省读者的时间,笔者推荐 只阅读 一. yum报错:failure: repodata/repomd.xml from xxxxxx: [Errno 256] No more mirrors to try.解决办法,当然只是推荐而已,至于怎样阅读就是读者自己的事了

一. yum报错:failure: repodata/repomd.xml from xxxxxx: [Errno 256] No more mirrors to try.解决办法

问题截图:yum报错:failure: repodata/repomd.xml from xxxxxx: [Errno 256] No more mirrors to try.解决办法以及关于yum安装问题_第1张图片

解决步骤:

1.删除老仓库
rm  -rf  /etc/yum.repos.d/*
2.卸载yum包

先查询已安装版本

rpm -qa yum
卸载
rpm -qa yum yum-3.4.3-150.el7.centos.noarch
卸载组件
rpm -qa | grep yum | xargs rpm -e --nodeps
在查询没有了
rpm -qa yum

3.下载最新的rpm包

下载地址:http://mirrors.163.com/centos/7/os/x86_64/Packages/
下载这三个:

yum报错:failure: repodata/repomd.xml from xxxxxx: [Errno 256] No more mirrors to try.解决办法以及关于yum安装问题_第2张图片

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm

4.重新安装yum(安装yum这有一个坑)

首先安装 yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@localhost bak]# rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm     Preparing...                          ################################# [100%]
Updating / installing...
   1:yum-metadata-parser-1.1.4-10.el7 ################################# [100%]

其次安装yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpmyum-3.4.3-168.el7.centos.noarch.rpm
[root@localhost bak]# rpm -ivh yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm yum-3.4.3-168.el7.centos.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:yum-3.4.3-168.el7.centos         ################################# [ 50%]
   2:yum-plugin-fastestmirror-1.1.31-5################################# [100%]

如果不同时安装会出现

[root@localhost bak]# rpm -ivh yum-3.4.3-168.el7.centos.noarch.rpm
error: Failed dependencies:
        yum-plugin-fastestmirror is needed by yum-3.4.3-168.el7.centos.noarch

那就先安装yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm ,然后你会发现

[root@bigdata111 yum]# rpm -ivh yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm 
error: Failed dependencies:
    yum >= 3.0 is needed by yum-plugin-fastestmirror-1.1.31-45.el7.noarch

这条的意思是安装yum3.4这个rpm需要yum-plugin-fastestmirror的.这基本上就是个鸡生蛋,蛋生鸡的问题了.无解!

查询yum是否正确安装
rpm -qa yum

5.导入证书

rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

如果提示网络连接失败,可自行下载,然后从路径导入

6.设置阿里源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

7.清除缓存,生成新的缓存

yum clean all
yum makecache

yum报错:failure: repodata/repomd.xml from xxxxxx: [Errno 256] No more mirrors to try.解决办法以及关于yum安装问题_第3张图片

等待命令完成,在重写安装即可

二. 关于Centos7.5 1804重新安装yum和python问题

20201118新更:

1. 发下一个安装yum巨坑的问题在安装yum时,
[root@bigdata111 yum]# rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm 
error: Failed dependencies:
    rpm-python is needed by yum-3.4.3-158.el7.centos.noarch
    yum-plugin-fastestmirror is needed by yum-3.4.3-158.el7.centos.noarch

这里的意思是,如果安装yum 3.3.4 是需要安装 rpm-python 和 yum-plugin-fastestmirror 这两个依赖的.

[注] : 在选择两个版本时,我用的都是相关的低版本.我的Centos7.5 1804

如下这个是可以[单独]安装的

[root@bigdata111 yum]# rpm -ivh rpm-python-4.11.3-32.el7.x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:rpm-python-4.11.3-32.el7         ################################# [100%]
[root@bigdata111 yum]# rpm -ivh yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm 
error: Failed dependencies:
    yum >= 3.0 is needed by yum-plugin-fastestmirror-1.1.31-45.el7.noarch

这条的意思就是安装 yum-plugin 是需要 yum >= 3.0 yum3.0以上的版本的安装

[root@bigdata111 yum]# rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm 
error: Failed dependencies:
    yum-plugin-fastestmirror is needed by yum-3.4.3-158.el7.centos.noarch

这条的意思是安装yum3.4这个rpm需要yum-plugin-fastestmirror的.这基本上就是个鸡生蛋,蛋生鸡的问题了.无解!

后来我发现需要两个一起安装才可以!!!

[root@bigdata111 yum]# rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:yum-plugin-fastestmirror-1.1.31-4################################# [ 50%]
   2:yum-3.4.3-158.el7.centos         ################################# [100%]

这就可以了! 单个装不行,一起装才可以…巨坑,好了.我再去重装python2.7去试试了

2. 卸载python、yum
1.卸载现有的Python,强制删除已安装程序及其关联:
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps
2.强制删除Python所有残余文件:
whereis python| xargs rm -frv
3.卸载现有的yum:
rpm -qa| grep yum| xarg
4.强制删除所有残余文件:
whereis yum| xargs rm -frv
5. 检查CentOS 7内核版本:cat /etc/centos-release
6.寻找对应的文件下载,在http://vault.centos.org找到对应的依赖下载。

注:原清华镜像源下https://mirrors.tuna.tsinghua.edu.cn/centos/7.5.1804/ 这个地址换啦,只有一个readme文件了,所以更改路径为下列地址:

我的CentOS7版本完整路径:https://vault.centos.org/7.5.1804/os/x86_64/Packages/

在Centos命令行中直接执行以下命令

wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-2.7.5-68.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-backports-1.0-8.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-chardet-2.2.1-1.el7_1.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-devel-2.7.5-68.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-ipaddress-1.0.16-2.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-libs-2.7.5-68.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/python-virtualenv-15.1.0-2.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-build-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-build-libs-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-libs-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-python-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-sign-4.11.3-32.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-aliases-1.1.31-45.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-protectbase-1.1.31-45.el7.noarch.rpm
wget https://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm
7.批量安装方式:
rpm -Uvh --replacepkgs python*.rpm

rpm -Uvh --replacepkgs rpm-python*.rpm yum*.rpm rpm-*.rpm

下载完成后安装这些包,有些依赖你可能要自己解决:

rpm -Uvh --replacepkgs *.rpm

注意,无论是单个安装还是批量安装,若是出现安装依赖的问题,针对报错的依赖复制下来,在http://vault.centos.org/7.7.11988/os/x86_64/Packages/(结合自己实际的CentOS7版本地址)上进行搜索依赖包,下载到CentOS 7机子上,安装报错的依赖包。

8.完成测试

输入命令yumpython -V

三. 解决failure: repodata/repomd.xml from kubernetes: [Errno 256] No more mirrors to try

问题:

failure: repodata/repomd.xml from kubernetes: [Errno 256] No more mirrors to try.
https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno -1] repomd.xml signature could not be verified for kubernetes

翻译:

失败:repodata/repomd。来自kubernetes的xml:[Errno 256]没有更多镜像可供尝试。
https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml:[Errno-1]报告。无法验证kubernetes的xml签名

一 进行kubelet安装时,运行命令:

yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes

出现下面提示及错误:

One of the configured repositories failed (Kubernetes),
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:

Contact the upstream for the repository and get them to fix the problem.

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).

Run the command with the repository temporarily disabled
yum --disablerepo=kubernetes …

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 kubernetes
or
subscription-manager repos --disable=kubernetes

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
compromise:

yum-config-manager --save --setopt=kubernetes.skip_if_unavailable=true
failure: repodata/repomd.xml from kubernetes: [Errno 256] No more mirrors to try.
https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno -1] repomd.xml signature could not be verified for kubernetes

翻译:

其中一个配置的存储库失败(Kubernetes),
而且yum没有足够的缓存数据来继续。此时,唯一
百胜可以做的安全事情是失败。有几种方法可以解决这个问题:

1.联系上游的存储库,让他们解决问题。
2.重新配置baseurl/等。对于存储库,指向一个工作
上游如果您使用的是更新的
存储库支持的分发版本(以及
上一发行版的软件包仍然有效)。
3.在暂时禁用存储库的情况下运行命令
yum–disablerepo=kubernetes。。
4.永久禁用存储库,因此默认情况下yum不会使用它。百胜
然后将忽略存储库,直到您永久启用它
再次使用或使用–enablerepo临时使用:
yum-config-manager --disable kubernetes
or
subscription-manager repos --disable=kubernetes

5.如果失败的存储库不可用,请将其配置为跳过。
请注意,yum将尝试联系回购。当它运行大多数命令时,
所以每次都必须尝试失败(因此.yum将非常成功
较慢)。如果这是一个非常暂时的问题,这通常是一个很好的
妥协:
yum-config-manager --save --setopt=kubernetes.skip_if_unavailable=true

失败:repodata/repomd。来自kubernetes的xml:[Errno 256]没有更多镜像可供尝试。
https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml:[Errno-1]报告。无法验证kubernetes的xml签名

二 解决方法:出现这个问题的主要原因是阿里的国内yum源出现问题了,应该是文件换路径或升级了,或者原来的文件不存在了;提示提供1-5种解决方案,

此时,只需要修改/etc/yum.repos.d/kubernetes.repogpgcheckrepo_gpgcheck参数,要求变为0,见下:

cat < /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
EOF

这样,再次运行yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
,即可安装kubelet.

四. Linux中yum源不能使用故障解决—网络yum配置

问题:

报错问题展示:

[root@NISEC-6601 yum]# yum clean all

bash: yum: 未找到命令...

或者

无法使用YUM源的问题如下:

[root@localhost ~]# yum repolist

已加载插件:product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

repolist: 0

[root@localhost ~]#

[root@localhost ~]#

[root@localhost ~]# yum install ntp

已加载插件:product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

There are no enabled repos.

 Run "yum repolist all" to see the repos you have.

 To enable Red Hat Subscription Management repositories:

     subscription-manager repos --enable 

 To enable custom repositories:

     yum-config-manager --enable 

解决方法:

1.# 清除原有RHEL的YUM及相关软件包

rpm -qa|grep yum|xargs rpm -e --nodeps

rpm -qa|grep python-urlgrabber|xargs rpm -e --nodeps

2.# 软件包下载地址

# https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/

# http://mirrors.163.com/centos/7/os/x86_64/Packages/

下载centos7的相关软件包

http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-45.el7.x86_64.rpm

http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm

http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm

http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm

http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm

上传软件包到rhel7.3系统里

安装软件包

注:yum-plugin-fastestmirroryum两个rpm要一起安装,不能拆开。

rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm

rpm -ivh python-urlgrabber-3.10-10.el7.noarch.rpm

rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

rpm -ivh yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm yum-3.4.3-168.el7.centos.noarch.rpm 

安装过程所遇到的问题

问题1

错误:依赖检测失败:
rpm >= 0:4.11.3-22 被 yum-3.4.3-158.el7.centos.noarch 需要

yum >= 3.0 被 yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch 需要 
解决:,升级rpm,上一步已经下载了,直接升级
rpm -Uvh rpm-4.11.3-45.el7.x86_64.rpm --nodeps

问题解决了,继续安装

下载配置文件并编辑
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

vi CentOS-Base.repo //编辑文件

把文件中所有$releasever改为7,$basearch保持不变

然后将此配置文件上传并复制到/etc/yum.repos.d/路径下,删除redhat.repo文件

[root@localhost etc]# cd yum.repos.d

[root@localhost yum.repos.d]# ls

CentOS-Base.repo redhat.repo

[root@localhost yum.repos.d]# rm redhat.repo

rm:是否删除普通文件 "redhat.repo"?y

[root@localhost yum.repos.d]# ls

CentOS-Base.repo

[root@localhost yum.repos.d]# vi CentOS-Base.repo

[root@localhost yum.repos.d]# yum clean all

名词解释:

1、$releasever

$releasever的值,当前系统的发行版本。是指大版本7

2、$basearch

$basearch的值,系统硬件架构(CPU指令集)

查看命令:

arch,结果是x86_64

删除/var/cache/yum/下的x86_64目录
[root@localhost yum.repos.d]# cd /var/cache/yum/

[root@localhost yum]# ls

x86_64

[root@localhost yum]# rm -rf x86_64

[root@localhost yum]# ls
清理yum缓存: yum clean all
将服务器软件包信息缓存至本地,提高搜索安装效率:yum makecache
测试:

能搜索到软件包信息,说明配置完成:

yum search vim

执行yum repolist查看,如果显示出repo仓库列表,并显示软件包数量则OK。(或者使用yum makecache):

yum repolist

使用yum安装软件包测试:

yum -y install vim







el

yum报错:failure: repodata/repomd.xml from xxxxxx: [Errno 256] No more mirrors to try.解决办法

发光棒

yum报错:failure: repodata/repomd.xml from xxxxxx: [Errno 256] No more mirrors to try.解决办法

卡其色的夏日

关于Centos7.5 1804重新安装yum和python问题

神州永泰

解决failure: repodata/repomd.xml from kubernetes: [Errno 256] No more mirrors to try

奥特曼的一号蛋

Linux中yum源不能使用故障解决—网络yum配置

你可能感兴趣的:(运维,xml)