发现问题:
[root@mydocker network-scripts]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2016-10-01 09:43:12-- http://mirrors.163.com/.help/CentOS7-Base-163.repo
正在解析主机 mirrors.163.com (mirrors.163.com)... 失败:未知的名称或服务。
wget: 无法解析主机地址 “mirrors.163.com”
[root@mydocker network-scripts]# yum update
已加载插件:fastestmirror,langpacks
http://mirrors.163.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.163.com; 未知的错误"
正在尝试其它镜像。
One of the configured repositories Failed (CentOS-7 - Base - 163.com),
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. Disable the repository,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
4. 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://mirrors.163.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.163.com; 未知的错误"
定位问题:
根据上面的错误提示,应该是域名解析不了,那么我们需要设置CentOS 7的域名解析规则。
解决方法:
在/etc/resolv.conf文件中添加一行内容为:/etc/resolv.conf ,具体如下:
[root@mydocker yum.repos.d/etc/resolv.conf]# cat /etc/resolv.conf
nameserver 8.8.8.8
验证:
[root@mydocker network-scripts]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2016-10-01 09:44:02-- http://mirrors.163.com/.help/CentOS7-Base-163.repo
正在解析主机 mirrors.163.com (mirrors.163.com)... 123.58.173.186,123.58.173.185
正在连接 mirrors.163.com (mirrors.163.com)|123.58.173.186|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1572 (1.5K) [application/octet-stream]
正在保存至: “CentOS7-Base-163.repo”
100%[=====================================================================================================================================================>] 1,572 --.-K/s 用时 0s
2016-10-01 09:44:02 (190 MB/s) - 已保存 “CentOS7-Base-163.repo” [1572/1572])
可以看到已经将163的yum源下载下来了。
原文链接:https://www.f2er.com/centos/380524.html