您的足迹:首页 > Linux >【原创】执行yum命令时,报Couldn't resolve host 'mirrors.aliyun.com解决办法

【原创】执行yum命令时,报Couldn't resolve host 'mirrors.aliyun.com解决办法

问题描述:

在执行命令:yum groupinstall -y "Development tools" "Basic Web Server"时报错:

[root@biqa161 base]# yum groupinstall -y "Development tools" "Basic Web Server"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.aliyun.com'"
Trying other mirror.
http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.aliyuncs.com'"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

解决步骤

一、修改DNS

打开ifcfg-etho

[root@biqa161 base]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.52.161
NETMASK=255.255.255.0
GATEWAY=192.168.52.1

在配置最后添加以下配置:

DNS1=8.8.8.8
DNS2=8.8.4.4

保存文件。

二、重启network

[root@biqa161 base]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
FATAL: Module off not found.
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining if ip address 192.168.52.161 is already in use for device eth0...
                                                           [  OK  ]
WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
[root@biqa161 base]# 

三、执行yum update命令

[root@biqa161 base]# yum update 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                 | 3.7 kB     00:00     
base/primary_db                                                                                                                                      | 4.7 MB     00:04     
extras                                                                                                                                               | 3.4 kB     00:00     
extras/primary_db                                                                                                                                    |  37 kB     00:00     
updates                                                                                                                                              | 3.4 kB     00:00     
updates/primary_db                                                                                                                                   | 2.0 MB     00:02     
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package alsa-lib.x86_64 0:1.0.22-3.el6 will be updated
---> Package alsa-lib.x86_64 0:1.1.0-4.el6 will be an update
---> Package audit.x86_64 0:2.2-2.el6 will be updated
---> Package audit.x86_64 0:2.4.5-3.el6 will be an update

至此,问题完美解决,一切正常!

本博客所有文章如无特别注明均为原创。作者:数据为王复制或转载请以超链接形式注明转自 数据为王
原文地址《【原创】执行yum命令时,报Couldn't resolve host 'mirrors.aliyun.com解决办法

相关推荐


  • blogger

发表评论

路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交

网友评论(0)