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

3 篇文章 0 订阅
2 篇文章 0 订阅

一、问题背景

CentOS6.5利用yum -y install gcc命令安装程序报错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。
在这里插入图片描述

二、问题原因

对应的镜像库中无法找到对应的repomd.xml文件

原因分析:CentoS 6 停止维护更新日期2020年11月30日,其中
CentOS 7 停止维护更新日期2024年6月30日
CentOS 8 停止维护更新日期2021年12月31日,其他具体信息可参阅官网https://wiki.centos.org/zh/About/Product
在这里插入图片描述

三、解决方法

原centos/6/ 下已经没有相关的文件,尝试修改本地镜像配置文件

步骤:

cd /etc/yum.repos.d

修改之前先保存一个备份文件

cp CentOS-Base.repo CentOS-Base.repo.bak
vi  CentOS-Base.repo

因为$releasever 获取的是centos的版本号,我的centos获取的版本为6,但是镜像站中无对应版本文件,因此需要修改本地配置文件

:%s/$releasever/7/g #将文件中$releasever全部改成7或其他版本

修改后文件内容如下图:

# 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-7 - Base
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/7/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-7 - Updates
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-7 - Extras
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-7 - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/7/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

保存退出:

:wq

清除和重新生成缓存

yum clean all 
rm -rf /var/cache/yum
yum makecache 

完成之后再次通过yum -y install XXX 尝试安装软件

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值