CentOS7使用yum时遇见failure: repodata/repomd.xml from base: [Errno 256]错误

我yum安装东西的时候遇见这个问题:
failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
ftp://mirrors.163.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno -36] Error importing repomd.xml for base: /etc/…(反正就是一个路径,我忘了啥了)
看了很多的博客总而言之就是yum源的问题了
解决方法:
1、查看yum的依赖包

# rpm -qa|grep yum

yum-plugin-fastestmirror-1.1.31-34.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-132.el7.centos.0.1.noarch
2、删除依赖包

# rpm -e yum-plugin-fastestmirror-1.1.31-34.el7.noarch --nodeps yum-metadata-parser-1.1.4-10.el7.x86_64 yum-3.4.3-132.el7.centos.0.1.noarch

3、将系统默认的yum功能删除

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

4、查看本版和系统的位数
# cat /etc/redhat-release
CentOS Linux release 7.2.1511

# file /bin/ls

/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=aa7ff68f13de25936a098016243ce57c3c982e06, stripped
5、下载yum包

# wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
# wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
# wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm

注意:要注意版本
在http://mirrors.kernel.org/centos/ 或者 http://mirrors.163.com/centos/里下载
6、下载完成执行以下命令

# rpm -ivh  --nodeps yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm 
# rpm -ivh  --nodeps yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 
# rpm -ivh  --nodeps yum-3.4.3-158.el7.centos.noarch.rpm 

7、进入 /etc/yum.repos.d/目录中,在http://mirrors.163.com/.help/centos.html,在里面下载对应版本的repo文件,我下载了CentOS-Base.repo
对此文件进行备份,以防修改错误还有的用
修改$releasever为自己的版本号(我的为7)
保存退出

yum clean all一下就可以使用了

你可能感兴趣的:(linux)