yum install 命令错误/Cannot find a valid baseurl for repo解决方法

在Linux上执行`yum install gcc`时遇到错误,原因为默认baseurl失效。解决方案是将yum源替换为清华大学的镜像站。具体操作包括:备份并编辑`/etc/yum.repos.d/CentOS-Base.repo`文件,根据系统CentOS版本选择相应选项,修改或添加`baseurl`配置,确保与清华镜像站目录名匹配。
摘要由CSDN通过智能技术生成

问题描述

今天在Linux上安装gcc时,使用 yum install gcc 命令时出错了:

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/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
错误:Cannot find a valid baseurl for repo: base

问题原因

这是因为配置文件中默认的base站点挂掉了,因此需要换一个站点,这里选用了清华大学的站点

解决办法

  1. 修改yum源站点配置文件(建议先备份):vim /etc/yum.repos.d/CentOS-Base.repo

  2. 直接复制下面的内容,覆盖掉该文件

# 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值