YumRepo Error: All mirror URLs are not using ftp, http[s] or file解决办法

时间: 2023-07-10 admin IT培训

YumRepo Error: All mirror URLs are not using ftp, http[s] or file解决办法

YumRepo Error: All mirror URLs are not using ftp, http[s] or file解决办法

一、问题背景

      CentOS6.5利用yum命令安装程序报错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

、以及利用yum makecache命令时报错Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again。

二、解决办法 

         在网上查了很多办法,也走过很多坑,最后终于在Centos6 yum源 centos/6.6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERRO 报错解决方法及新的源_醉世老翁的博客-CSDN博客

找到了可用的办法,亲测有效。 为了以后方便用别丢失了,特意转载过来。

原因分析:CentoS 6 停止维护更新日期2020年11月30日,其中

                 CentOS 7 停止维护更新日期2024年6月30日

                CentOS 8 停止维护更新日期2021年12月31日,其他具体信息可参阅官网zh/About/Product - CentOS Wiki

解决办法: 阿里云源可以使用,直接复制下面的信息替换CentOS-Base.repo文件里面的内容就可以使用。

1、修改yum配置文件

vi /etc/yum.repos.d/CentOS-Base.repo   #打开yum配置文件

2、将下面的配置信息复制替换掉CentOS-Base.repo文件里的内容,亲测有效~~~但是一定要注意,里面的信息要根据自己的centos版本做相应的调整,我的是6.5版本的就修改6.5,如果你的是6.6就修改为6.6!!!

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#[base]
name=CentOS-6.5 - Base
baseurl=.6/os/x86_64/
gpgcheck=1
gpgkey=[updates]
name=CentOS-6.5 - Updates
baseurl=.6/updates/x86_64/
gpgcheck=1
gpgkey=[extras]
name=CentOS-6.5 - Extras
baseurl=.6/extras/x86_64/
gpgcheck=1
gpgkey=[centosplus]
name=CentOS-6.5 - Plus
baseurl=.6/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=[contrib]
name=CentOS-6.5 - Contrib
baseurl=.6/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=

       然后再利用以下命令清理以下缓存就可以了

yum clean all   #清除yum缓存
rm -rf /var/cache/yum/    #删除yum缓存文件
yum makecache   #重新创建yum缓存,这里注意系统时间要与因特网一致

      现在就可以安装了