全部博文(317)
分类: LINUX
2014-10-22 08:50:43
今天帮同事搭建环境时碰到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=
所以yum去尝试读取xml文件自然失败了。
# wget --2013-01-24 10:50:10-- 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
#released updates
#additional packages that may be useful
#additional packages that extend functionality of existing
packages
#contrib - packages by Centos Users |
看看这次更新缓存就成功了。
# 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 |