2022年5月22日亲测有效 解决 centos6.9(64位) 报错 YumRepo Error: All mirror URLs are not using ftp, http[s] or file.

 环境 centos6.9

问题
CentOS 系统中出现YumRepo Error: All mirror URLs are not using ftp, http[s] or file.报错

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Update Process
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

原因
CentOS 6 于2020年11月30日停止维护,而Yum想要连接旧版本的仓库。所以,我们需要更新陈旧版本的仓库然后指向vault。

解决方案
为了解决这个问题,我们需要修改/etc/yum.repos.d/CentOS-Base.repo,然后替换掉所有镜像源。

1.进入到 /etc/yum.repos.d/目录

cd /etc/yum.repos.d/

2.备份原文件

cp CentOS-Base.repo CentOS-Base.repo.old

3.编辑新文件

vi CentOS-Base.repo

4.替换掉镜像源
将如下的sections都替换掉

[base]
[updates]
[extras]

替换为

[base]
name=CentOS-$releasever - Base
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
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=http://mirror.centos.org/centos/$releasever/updates/$basearch/
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=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

5.清理yum缓存

yum clean all

6.升级yum

yum update

问题解决啦!

转自:

(24条消息) 解决报错 YumRepo Error: All mirror URLs are not using ftp, http[s] or file._justinzwd的博客-CSDN博客

 感谢老哥。

posted @ 2022-05-22 16:18  后来里的老街  阅读(418)  评论(0编辑  收藏  举报