笔者的方法可能不是最好的,但可以解决问题,如果有更好的解决方法欢迎留言、私信或加V
为了节省读者的时间,笔者推荐 只阅读 一. yum报错:failure: repodata/repomd.xml from xxxxxx: [Errno 256] No more mirrors to try.解决办法
,当然只是推荐而已,至于怎样阅读就是读者自己的事了
rm -rf /etc/yum.repos.d/*
先查询已安装版本
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
下载地址:http://mirrors.163.com/centos/7/os/x86_64/Packages/
下载这三个:
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
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.rpm
和yum-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的.这基本上就是个鸡生蛋,蛋生鸡的问题了.无解!
rpm -qa yum
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
如果提示网络连接失败,可自行下载,然后从路径导入
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
等待命令完成,在重写安装即可
[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去试试了
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps
whereis python| xargs rm -frv
rpm -qa| grep yum| xarg
whereis yum| xargs rm -frv
cat /etc/centos-release
。注:原清华镜像源下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
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机子上,安装报错的依赖包。
输入命令yum
和python -V
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签名
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签名
此时,只需要修改/etc/yum.repos.d/kubernetes.repo
的gpgcheck
和repo_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.
[root@NISEC-6601 yum]# yum clean all
bash: 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
rpm -qa|grep yum|xargs rpm -e --nodeps
rpm -qa|grep python-urlgrabber|xargs rpm -e --nodeps
# https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
# http://mirrors.163.com/centos/7/os/x86_64/Packages/
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-fastestmirror
和yum
两个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
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 -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
[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 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配置