问题描述
今天在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站点挂掉了,因此需要换一个站点,这里选用了清华大学的站点
解决办法
-
修改yum源站点配置文件(建议先备份):vim /etc/yum.repos.d/CentOS-Base.repo
-
直接复制下面的内容,覆盖掉该文件
# 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
在Linux上执行`yum install gcc`时遇到错误,原因为默认baseurl失效。解决方案是将yum源替换为清华大学的镜像站。具体操作包括:备份并编辑`/etc/yum.repos.d/CentOS-Base.repo`文件,根据系统CentOS版本选择相应选项,修改或添加`baseurl`配置,确保与清华镜像站目录名匹配。
最低0.47元/天 解锁文章

4万+

被折叠的 条评论
为什么被折叠?



