您的位置:首页 > 其它

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

2015-11-25 00:21 609 查看

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] orfile.

Eg. $releasever is not a valid release or hasntbeen released yet/

removing mirrorlist with no valid mirrors:/var/cache/yum/base/mirrorlist.txt

Error: Cannot retrieve repository metadata (repomd.xml) forrepository: 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
但是同事的环境上确是,原因就不说了,又想骂人了,哎。

LSBVersion: :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 existingpackages

[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.7kB 00:00

base/filelists_db | 5.9MB 00:04

base/primary_db | 4.5MB 00:03

base/other_db | 2.6MB 00:01

base/group_gz | 211kB 00:00

extras | 3.5kB 00:00

extras/filelists_db | 13kB 00:00

extras/prestodelta | 1.3kB 00:00

extras/primary_db | 23kB 00:00

extras/other_db | 7.9kB 00:00

updates | 3.5kB 00:00

updates/filelists_db | 3.6MB 00:02

updates/prestodelta | 642kB 00:00

updates/primary_db | 4.6MB 00:03

updates/other_db | 473kB 00:00
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: