加载中…
正文 字体大小:

YumRepo Error: All mirror URLs are not using问题解决

(2013-01-24 02:55:57)
标签:

yumrepo

error

mirror

问题

解决

分类: 工作

今天帮同事搭建环境时碰到yum更新出问题了,报如下错误:

YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. $releasever is not a valid release or hasnt been released yet/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

从字面意思是看是不能正确连接到http或是ftp的真实地址上。

1.有可能是防火墙阻碍了出网http请求或是ftp请求,请检查网关防火墙。

2.有可能是dns不对,无法正常解析,换成8.8.4.4

3.系统取不到Release号

我这里碰到真正的原因是就是3,系统读取不到Release号。

正常一般可以看到版本号

 # lsb_release -a
LSB Version:    :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.2 (Final)
Release:        6.2
Codename:       Final

但是同事的环境上确是,原因就不说了,又想骂人了,哎。

 LSB Version:    :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: n/a
Description:   n/a
Release:        n/a
Codename:       n/a

而/etc/yum.repos.d下的*.repo源文件中都是baseurl都是带变量的

baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/

所以yum去尝试读取xml文件自然失败了。

 # wget http://mirrors.163.com/centos/%releasever/os/x86_64/repodata/repomd.xml
--2013-01-24 10:50:10--  http://mirrors.163.com/centos/%releasever/os/x86_64/repodata/repomd.xml
Resolving mirrors.163.com... 123.58.173.89, 123.58.173.106
Connecting to mirrors.163.com|123.58.173.89|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-01-24 10:50:11 ERROR 404: Not Found.

所以需要修改*.repo源文件中将$releasever变量全替换成6即可正常yum了。

  cat /etc/yum.repos.d/CentOS6-Base-163.repo
# CentOS-Base.repo
[base]
name=CentOS-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

看看这次更新缓存就成功了。

 # yum makecache
base                                   | 3.7 kB     00:00    
base/filelists_db                      | 5.9 MB     00:04    
base/primary_db                        | 4.5 MB     00:03    
base/other_db                          | 2.6 MB     00:01    
base/group_gz                          | 211 kB     00:00    
extras                                 | 3.5 kB     00:00    
extras/filelists_db                    13 kB     00:00    
extras/prestodelta                     | 1.3 kB     00:00    
extras/primary_db                      23 kB     00:00    
extras/other_db                        | 7.9 kB     00:00    
updates                                | 3.5 kB     00:00    
updates/filelists_db                   | 3.6 MB     00:02    
updates/prestodelta                    | 642 kB     00:00    
updates/primary_db                     | 4.6 MB     00:03    
updates/other_db                       | 473 kB     00:00

0

阅读 评论 收藏 转载 喜欢 打印举报
  • 评论加载中,请稍候...
发评论

    发评论

    以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

      

    新浪BLOG意见反馈留言板 电话:4006900000 提示音后按1键(按当地市话标准计费) 欢迎批评指正

    新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 会员注册 | 产品答疑

    新浪公司 版权所有