yum 无法连接到镜像 Error: Cannot retrie

2021-01-22  本文已影响0人  Way_Kwok_Chu

一、背景
在使用yum命令下载wget时,无法下载
外网能够连接,防火墙已经关闭了
二、报错信息

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
http://mirror.centos.org/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

三、原因
经过查找各种资料分析得出,该问题是yum 源的配置地址出问题了,低版本的yum源网址不在维护了
以清华源为例,centos以下已经进行维护了,只有一个readme文件了,同时163的,阿里云等很多网址都不维护了,试了很多

20201219131840235.png
四、解决
经过各种查询,终于找到一个还在维护的yum源网址:https://vault.centos.org/
在打开虚拟机,进入cd /etc/yum.repos.d/
备份里面的CentOS-Base.repo
新建一个CentOS-Base.repo,里面内容为:
    name=CentOS-6
    baseurl=https://vault.centos.org/6.0/os/x86_64
    gpgcheck=0

完成后再输入下面的命令:

        yum clean all
        yum makecache
2020121913193598.png
上一篇 下一篇

猜你喜欢

热点阅读