首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误:无法为repo: base找到有效的基url

错误:无法为repo: base找到有效的基url
EN

Stack Overflow用户
提问于 2017-05-03 17:08:18
回答 2查看 36.9K关注 0票数 4

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

代码语言:javascript
复制
> 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

请帮我解决这个问题

更新CentOSBase.repo的内容

代码语言:javascript
复制
   [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*

提前谢谢你。

EN

回答 2

Stack Overflow用户

发布于 2017-09-18 20:01:49

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

来源:档案-1921年-文章

备份您的/etc/yum.pos.d/Centos-Base.repo

用以下内容替换将使您再次运行:

代码语言:javascript
复制
# CentOS-Base.repo
#
# 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-5.9 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=5.9&arch=$basearch&repo=os
baseurl=http://vault.centos.org/5.9/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

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

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

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

#contrib - packages by Centos Users
[contrib]
name=CentOS-5.9 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=5.9&arch=$basearch&repo=contrib
baseurl=http://vault.centos.org/5.9/os/$basearch/contrib/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
票数 12
EN

Stack Overflow用户

发布于 2017-05-04 06:26:23

这可能是由两种可能性造成的。

1.回购太旧,找不到

基于您的centos版本,我尝试通过链接找到操作系统。并从自述文件中获取这些信息。

这个目录(和版本的CentOS)是不推荐的。对于普通用户,您应该在路径中使用/5/而不是/5.9/。请参阅有关CentOS发行计划的常见问题: https://wiki.centos.org/FAQ/General 如果您知道自己在做什么,并且绝对希望保持在5.9级,那么可以转到http://vault.centos.org/获取包。请记住5.9不再有任何更新

在这个链接中,它建议您通过另一个链接查找旧版本。因此,您需要修改CentOS-Base.repo.

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

例如:

代码语言:javascript
复制
Original: baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
New:      baseurl=http://vault.centos.org/$releasever/os/$basearch/

2.网络发布

检查mirrorlist server是可访问的。

代码语言:javascript
复制
$ ping mirrorlist.centos.org

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

代码语言:javascript
复制
ping: unknown host mirrorlist.centos.org

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

代码语言:javascript
复制
$ echo nameserver 8.8.8.8 > /etc/resolv.conf
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43766169

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档