centos7 yum 问题处理
遇到了yum仓库的问题,提示无法解析mirrorlist.centos.org,可能的问题是什么呢?
已加载插件:fastestmirror
Repository centos-sclo-rh is listed more than once in the configuration
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release=7&repo=sclo-sclo error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
One of the configured repositories failed (未知),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: centos-sclo-sclo/x86_64

1. 检查网络连接
-
测试网络连通性:
ping -c 4 mirrorlist.centos.org
如果无法解析域名或无法连接,说明存在网络或 DNS 问题。
-
修复 DNS 配置:
编辑/etc/resolv.conf,添加可靠的 DNS 服务器:nameserver 8.8.8.8 # Google DNS nameserver 114.114.114.114 # 国内 DNS
2. 修复仓库配置
-
删除重复仓库配置:
检查/etc/yum.repos.d/目录下的.repo文件,合并或删除重复的centos-sclo-rh配置。 -
手动替换仓库镜像源:
编辑/etc/yum.repos.d/CentOS-SCLo-scl.repo,找到[centos-sclo-sclo]部分,修改为:[centos-sclo-sclo] name=CentOS-$releasever - SCLo sclo baseurl=http://vault.centos.org/centos/$releasever/sclo/$basearch/sclo/ #mirrorlist=http://mirrorlist.centos.org/?arch=$basearch&release=$releasever&repo=sclo-sclo gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
说明:注释
mirrorlist并改用vault.centos.org(官方存档镜像)。
3. 临时禁用问题仓库
运行 yum 时跳过故障仓库:
yum update --disablerepo=centos-sclo-sclo
4. 清除 Yum 缓存
yum clean all rm -rf /var/cache/yum yum makecache
5. 其他可能性
-
代理或防火墙:
-
如果使用代理,在
/etc/yum.conf中添加代理设置:proxy=http://your-proxy-ip:port
-
检查防火墙是否允许 HTTP/HTTPS 流量:
iptables -L -n -v | grep 80 iptables -L -n -v | grep 443
-

浙公网安备 33010602011771号