错误:找不到repo:base的有效baseurl

时间:2017-05-03 17:08:18

标签: linux server centos5

我需要一些帮助,我正在尝试在CentOS 5.9中安装yum update但我收到错误

> Loaded plugins: fastestmirror, kmod Loading mirror speeds from cached
> hostfile YumRepo Error: All mirror URLs are not using ftp, http[s] or
> file.  Eg. Invalid release/ removing mirrorlist with no valid mirrors:
> /var/cache/yum/base/mirrorlist.txt Error: Cannot find a valid baseurl
> for repo: base

请帮我解决这个问题

更新CentOS-Base.repo的内容

   [base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos php53*

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos php53*

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos php53*

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos php53*

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=5$releasever&arch=$basearch&repo=contrib
baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos php53*

提前谢谢。

2 个答案:

答案 0 :(得分:7)

这是因为Centos 5已被弃用,需要手动更新Base repo文件以将所有内容指向Centos保险库。

来源:http://realtechtalk.com/Centos_59_Working_Vault_Repo_file-1921-articles

备份你的/etc/yum.repos.d/Centos-Base.repo

替换为以下内容将让您重新开始:

$file = Get-Content .\router.txt | Out-String
$ints = $file | Select-String -Pattern "(?s)\ninterface [etfg][^!]+!" -AllMatches | foreach {$_.Matches.Value}
foreach ($line in $ints.split("!")) { 
    if ($line -match 'maximum\s*([0-9]+)') {
        $allowedMacs = $matches[1]
        if ($allowedMacs -gt ($line | Select-String "sticky [\d\w]" -AllMatches).Matches.Count) {
            write-host "Violation!"
        } else {
            write-host "No Violation!"
        }
    }
}

答案 1 :(得分:0)

这可能是由两种可能性引起的。

<强> 1。 Repo太老了,无法找到

根据您的centos版本,我试图通过link找到操作系统。从自述文件中获取此信息。

  

不推荐使用此目录(及CentOS版本)。对于普通用户,       你应该在路径中使用/ 5 /而不是/5.9/。请参阅此FAQ       关于CentOS发布计划:

     

https://wiki.centos.org/FAQ/General

     

如果你知道自己在做什么,并且绝对想留在5.9       级别,转到http://vault.centos.org/获取包裹。请记住,5.9不再获得任何更新

在此链接中,建议您通过其他link查找旧版本。因此,您需要修改 CentOS-Base.repo

将所有http://mirror.centos.org/centos/***替换为http://vault.centos.org/***

例如:

Original: baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
New:      baseurl=http://vault.centos.org/$releasever/os/$basearch/

<强> 2。网络问题

可以访问mirrorlist server

$ ping mirrorlist.centos.org

如果您可能遇到以下错误消息。

ping: unknown host mirrorlist.centos.org

要解决此问题,请在resolv.conf中添加有效的名称服务器(如果您不是root用户,请使用sudo)

$ echo nameserver 8.8.8.8 > /etc/resolv.conf