Centos 6.6上的yum错误

时间:2015-01-16 09:47:47

标签: rpm centos6 yum

在失败的" yum更新"之后,yum不起作用。

如果我尝试启动" yum update"结果我得到了:

# yum update
Loaded plugins: dellsysid, fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile
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/x86_64/$releasever/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

我下载并尝试安装" centos-release"但有错误:

# rpm -Uvh centos-release-6-6.el6.centos.12.2.x86_64.rpm
error: centos-release-6-6.el6.centos.12.2.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: BAD
error: centos-release-6-6.el6.centos.12.2.x86_64.rpm cannot be installed

最奇怪的是:

# rpm -q rpm
package rpm is not installed

如何解决问题并成功运行yum?

2 个答案:

答案 0 :(得分:1)

对于6.6美分我也有同样的问题。因为yum变量$releasever未正确展开。发出以下命令:

$ python -c 'import yum, pprint; yb = yum.YumBase();pprint.pprint(yb.conf.yumvar, width=1)'

Loaded plugins: fastestmirror
{'arch': 'i686',
'basearch': 'i386',
'infra': 'stock',
'releasever': '$releasever',
'uuid': '19f9697d-6f4f-428a-848a-f317d7a880fb'}

在这种情况下,releaser的值应为6而不是$releasever。因此,只需将变量设置为正确的值,一切都会正常,使用以下命令:

echo 6 > /etc/yum/vars/releasever

现在您可以检查它是否有效:

$ python -c 'import yum, pprint; yb = yum.YumBase();pprint.pprint(yb.conf.yumvar, width=1)'

Loaded plugins: fastestmirror
{'arch': 'i686',
'basearch': 'i386',
'infra': 'stock',
'releasever': '6',
'uuid': '19f9697d-6f4f-428a-848a-f317d7a880fb'}

现在yum命令应该像魅力一样工作:)

答案 1 :(得分:0)