客户要求centos 6.x系统,然后安装软件的时候, centos 6.x安装软件yum inatall出现错误提示Error: Cannot find a valid baseurl for repo: base, 易秋网络老易搜了半天百度,结果都是过时的信息。如果无法解决这个错误提示,centos 6.x是无法通过Yum安装软件的,连最简单的wget都无法安装,实在没辙,干脆建议客户换到centos 7.x系统。
[root@localhost ~]# yum install screen
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/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
不过后面有一个网友分享了他的经验,解决centos 6.x通过yum安装软件的报错,还是有办法的。去/etc/yum.repos.d/,先把CentOS-Base.repo备份下,mv CentOS-Base.repo CentOS-Base.repo.backup,然后修改下CentOS-Base.repo文件。
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
把CentOS-Base.repo文件的内容变成下面的,即可。
修改 /etc/yum.repos.d/CentOS-Base.repo
[centos-office]
name=centos-office
failovermethod=priority
baseurl=https://vault.centos.org/6.10/os/x86_64/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6
备注:感谢热心网友的无私分享。