Linux:CentOS 6.8
今日yum安装时,出现如下错误:
[root@localhost ~]# yum -y install tree
Loaded plugins: fastestmirror
Setting up Install Process
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/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
网上查询后,一般的解决方案都是
- 检查网络是否畅通
- 增加DNS
- 更换阿里云源、网易源
- 等等…
很不幸,上述方法在我这里都未生效
自己非常确定网络没有问题,仔细阅读更换源后的错误日志,发现还是源的问题,接下来尝试腾讯源,成功!!!
更换为腾讯源步骤:
- 备份系统旧配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 下载源配置 CentOS6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos6_base.repo
- 把http替换https
sed -i 's#http#https#g' /etc/yum.repos.d/CentOS-Base.repo
- 清除并重建缓存
yum clean all yum makecache