首页 > 产品运营 > 教程经验

yum update显示Could not resolve host: mirrorlist.centos.org;未知的错误解决办法

来源:   时间:2024-09-03 17:40:04 浏览量:
搬主题之前有台主机是CentOS的,最近登录主机的SSH,使用yum update命令后出错,直接显示Could not resolve host: mirro

搬主题之前有台主机是CentOS的,最近登录主机的SSH,使用yum update命令后出错,直接显示Could not resolve host: mirrorlist.CentOS.org;未知的错误解决办法。这里搬主题研究了一下,给出解决办法给大家参考。

首先提示如下:

[root@Banzhuti]# yum update已加载插件:copr, fastestmirror, langpacks, product-id, search-disabled-reposRepository base is listed more than once in the configurationRepository updates is listed more than once in the configurationRepository extras is listed more than once in the configurationRepository centosplus is listed more than once in the configurationLoading mirror speeds from cached hostfileCould not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was14: 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= ...     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         or            subscription-manager repos --disable=     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=.skip_if_unavailable=trueCannot find a valid baseurl for repo: base/7/x86_64

yum update显示Could not resolve host: mirrorlist.centos.org;未知的错误解决办法插图

这下应该如何处理呢?

其实问题的根源是CentOS 7官方已经停止支持了。

问题是mirrorlist.CentOS.org 这个链接,因为CentOS 7 于 2024-06-30 停止支持后不再存在。所以这个域名自然就找不到。

解决此问题的可能解决方案如下:

  1. 通过 LEAPP 或类似产品迁移到其他项目企业 Linux 产品 8 或 9 的受支持版本。有许多项目和商业产品提供替代品。

  2. 通过提供持续 EL7 支持的几家公司之一寻求长期支持。

或者,你可以打开/etc/yum.repos.d/centos.repo文件,然后注释掉 mirrorlist 行,并输入

[base]name=CentOS-$releasever - Basebaseurl=https://vault.centos.org/7.9.2009/os/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#released updates [updates]name=CentOS-$releasever - Updatesbaseurl=https://vault.centos.org/7.9.2009/updates/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that may be useful[extras]name=CentOS-$releasever - Extrasbaseurl=https://vault.centos.org/7.9.2009/extras/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

最后的效果类似如下:

yum update显示Could not resolve host: mirrorlist.centos.org;未知的错误解决办法插图1

接下来,再次运行yum update命令,问题解决,不再报错了。

免责申明:

以上展示内容来源于用户自主上传、合作媒体、企业机构或网络收集整理,版权争议与本站无关,文章涉及见解与观点不代表官方立场,请读者仅做参考。本文标题:yum update显示Could not resolve host: mirrorlist.centos.org;未知的错误解决办法,本文链接:https://www.htuwang.com/help/105329.html;若您认为本文侵犯了您的版权信息,或您发现该内容有任何违法信息,请联系我们修改或者删除处理,联系邮件(邮箱号:kefu@qianu.com)。

精选推荐

热门阅读