解决yum安装软件报Couldn't resolve host 'mirrorlist.centos.org问题

发布时间:2020-07-15 16:00:12 作者:OldCat1981
来源:网络 阅读:15515

今天在linux环境通过yum安装软件报了以下错误:

[root@multi-mysql yum.repos.d]# yum install ncurses devel -y
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot find a valid baseurl for repo: base

从字面意义上看是不能解析mirrorlist.centos.org这个地址,应该是跟dns网络配置有关系,最后解决方法是在DNS域名解析的配置文件增加DNS服务器的IP地址:

[root@multi-mysql ~]# vim /etc/resolv.conf
nameserver 8.8.8.8
nameserver 202.106.0.20

重启网络服务

[root@multi-mysql ~]# /etc/init.d/network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining if ip address 192.168.1.202 is already in use for device eth0...
                                                           [  OK  ]

重新yum安装,正常

[root@multi-mysql ~]# yum install nmap -y
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirrors.yun-idc.com
 * extras: mirrors.yun-idc.com
 * updates: mirrors.yun-idc.com
base                                                                                                         | 3.7 kB     00:00     
base/primary_db                                                                                              | 4.6 MB     00:01     
extras                                                                                                       | 3.4 kB     00:00     
extras/primary_db                                                                                            |  33 kB     00:00     
updates                                                                                                      | 3.4 kB     00:00     
updates/primary_db                                                                                           | 2.6 MB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nmap.x86_64 2:5.51-4.el6 will be installed
--> Finished Dependency Resolution
......此处省略


推荐阅读:
  1. 解决centos 6.3 yum安装软件时找不到镜像问题
  2. LoadRunner使用odbc时报错can't get hostname for your address的解决方法

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

resolv mi

上一篇:如何解决php读取txt是乱码的问题

下一篇:python中如何输出结果刷新及进度条

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》