CentOS6报cannot found a valid baseurl for repo:base

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS6报cannot found a valid baseurl for repo:base相关的知识,希望对你有一定的参考价值。

最近需要用一下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的主要内容,如果未能解决你的问题,请参考以下文章

用Struts2框架报错:The Struts dispatcher cannot be found

webpack编译报错:Module not found: Error: Cannot resolve 'file' or 'directory' ./../../no

CentOS6.6-MySQL报Curses library not found

安装centos6.10时,安装完成重启报错error 15,file not found

centos6系统yum安装报错The requested URL returned error: 404 Not Found

运行node.js报错:Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } j

(c)2006-2024 SYSTEM All Rights Reserved IT常识