yum install 出现 Couldn't resolve host

当我要yum install nspr时报错:

http://mirrors.tuna.tsinghua.edu.cn/centos/6.9/os/x86_64/Packages/nspr-4.13.1-1.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.tuna.tsinghua.edu.cn'"
Trying other mirror.
http://mirrors.btte.net/centos/6.9/os/x86_64/Packages/nspr-4.13.1-1.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.btte.net'"
Trying other mirror.
http://mirrors.zju.edu.cn/centos/6.9/os/x86_64/Packages/nspr-4.13.1-1.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.zju.edu.cn'"
Trying other mirror.
http://mirrors.aliyun.com/centos/6.9/os/x86_64/Packages/nspr-4.13.1-1.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.aliyun.com'"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/6.9/os/x86_64/Packages/nspr-4.13.1-1.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.neusoft.edu.cn'"
Trying other mirror.
http://mirrors.njupt.edu.cn/centos/6.9/os/x86_64/Packages/nspr-4.13.1-1.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.njupt.edu.cn'"
Trying other mirror.

想了想应该是网关问题,我重启过服务器,之前的配置的/etc/resolv.conf没了。
解决办法:
给/etc/resolv.conf 加上一行

nameserver 8.8.8.8

然后就行了。

你可能感兴趣的:(yum)