yum安装时报错:Error: Cannot find a valid baseurl for repo: base

使用yum安装gcc时候报错,详情如下:

Loaded plugins: fastestmirror

Determining fastest mirrors

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/i386/6/base/mirrorlist.txt

Error: Cannot find a valid baseurl for repo: base

在网上找了很多的方法,但是都不起作用:

 

最终解决方案:

#sed -i "s|enabled=1|enabled=o|g" /etc/yum/pluginconf.d/fastestmirror.conf

#mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/Centos-Base.repo.backup

#curl -o /etc/yum.repos.d/centos-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo

#yum clean all

依次执行完上述命令,yum -y install gcc*就没有报错了。

posted on 2021-01-14 17:01  七星瓢虫6  阅读(513)  评论(0编辑  收藏  举报