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

一、问题背景

CentOS6.7 利用 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.7 版本的就修改 6.7,如果你的是 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.7 - Base
baseurl=http://mirrors.aliyun.com/centos-vault/6.7/os/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
[updates]
name=CentOS-6.7 - Updates
baseurl=http://mirrors.aliyun.com/centos-vault/6.7/updates/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
[extras]
name=CentOS-6.7 - Extras
baseurl=http://mirrors.aliyun.com/centos-vault/6.7/extras/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
[centosplus]
name=CentOS-6.7 - Plus
baseurl=http://mirrors.aliyun.com/centos-vault/6.7/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
[contrib]
name=CentOS-6.7 - Contrib
baseurl=http://mirrors.aliyun.com/centos-vault/6.7/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

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

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

现在就可以安装了

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值