CentOS使用yum安装软件出现 Error:Cannot find a valid baseurl for repo:base的解决办法

问题描述:最近在学习Linux使用yum安装软件,出现如下错误

Loaded plugins:fastest mirror,security
Determing fastest mirrors
YumRepo Error:All mirror URLs are not using ftp,http[s] or file.
Eg.Invaliad release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error:Cannot find a valid baseurl for repo:base

解决办法:网上查看了各种解决办法,排查网络原因等等。最终定位在 /etc/yum.repos.d/路径下,打开该路径,发现有如下文件:

CentOS-Base.repo    CentOS-fasttrack.repo  CentOS-Vault.repo

CentOS-Media.repo   CentOS-Debuginfo.repo CentOS-Sources.repo  还有自己新建的cdrom.repo

结果发现自己新建的cdrom.repo文件的不起作用。查看一篇文章发现是CentOS-Base.repo这个文件的问题,只要把该文件名称改为不可用即可,mv  CentOS-Base.repo   CentOS-Base.repo.beifen

参考文章:(1)https://blog.csdn.net/qq_37922264/article/details/81054673

                   (2)https://www.itzgeek.com/how-tos/linux/centos-how-tos/configure-yum-repository-using-dvd-or-cd-rom.html

 

 

你可能感兴趣的:(知识储备)