[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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM