当前位置:网站首页 / Linux / 正文

CentOS 6的服务器后执行yum后发现出现Error: Cannot find a valid baseurl for repo: base解决办法

时间:2020年12月30日 | 作者 : liuhui | 分类 : Linux | 浏览: 3345次 | 评论 0

阿里云限量代金券 | 此广告位出租25元/月

原因是CentOS 6已经随着2020年11月的结束进入了EOL(Reaches End of Life),官方便在12月2日正式将CentOS 6相关的软件源移出了官方源,随之而来逐级镜像也会陆续将其删除。


不过有一些老设备依然需要维持在当前系统,CentOS官方也给这些还不想把CentOS 6扔进垃圾堆的用户保留了各个版本软件源的镜像,只是这个软件源不会再有更新了。

CentOS官方Vault源:http://vault.centos.org/


首先把fastestmirror关了,这个插件默认会寻找离你最近的镜像站去访问:

vi /etc/yum/pluginconf.d/fastestmirror.conf

修改这个参数enable=0

备份CentOS6系统源

mv /etc/yum.repos.d/CentOS-Base.repo  /etc/yum.repos.d/CentOS-Base.repo.backup

将下面的内容复制进去 vi /etc/yum.repos.d/CentOS-Base.repo

# 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-6.9 - Base - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.9/os/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-6.9 - Updates - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.9/updates/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6.9 - Extras - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.9/extras/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.9 - Plus - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.9/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.9 - Contrib - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.9/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

更换源后尝试yum update,能够正常获取软件列表即可。

推荐您阅读更多有关于“”的文章

猜你喜欢

网站分类
关注电脑博士
友情链接

分享:

支付宝

微信