Centos运行yum update时候提示Error: Cannot find a valid baseurl for repo: base,具体如下
yum update
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
解决办法如下:
1.首先查看CentOS系统版本号:
cat /etc/redhat-release
2.运行下面三条命令更新镜像链接,注意将其中的“6.5”替换为步骤1中所获取的系统版本号:
echo "http://vault.centos.org/6.5/os/x86_64/" > /var/cache/yum/x86_64/6/base/mirrorlist.txt
echo "http://vault.centos.org/6.5/extras/x86_64/" > /var/cache/yum/x86_64/6/extras/mirrorlist.txt
echo "http://vault.centos.org/6.5/updates/x86_64/" > /var/cache/yum/x86_64/6/updates/mirrorlist.txt
需要注意的是,mirrorlist.txt的路径,是最上面的错误信息中获取的(标记为红色)。
最后就可以正常运行 yum update 命令了。