无法解析主机:mirrorlist.centos.org Centos 7


11

我重新安装了最新的centos 7

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core) 
[root@localhost ~]# 

我想安装一些东西,而没有安装wget,所以当我尝试安装wget时,我看到tha给出了错误。

我在互联网上可能看到了有关此问题的所有主题,但没有运气,我找不到我的解决方案。

[root@localhost ~]# yum update
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.

 One of the configured repositories failed (CentOS-7 - Base),
 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=base ...

     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 base
        or
            subscription-manager repos --disable=base

     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=base.skip_if_unavailable=true

failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
[root@localhost ~]# 

所以当我列出仓库时,我得到了这个:

[root@localhost ~]# yum repolist all
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=centosplus&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/centosplus/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.
repo id                                                                                         repo name                                                                                         status
C7.0.1406-base/x86_64                                                                           CentOS-7.0.1406 - Base                                                                            disabled
C7.0.1406-centosplus/x86_64                                                                     CentOS-7.0.1406 - CentOSPlus                                                                      disabled
C7.0.1406-extras/x86_64                                                                         CentOS-7.0.1406 - Extras                                                                          disabled
C7.0.1406-fasttrack/x86_64                                                                      CentOS-7.0.1406 - CentOSPlus                                                                      disabled
C7.0.1406-updates/x86_64                                                                        CentOS-7.0.1406 - Updates                                                                         disabled
C7.1.1503-base/x86_64                                                                           CentOS-7.1.1503 - Base                                                                            disabled
C7.1.1503-centosplus/x86_64                                                                     CentOS-7.1.1503 - CentOSPlus                                                                      disabled
C7.1.1503-extras/x86_64                                                                         CentOS-7.1.1503 - Extras                                                                          disabled
C7.1.1503-fasttrack/x86_64                                                                      CentOS-7.1.1503 - CentOSPlus                                                                      disabled
C7.1.1503-updates/x86_64                                                                        CentOS-7.1.1503 - Updates                                                                         disabled
C7.2.1511-base/x86_64                                                                           CentOS-7.2.1511 - Base                                                                            disabled
C7.2.1511-centosplus/x86_64                                                                     CentOS-7.2.1511 - CentOSPlus                                                                      disabled
C7.2.1511-extras/x86_64                                                                         CentOS-7.2.1511 - Extras                                                                          disabled
C7.2.1511-fasttrack/x86_64                                                                      CentOS-7.2.1511 - CentOSPlus                                                                      disabled
C7.2.1511-updates/x86_64                                                                        CentOS-7.2.1511 - Updates                                                                         disabled
C7.3.1611-base/x86_64                                                                           CentOS-7.3.1611 - Base                                                                            disabled
C7.3.1611-centosplus/x86_64                                                                     CentOS-7.3.1611 - CentOSPlus                                                                      disabled
C7.3.1611-extras/x86_64                                                                         CentOS-7.3.1611 - Extras                                                                          disabled
C7.3.1611-fasttrack/x86_64                                                                      CentOS-7.3.1611 - CentOSPlus                                                                      disabled
C7.3.1611-updates/x86_64                                                                        CentOS-7.3.1611 - Updates                                                                         disabled
base/7/x86_64                                                                                   CentOS-7 - Base                                                                                   enabled: 0
base-debuginfo/x86_64                                                                           CentOS-7 - Debuginfo                                                                              disabled
base-source/7                                                                                   CentOS-7 - Base Sources                                                                           disabled
c7-media                                                                                        CentOS-7 - Media                                                                                  disabled
centosplus/7/x86_64                                                                             CentOS-7 - Plus                                                                                   enabled: 0
centosplus-source/7                                                                             CentOS-7 - Plus Sources                                                                           disabled
cr/7/x86_64                                                                                     CentOS-7 - cr                                                                                     disabled
extras/7/x86_64                                                                                 CentOS-7 - Extras                                                                                 enabled: 0
extras-source/7                                                                                 CentOS-7 - Extras Sources                                                                         disabled
fasttrack/7/x86_64                                                                              CentOS-7 - fasttrack                                                                              disabled
updates/7/x86_64                                                                                CentOS-7 - Updates                                                                                enabled: 0
updates-source/7                                                                                CentOS-7 - Updates Sources                                                                        disabled
repolist: 0
[root@localhost ~]# 

我不确定在我的vmware / OVH专用服务器上全新安装的问题可能出在哪里。

我安装了另一台服务器,并且工作正常,但是这次我遇到了这个问题。

任何人都可以帮助我吗?我还尝试过在etc / yum.repo.d中启用所有禁用的行

我的/etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

对于后来访问的用户:尽管由于完全不同的原因,我们也开始出现此错误-ius的mirrorlist链接已迁移到新的端点,并且我们的大多数服务器都配置了旧服务器,由于类似的原因,发生了故障错误信息。参考:github.com/iusrepo/infrastructure/issues/14
Gulats

Answers:


15
Could not resolve host: mirrorlist.centos.org; Unknown error

这表明您或者(a)没有正确配置的DNS服务器,或者(b)您的网络配置不正确,并且您无法连接到DNS服务器来检查主机名mirrorlist.centos.org

尝试使用ping 8.8.8.8。如果失败,请尝试ping <local-gateway-ip>。如果仍然失败,则说明您的本地网络配置错误,您必须检查配置。

如果可以ping 8.8.8.8,请尝试使用hostnslookupdig检查DNS设置,如host google.comdig google.com。如果这些操作失败,则需要检查DNS设置。检查/etc/resolv.conf以查看配置了什么。

更新

由于/etc/resolv.conf为空,您需要设置DNS解析器。我建议使用nanovi(或任何您愿意使用的)在文件中输入以下内容:

nameserver 9.9.9.9

保存此文件,然后重试yum update

你也可以尝试其他的DNS主机如果您愿意,比如8.8.8.88.8.4.4或任何OpenDNS的主机。


etc / resolv.conf是空的我什么都没碰到
Albano Albanese

我尝试了utdream.org/post.cfm/…和这个access.redhat.com/solutions/1433223还是您的9.9.9.9,但没有运气:(
Albano Albanese

如果向其中添加了DNS解析器/etc/resolv.conf,但仍然无法执行操作,host google.com则需要检查本地网络配置。发布和的输出,ip addrip route确保包括有关本地网络的信息。另外,您可能必须使用来启动NIC ip link set <eth adapter id> up。您可能还想发布的输出,iptables -nL以确保您没有错误的防火墙配置阻止连接。
安德鲁(Andrew)

用您可以检查的输出更新了我的问题?谢谢您的帮助,这对我来说非常重要,因为我有一个离线网站。
Albano Albanese

从我所看到的,我想知道防火墙是否配置不正确,但是从这里看起来还不错。输出是host google.com 8.8.8.8什么?当您尝试时会看到什么ping 8.8.8.8?一切看起来都还不错,但是有些事情不太正确,我不确定是什么。
安德鲁(Andrew)

4

您可能在某处有连接问题,这是一个小步骤,可检查您在哪里有问题。

基本连接

检查服务器是否具有互联网(IP地址和正确的路由-如果无法正常工作,请检查ip address您是否具有IP地址)。

 ping 8.8.8.8

解析器

检查什么是解析器并对其进行ping操作

 cat /etc/resolv.conf

您应该有nameserver一个和一个IP地址。检查IP是否正在应答。

 ping xx.xx.xx.xx

然后做一个nslookup

 nslookup mirrorlist.centos.org

它应该返回IP地址列表。如果不是,则您的DNS服务器可能无法正常工作,您可以尝试使用

 nslookup
 > server 8.8.8.8
 > mirrorlist.centos.org

并检查这次它是否按预期工作。


嘿,奥利弗(Oliver)谢谢您的答复,我的resolv.conf是空的,什么也没有,当我ping 8.8.8.8时给出答复。
Albano Albanese

我可以在resolv.conf中添加什么吗?如果我能使yum第一次工作,我将在wget中停顿,然后是virtualmin,但正如我所说,resolv.conf中没有任何东西
Albano Albanese

我也尝试过这个access.redhat.com/solutions/1433223,但是重新启动后出现了同样的问题,因此更新的软件包在那里,但是没有运气,错误是一样的
Albano Albanese

尝试添加一行看起来像nameserver 8.8.8.8
ob2

什么都没发生:(
阿尔巴诺·奥尔巴内塞
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.