centos 6.5 YUM安装软件 错误提示 No more mirrors to try. 如何解决


在Centos6.5中,使用yum安装openstack时候报错:[Errno 256] No more mirrors to try.,本文我们来分析这个错误,及提供解决方案。


安装openstack最后到dashboard的时候报错:[Errno 256] No more mirrors to try.


很简单:


1.yum clean metadata


2.yum clean all


搞定!


至此,openstack也差不多一个个组件都正常了。接下来准备跑个vyos(电脑是真的有点hold不住)。


后面写个质量高一点的文章“How vRouter live in a cloud?”




YUM安装遭遇: [Errno 256] No more mirrors to try


把YUM配置好后,使用yum命令进行安装时,出现了如下错误:


Downloading Packages:

ftp://192.168.220.46/RHEL6.2/x64/Server/libaio-devel-0.3.107-10.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 19 - "Given file does not exist"

Trying other mirror.



Error Downloading Packages:

  libaio-devel-0.3.107-10.el6.x86_64: failure: libaio-devel-0.3.107-10.el6.x86_64.rpm from RHEL6.2-Server-X64: [Errno 256] No more mirrors to try.


最开始以为是客户端的yum源配置缓存的问题,使用yum clean all命令清除后还是出现同样的错误。


最后竟然发现我的RHEL6.2操作系统原理没有默认安装ftp工具,坑爹啊!没办法只能从光盘再安装一下ftp工具:


[root@instsvr1 Packages]# rpm -ivh ftp-0.17-51.1.el6.x86_64.rpm

warning: ftp-0.17-51.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing...                ########################################### [100%]

   1:ftp                    ########################################### [100%]



顺便把telnet工具和服务也给装上了:


[root@instsvr1 Packages]# rpm -ivh telnet-*

warning: telnet-0.17-47.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing...                ########################################### [100%]

   1:telnet-server          ########################################### [ 50%]

   2:telnet                 ########################################### [100%]


安装了工具后结果还是报错,整了半天,才发现原来"Given file does not exist"信息是正确的,目录RHEL6.2/x64/Server下的确是没有libaio-devel-0.3.107-10.el6.x86_64.rpm这个文件,原来 在创建repodata时指定的是RPM包目录是RHEL6.2/x64/Packages,而yum工具会直接从RHEL6.2/x64/Server/目录下去寻找安装包,所以在RHEL6.2/x64/Server/目录下把Packages包下相应的文件link过来就可以了。


太粗心了!!!!!!!!





配置RHEL6.2的YUM源


服务器端:

1、    由于yum安装支持三种协议:file://、ftp://和http://,因此如果是使用本地文件作为源,则可直接使用file:\\协议,否则需要先准备好ftp或者http服务。这次测试的是ftp源,因此需要配置好ftp服务,并且要把ftp服务配置为可匿名登录,并且要把rpm包都放在ftp匿名登录的root目录下面。Vsftp匿名登录的配置为:

anonymous_enable=YES

anon_root=/share(这个为vsftp匿名登录的root目录,并且其属性不能为/etc/vsftp/ftpusers,/etc/vsftp/user_list文件中所配置的用户,否则不能匿名登录)

如果不配置匿名登录或者匿名登录root目录设置不对会出现如下错误:

[root@srcbdc yum.repos.d]# yum list

Loaded plugins: aliases, rhnplugin, security

This system is not registered with RHN.

RHN support will be disabled.

ftp://yumserver/RHEL/Server/repodata/repomd.xml: [Errno 4] IOError: [Errno ftp error] 550 Failed to change directory.

Trying other mirror.

Error: Cannot retrieve repository metadata (repomd.xml) for repository: RHEL-Server. Please verify its path and try again

2、    先检查yum是否已安装,如果没有安装可以从光盘里面安装

[root@srcbdc ~]# rpm -qa|grep yum

yum-security-1.1.16-13.el5

yum-rhn-plugin-0.5.4-13.el5

yum-metadata-parser-1.1.2-3.el5

yum-updatesd-0.9-2.el5

yum-aliases-1.1.16-13.el5

yum-3.2.22-20.el5

3、    安装另一个用于yum的包createrepo

[root@srcbdc Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm

warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...                ########################################### [100%]

   1:createrepo             ########################################### [100%]

这个工具主要是用来生产yum所需要用到的安装包关系的数据库。

4、    把系统盘中的Server目录和VT目录拷贝到新的目录里面,我的是从ISO文件里面复制出来的

先挂载ISO文件

[root@srcbdc ~]# mount -o loop /instsvr/ISO/rhel-server-6.2-x86_64-dvd.iso /mnt

Copy文件

[root@srcbdc ~]# mkdir -p /instsvr/RHEL6.2/x64

[root@srcbdc ~]# cp -r /mnt/ /instsvr/RHEL6.2/x64

5、    创建rpm关系数据库

[root@srcbdc ~]# createrepo -g /instsvr/RHEL6.2/x64/Server/repodata/*comps-rhel6-Server.xml -o /instsvr/RHEL6.2/x64/Server -i /instsvr/RHEL6.2/x64/Server/listing /instsvr/RHEL6.2/x64/Packages/

[root@srcbdc ~]# createrepo -g /instsvr/RHEL6.2/x64/HighAvailability/repodata/*comps-rhel6-HighAvailability.xml -o /instsvr/RHEL6.2/x64/HighAvailability -i /instsvr/RHEL6.2/x64/HighAvailability/listing /instsvr/RHEL6.2/x64/Packages/

[root@srcbdc ~]# createrepo -g /instsvr/RHEL6.2/x64/LoadBalancer/repodata/*comps-rhel6-LoadBalancer.xml -o /instsvr/RHEL6.2/x64/LoadBalancer -i /instsvr/RHEL6.2/x64/LoadBalancer/listing /instsvr/RHEL6.2/x64/Packages/

[root@srcbdc ~]# createrepo -g /instsvr/RHEL6.2/x64/ResilientStorage/repodata/*comps-rhel6-ResilientStorage.xml -o /instsvr/RHEL6.2/x64/ResilientStorage -i /instsvr/RHEL6.2/x64/ResilientStorage/listing /instsvr/RHEL6.2/x64/Packages/

[root@srcbdc ~]# createrepo -g /instsvr/RHEL6.2/x64/ScalableFileSystem/repodata/*comps-rhel6-ScalableFileSystem.xml -o /instsvr/RHEL6.2/x64/ScalableFileSystem -i /instsvr/RHEL6.2/x64/ScalableFileSystem/listing /instsvr/RHEL6.2/x64/Packages/


创建rpm包的link文件:


[root@srcbdc ~]# cd /instsvr/RHEL6.2/x64/Server

[root@srcbdc ScalableFileSystem]# for i in `cat listing`; do ln -s ../Packages/$i $i; done

[root@srcbdc ~]# cd /instsvr/RHEL6.2/x64/HighAvailability

[root@srcbdc ScalableFileSystem]# for i in `cat listing`; do ln -s ../Packages/$i $i; done

[root@srcbdc ~]# cd /instsvr/RHEL6.2/x64/LoadBalancer

[root@srcbdc ScalableFileSystem]# for i in `cat listing`; do ln -s ../Packages/$i $i; done

[root@srcbdc ~]# cd /instsvr/RHEL6.2/x64/ResilientStorage

[root@srcbdc ScalableFileSystem]# for i in `cat listing`; do ln -s ../Packages/$i $i; done

[root@srcbdc ~]# cd /instsvr/RHEL6.2/x64/ScalableFileSystem

[root@srcbdc ScalableFileSystem]# for i in `cat listing`; do ln -s ../Packages/$i $i; done



6、    清除yum缓存信息

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

Loaded plugins: aliases, rhnplugin, security

Cleaning up Everything

7、    再使用yum list名称查看rpm包,正常的话会列出所有的rpm包


客户端:


客户端就比较好配置了,只需要在/etc/yum.d.repo/目录小添加本地yum源配置文件即可


[root@instsvr1 yum.repos.d]# cat rhel6.2-x64.repo

[RHEL6.2-Server-X64]

name=Red Hat Enterprise Linux Install Server

baseurl=ftp://192.168.220.46/RHEL6.2/x64/Server

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RedHat-release

[RHEL6.2-HighAvailability-X64]

name=Red Hat Enterprise Linux Install Server

baseurl=ftp://192.168.220.46/RHEL6.2/x64/HighAvailability/

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[RHEL6.2-LoadBalancer-X64]

name=Red Hat Enterprise Linux Install Server

baseurl=ftp://192.168.220.46/RHEL6.2/x64/LoadBalancer/

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[RHEL6.2-ResilientStorage-X64]

name=Red Hat Enterprise Linux Install Server

baseurl=ftp://192.168.220.46/RHEL6.2/x64/ResilientStorage/

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[RHEL6.2-ScalableFileSystem-X64]

name=Red Hat Enterprise Linux Install Server

baseurl=ftp://192.168.220.46/RHEL6.2/x64/ScalableFileSystem/

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[RHEL-RPMS]

name=Red Hat Enterprise Linux Install Server

baseurl=ftp://192.168.220.46/rpms

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release