【问题标题】:yum error on Centos 6.6Centos 6.6 上的 yum 错误
【发布时间】:2015-03-14 21:24:28
【问题描述】:

“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?

【问题讨论】:

    标签: rpm centos6 yum


    【解决方案1】:
    【解决方案2】:

    对于 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 命令应该像魅力一样工作了:)

    【讨论】:

      猜你喜欢
      • 2017-02-05
      • 2016-10-11
      • 1970-01-01
      • 1970-01-01
      • 2018-09-16
      • 2023-03-13
      • 2016-11-10
      • 2013-10-06
      • 2015-12-02
      相关资源
      最近更新 更多