解決Linux下yum安裝無法解析URL的問題

解決Linux下yum安裝無法解析URL的問題

問題:

複製代碼
[root@yaya ~]# 
yum -y install gcc-*
Loaded plugins: fastestmirror, presto
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os
error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
複製代碼

 

原因:
 dns服務器沒有配置正確

 

解決辦法:
1、打開文件/etc/resolv.conf在其中添加:

 nameserver 8.8.8.8
 nameserver 8.8.4.4

 

 

2、然後重啓網卡:使用命令:

service network restart

問題解決

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章