CentOS6 停止更新,YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
如下所示,这是在CentOS 6中发生的问题:
[root@fastvm-centos-6-10-51 ~]# yum repolist Loaded plugins: fastestmirror 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 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/extras/mirrorlist.txt 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/updates/mirrorlist.txt repo id repo name status base CentOS-6 - Base 0 extras CentOS-6 - Extras 0 updates CentOS-6 - Updates 0 repolist: 0
原因是由于2020-11-30,CentOS 6的EOL已从fastmirror站点中删除。 如下所示,将CentOS Vault存储库添加到mirrorlist.txt。
替换为官方Vault源(海外服务器用)
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.https://www.xmpan.com/Centos-6-Vault-Official.repot-Official.repo
或者替换为阿里云Vault镜像(国内服务器用)
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
添加后,您可以看到yum repolist的工作原理如下:
[root@localhost packages]# yum repolist Loaded plugins: fastestmirror, security Determining fastest mirrors base | 3.7 kB 00:00 base/primary_db | 3.7 MB 00:11 extras | 3.3 kB 00:00 extras/primary_db | 20 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 11 MB 00:36 repo id repo name status base CentOS-6.10 - Base - mirrors.aliyun.com 5,075 extras CentOS-6.10 - Extras - mirrors.aliyun.com 21 updates CentOS-6.10 - Updates - mirrors.aliyun.com 963 repolist: 6,059
如果按上述方法应用,则在执行yum clean all命令时将再次发生相同的问题, 如下所示,在/etc/yum.repos.d/下修改回购文件,
$ sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo $ sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=https:\/\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo
仓库如下所示进行修改:
$ diff CentOS-Base.repo.old CentOS-Base.repo 15,16c15,16 < mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra < #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ --- > #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra > baseurl=https://vault.centos.org/centos/$releasever/os/$basearch/ 23,24c23,24 < mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra < #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ --- > #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra > baseurl=https://vault.centos.org/centos/$releasever/updates/$basearch/ 31,32c31,32 < mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra < #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ --- > #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra > baseurl=https://vault.centos.org/centos/$releasever/extras/$basearch/
如下所示,即使yum缓存是干净的,也会维护镜像站点信息:
[root@fastvm-centos-6-10-51 yum.repos.d]# yum clean all Loaded plugins: fastestmirror Cleaning repos: base extras updates Cleaning up Everything [root@fastvm-centos-6-10-51 yum.repos.d]# yum repolist Loaded plugins: fastestmirror Determining fastest mirrors base | 3.7 kB 00:00 base/primary_db | 4.7 MB 00:03 extras | 3.4 kB 00:00 extras/primary_db | 29 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 12 MB 00:07 repo id repo name status base CentOS-6 - Base 6,713 extras CentOS-6 - Extras 47 updates CentOS-6 - Updates 1,193 repolist: 7,953 [root@fastvm-centos-6-10-51 yum.repos.d]#
保管库非常慢...
https://www.reddit.com/r/sysadmin/comments/k63mcw/centos_repositories_down/
https://forum.directadmin.com/threads/how-do-i-fix-these-yum-errors.54874/https://chhanz.github.io/linux/2020/12/10/centos-6-yumrepo-error/
评论 (2)