Temporary failure in name resolution

    最近在使用yum方式安装perl-DBD-MySQL时碰到了Temporary failure in name resolution,Trying other mirror。即命名解析失败,尝试使用其它镜像。由于本机为最近安装的新服务器,下面是这个问题的现象描述及处理过程。

1、故障现象
###当前环境
[root@GZDB ~]# cat /etc/issue
CentOS release 5.11 (Final)
Kernel \r on an \m

[root@GZDB ~]# yum install perl-DBD-MySQL
              ..............
http://mirrors.pubyun.com/centos/5.11/os/x86_64/CentOS/mysql-5.0.95-5.el5_9.x86_64.rpm:
    [Errno 4] IOError: Trying other mirror.
http://mirrors.sina.cn/centos/5.11/os/x86_64/CentOS/mysql-5.0.95-5.el5_9.x86_64.rpm:
    [Errno 4] IOError: Trying other mirror.

Error Downloading Packages:
  mysql-5.0.95-5.el5_9.x86_64: failure:
      CentOS/mysql-5.0.95-5.el5_9.x86_64.rpm from base: [Errno 256] No more mirrors to try.
  perl-DBI-1.52-2.el5.x86_64: failure:
      CentOS/perl-DBI-1.52-2.el5.x86_64.rpm from base: [Errno 256] No more mirrors to try.
  perl-DBD-MySQL-3.0007-2.el5.x86_64: failure:
      CentOS/perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm from base: [Errno 256] No more mirrors to try.

###尝试ping百度,结果提示未知的主机
[root@GZDB yum.repos.d]# ping www.baidu.com
ping: unknown host www.baidu.com
[root@GZDB yum.repos.d]# ping www.baidu.com
ping: unknown host www.baidu.com

2、故障解决
###结合上面的错误提示及无法ping通百度,应该是dns解析未配置
[root@GZDB yum.repos.d]# more /etc/resolv.conf  ###未配置dns解析

###添加dns解析
[root@GZDB yum.repos.d]# echo "
> nameserver 121.14.37.62
> nameserver 203.196.0.6">>/etc/resolv.conf

[root@GZDB yum.repos.d]# ping www.baidu.com
PING www.a.shifen.com (119.75.217.109) 56(84) bytes of data.
64 bytes from 119.75.217.109: icmp_seq=1 ttl=52 time=38.7 ms
64 bytes from 119.75.217.109: icmp_seq=2 ttl=52 time=38.8 ms
64 bytes from 119.75.217.109: icmp_seq=3 ttl=52 time=38.7 ms
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 6078ms
rtt min/avg/max/mdev = 38.711/38.742/38.801/0.165 ms

###再次yum perl-DBD-MySQL时成功

[root@GZDB yum.repos.d]# yum install perl-DBD-MySQL
   .......
Is this ok [y/N]: y
Downloading Packages:
(1/3): perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm                 | 148 kB     00:00     
(2/3): perl-DBI-1.52-2.el5.x86_64.rpm                         | 600 kB     00:00     
(3/3): mysql-5.0.95-5.el5_9.x86_64.rpm                        | 4.9 MB     00:00     
-------------------------------------------------------------------------------------
Total                                                349 kB/s | 5.6 MB     00:16     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : perl-DBI                                                      1/3
  Installing     : mysql                                                         2/3
warning: /etc/my.cnf created as /etc/my.cnf.rpmnew
  Installing     : perl-DBD-MySQL                                                3/3

Installed:
  perl-DBD-MySQL.x86_64 0:3.0007-2.el5                                                                                       

Dependency Installed:
  mysql.x86_64 0:5.0.95-5.el5_9                                 perl-DBI.x86_64 0:1.52-2.el5                                

Complete!  

你可能感兴趣的:(-----Linux相关特性)