Centos

如何在 Centos 5 上修復 yum install not valid release 錯誤

  • December 18, 2014

當我嘗試 yum 安裝我得到的任何東西時:

-bash-3.2# yum install strace
Loading "fastestmirror" plugin
Determining fastest mirrors
* dag: apt.sw.be
* lxlabsupdate: download.lxlabs.com
* rpmforge: fr2.rpmfind.net
* lxlabslxupdate: download.lxlabs.com
YumRepo Warning: not using ftp, http[s], or file for repos, skipping - 5.2 is not a valid release or hasnt been released yet
removing mirrorlist with no valid mirrors: //var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

在 /etc/yum.repos.d 我有文件:

CentOS-Base.repo         CentOS-Media.repo  mirrors-rpmforge
CentOS-Base.repo.rpmnew  lxlabs.repo        rpmforge.repo

CentOS-Base.repo:

# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=5.2&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=5.2&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful

[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=5.2&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&rep$
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

[dag]
name=Dag RPM Repository for Centos
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag

[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=5.2&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
enabled=1

如何解決?

在您的 .repo 文件中更改?release=5.2為。?release=5

mirrorlist您的 CentOS-Base.repo 文件中的屬性中的 URL/etc/yum.repos.d/定義錯誤。它將發布版本號硬編碼為5.2而不是5。我建議不要硬編碼版本號,而是在 URL 中使用系統提供的變數,如您的 baseurl 條目中所示。

所以你想要這樣的東西而不是每個條目(保留現有repo=值):

mirrorlist= http://mirrorlist.centos.org/?release=5.2&arch= $basearch&repo=os

引用自:https://serverfault.com/questions/141066