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

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

搬主题之前有台主机是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命令,问题解决,不再报错了。

你也想0元试听小码王编程课程吗?
填写信息免费预约
免责申明:以上展示内容来源于合作媒体、企业机构、网友提供或网络收集整理,版权争议与本站无关,文章涉及见解与观点不代表小码王官方立场,请读者仅做参考。本文标题:yum update显示Could not resolve host: mirrorlist.centos.org;未知的错误解决办法,本文链接:https://www.xiaomawang.cn/help/201448.html;欢迎转载,转载请说明出处。若您认为本文侵犯了您的版权信息,或您发现该内容有任何涉及有违公德、触犯法律等违法信息,请您立即通过邮件(邮箱号: hzlixy@xiaoma.cn)联系我们及时修正或删除。
校区接待前厅
校区太空走廊
校区教室环境
校区多功能教室
小码王少儿编程体验课程免费预约