首页 > Web开发 > 详细

CentOS6报cannot found a valid baseurl for repo:base

时间:2021-06-23 09:30:23      阅读:13      评论:0      收藏:0      [点我收藏+]

最近需要用一下centos6版本,发现使用yum时报cannot found a valid baseurl for repo:base

先说原因:

2020年12月2日官方结束了对CentOS 6.x的支持,导致使用yum安装或更新程序的时候出现错误

解决方案:

  1. 清空原有CentOS-Base.repo文件
echo > /etc/yum.repos.d/CentOS-Base.repo
  1. 编辑CentOS-Base.repo文件, 输入以下内容:
vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://#mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

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

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

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

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://#mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=https://vault.centos.org/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  1. 删除/etc/yum.repos.d/目录下其他repo文件,[保留CentOS-Base.repo]
cd /etc/yum.repos.d/
ls | grep -v ‘CentOS-Base.repo‘ | xargs rm
  1. 重建yum缓存, 更新并启用新yum源
yum clean all && yum makecache

End

CentOS6报cannot found a valid baseurl for repo:base

原文:https://www.cnblogs.com/liu-ke/p/14920997.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!