[trouble shooting] centos 软件源不能使用

问题

当我想要查询某个软件是否安装时,出现以下报错 

[root@localhost bin]# yum info dumper
Loaded plugins: fastestmirror
http://centos.ustc.edu.cn/centos/7.2.1511/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: centos.ustc.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.nwsuaf.edu.cn/centos/7.2.1511/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.nwsuaf.edu.cn; Unknown error"
Trying other mirror.
http://mirror.bit.edu.cn/centos/7.2.1511/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.bit.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.cqu.edu.cn/CentOS/7.2.1511/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cqu.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/7.2.1511/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.neusoft.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.opencas.cn/centos/7.2.1511/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.opencas.cn; Unknown error"
Trying other mirror.
http://mirrors.sina.cn/centos/7.2.1511/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.sina.cn; Unknown error"
Trying other mirror.
http://mirror.neu.edu.cn/centos/7.2.1511/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.neu.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.skyshe.cn/centos/7.2.1511/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.skyshe.cn; Unknown error"
Trying other mirror.
http://mirrors.zju.edu.cn/centos/7.2.1511/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.zju.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.yun-idc.com/centos/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.yun-idc.com; Unknown error"
Trying other mirror.
http://ftp.sjtu.edu.cn/centos/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: ftp.sjtu.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.nwsuaf.edu.cn/centos/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.nwsuaf.edu.cn; Unknown error"
Trying other mirror.
http://mirror.bit.edu.cn/centos/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.bit.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.cqu.edu.cn/CentOS/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cqu.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.neusoft.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.opencas.cn/centos/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.opencas.cn; Unknown error"
Trying other mirror.
http://mirrors.sina.cn/centos/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.sina.cn; Unknown error"
Trying other mirror.
http://mirrors.aliyun.com/centos/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com; Unknown error"
Trying other mirror.
http://mirror.neu.edu.cn/centos/7.2.1511/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.neu.edu.cn; Unknown error"
Trying other mirror.
http://centos.ustc.edu.cn/centos/7.2.1511/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: centos.ustc.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.yun-idc.com/centos/7.2.1511/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.yun-idc.com; Unknown error"
Trying other mirror.
http://ftp.sjtu.edu.cn/centos/7.2.1511/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: ftp.sjtu.edu.cn; Unknown error"
Trying other mirror.
http://mirror.bit.edu.cn/centos/7.2.1511/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.bit.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.cqu.edu.cn/CentOS/7.2.1511/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cqu.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/7.2.1511/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.neusoft.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.opencas.cn/centos/7.2.1511/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.opencas.cn; Unknown error"
Trying other mirror.
http://mirrors.sina.cn/centos/7.2.1511/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.sina.cn; Unknown error"
Trying other mirror.
http://mirror.neu.edu.cn/centos/7.2.1511/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.neu.edu.cn; Unknown error"
Trying other mirror.
http://mirrors.aliyun.com/centos/7.2.1511/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com; Unknown error"
Trying other mirror.
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * epel: epel.mirror.net.in
 * extras: ftp.sjtu.edu.cn
 * updates: centos.ustc.edu.cn
Error: No matching Packages to list

  

 

抽取其中一条,Could not resolve host: mirrors.aliyun.com; Unknown error

这说明 “ mirrors.aliyun.com” 这个“host地址”无法被解析,1.确认一下host是否存在  2.ping一下host

 “ mirrors.aliyun.com” 是可以直接访问的

[root@localhost bin]# ping mirrors.sina.cn
ping: unknown host mirrors.sina.cn
[root@localhost bin]# ping mirrors.aliyun.com
ping: unknown host mirrors.aliyun.com

这说明Centos的DNS服务器,无法把“mirrors.aliyun.com” 这个host网址解析为ip地址,于是查询一下Centos的DNS服务器信息

[root@localhost bin]# cat /etc/resolv.conf
# Generated by NetworkManager


# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com

提示需要添加DNS服务器

[root@localhost network-scripts]# ls -l
total 212
-rw-r--r--. 1 root root   321 Dec 18 00:48 ifcfg-enp0s3
-rw-r--r--. 1 root root   254 Sep 16 19:51 ifcfg-lo
lrwxrwxrwx. 1 root root    24 Dec 17 17:47 ifdown -> ../../../usr/sbin/ifdown
-rwxr-xr-x. 1 root root   627 Sep 16 19:51 ifdown-bnep
-rwxr-xr-x. 1 root root  5817 Sep 16 19:51 ifdown-eth
-rwxr-xr-x. 1 root root   781 Sep 16 19:51 ifdown-ippp
-rwxr-xr-x. 1 root root  4201 Sep 16 19:51 ifdown-ipv6
lrwxrwxrwx. 1 root root    11 Dec 17 17:47 ifdown-isdn -> ifdown-ippp
-rwxr-xr-x. 1 root root  1642 Sep 16 19:51 ifdown-post
-rwxr-xr-x. 1 root root  1068 Sep 16 19:51 ifdown-ppp
-rwxr-xr-x. 1 root root   837 Sep 16 19:51 ifdown-routes
-rwxr-xr-x. 1 root root  1444 Sep 16 19:51 ifdown-sit
-rwxr-xr-x. 1 root root  1599 Apr  2  2015 ifdown-Team
-rwxr-xr-x. 1 root root  1556 Apr  2  2015 ifdown-TeamPort
-rwxr-xr-x. 1 root root  1462 Sep 16 19:51 ifdown-tunnel
lrwxrwxrwx. 1 root root    22 Dec 17 17:47 ifup -> ../../../usr/sbin/ifup
-rwxr-xr-x. 1 root root 12631 Sep 16 19:51 ifup-aliases
-rwxr-xr-x. 1 root root   859 Sep 16 19:51 ifup-bnep
-rwxr-xr-x. 1 root root 11721 Sep 16 19:51 ifup-eth
-rwxr-xr-x. 1 root root 12039 Sep 16 19:51 ifup-ippp
-rwxr-xr-x. 1 root root 10430 Sep 16 19:51 ifup-ipv6
lrwxrwxrwx. 1 root root     9 Dec 17 17:47 ifup-isdn -> ifup-ippp
-rwxr-xr-x. 1 root root   642 Sep 16 19:51 ifup-plip
-rwxr-xr-x. 1 root root  1043 Sep 16 19:51 ifup-plusb
-rwxr-xr-x. 1 root root  2609 Sep 16 19:51 ifup-post
-rwxr-xr-x. 1 root root  4154 Sep 16 19:51 ifup-ppp
-rwxr-xr-x. 1 root root  1925 Sep 16 19:51 ifup-routes
-rwxr-xr-x. 1 root root  3263 Sep 16 19:51 ifup-sit
-rwxr-xr-x. 1 root root  1755 Apr  2  2015 ifup-Team
-rwxr-xr-x. 1 root root  1876 Apr  2  2015 ifup-TeamPort
-rwxr-xr-x. 1 root root  2682 Sep 16 19:51 ifup-tunnel
-rwxr-xr-x. 1 root root  1740 Sep 16 19:51 ifup-wireless
-rwxr-xr-x. 1 root root  4623 Sep 16 19:51 init.ipv6-global
-rw-r--r--. 1 root root 15322 Sep 16 19:51 network-functions
-rw-r--r--. 1 root root 26134 Sep 16 19:51 network-functions-ipv6

添加

[root@localhost network-scripts]# vi ./ifcfg-lo
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback

DNS1=8.8.8.8
DNS2=8.8.8.4

添加完以后重启网络

systemctl restart network

再次查询 resolv.conf

[root@localhost network-scripts]# cat /etc/resolv.conf
# Generated by NetworkManager


# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
nameserver 8.8.8.8
nameserver 8.8.8.4

添加完以后发现可以使用了,详细可以参考我另外一篇的博文:virtualbox下的centos7网络配置—— 1.动态ip 2.静态ip

 

[root@localhost init.d]# yum info dumper
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * epel: mirror01.idc.hinet.net
 * extras: ftp.sjtu.edu.cn
 * updates: centos.ustc.edu.cn
Error: No matching Packages to list

 

转载于:https://www.cnblogs.com/hellotracy/articles/5106158.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值