一次在临时服务器执行 yum命令出现报错问题:
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt ......
1、修改fastestmirror.conf的配置参数
sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf
2、备份文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
3、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
推荐使用安全方式连接:wget --no-check-certificate -O CentOS-Base.repo h ttps://mirrors.aliyun.com/repo/Centos-6.repo
4、替换源文件配置, 使用https://mirrors.aliyun.com/centos-vault/
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
5、替换http成https
sed -i 's/http/https/g' /etc/yum.repos.d/CentOS-Base.repo
6、替换版本,$releasever替换6.5, 6.5是当前centOS版本
sed -i 's/$releasever/6.5/g' /etc/yum.repos.d/CentOS-Base.repo
7、替换centos为centos-vault
sed -i 's/centos/centos-vault/g' /etc/yum.repos.d/CentOS-Base.repo
8、清掉所有索引缓存&& 生成yum索引缓存
yum clean all && yum makecache
问题解决
标签:CentOS,mirrors,cache,repo,etc,Base,yum,mirrorlist From: https://www.cnblogs.com/ll666/p/17815174.html