centos执行yum安装软件时报错,Error: Cannot find a valid baseurl for repo: base

yum安装软件时报错如下:

centos执行yum安装软件时报错,Error: Cannot find a valid baseurl for repo: base_第1张图片错误信息大概意思是缓存的镜像文件里的URL无效了,所以无法下载程序文件来安装

解决方法:

1.查询Centos系统版本号,命令:cat /etc/redhat-release

2.从执行 yum 命令时的错误提示信息中查找出 mirrorlist.txt路径,我的执行日志中路径如下:

removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt

3.执行以下三个命令,其中6.8为步骤一种centos的版本号,>后为步骤2中获取到的路径(命令2将路径的base改成extras,命令3将base改成updates):

echo "http://vault.centos.org/6.8/os/x86_64/" > /var/cache/yum/x86_64/6/base/mirrorlist.txt
echo "http://vault.centos.org/6.8/extras/x86_64/" > /var/cache/yum/x86_64/6/extras/mirrorlist.txt
echo "http://vault.centos.org/6.8/updates/x86_64/" > /var/cache/yum/x86_64/6/updates/mirrorlist.txt


  •  

你可能感兴趣的:(linux,centos,linux,运维)