一、yum -y install 出错没有可用的软件源 yum 出现could not retrieve mirrorlist 错误_centos7 yum could not retrieve mirrorlist
1、输入yum -y install ipset ipvsadm出现:
问题描述:
Yum 仓库访问失败,节点无法解析 CentOS 官方镜像站域名,导致无法安装必要的网络工具(ipset/ipvsadm)。
原因分析:
可能是网络或者yum没有安装。检查后发现不是这的原因。然后又查看日志发现报错为未正常访问镜像源。重新下载后问题解决。
解决方案:
(1)重新配置yum源:删除原有的 yum 源配置文件:进入/etc/yum.repos.d/目录,删除该目录下的所有文件(建议先备份或移动到其他位置,以防万一)。
rm -f /etc/yum.repos.d/*
(2)重新下载合适的 yum 源::
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
如果出现错误:解决方法:
yum install wget -y
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
然后清理 yum 缓存:执行命令yum clean all。
重新生成 yum 缓存:执行命令yum makecache。
更新系统:执行命令yum update,更新系统软件包。现在应该就可以安装了。
[root@K8s-Master modules]# yum -y install ipset ipvsadm
文件部分参考:解决Centos7 yum 出现could not retrieve mirrorlist 错误_centos7 yum could not retrieve mirrorlist-CSDN博客