有網友告知老左自己在騰訊雲端服務器上部署環境使用到yum命令的時候提示無法執行指令碼有出現"Cannot find a valid baseurl for repo"問題提示。看到這樣的問題肯定是源不通導致的,先搜尋搜尋是否有同樣的解決方案,有的人用到需要更新repo的,也有的簡單更新DNS的。
錯誤提示:
代碼如下 |
複製代碼 |
[root@VM_17_139_centos ~]# yum -y install wget screen python
Loaded plugins: fastestmirror, security
Setting up Install Process
Repository updates is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os&infra=stock error was
12: Timeout on http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os&infra=stock: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 30 seconds')
Error: Cannot find a valid baseurl for repo: base
|
因為問題我也沒有遇到過,就先用簡單的方法試試,更換DNS。
代碼如下 |
複製代碼 |
vi /etc/resolv.conf
|
然後將DNS換成兩組 8 8 8 8 和 8 8 4 4
儲存後退出,然後我們在執行yum命令可以看到是可以解決問題的。
搞定,ping www.111cn.net 順暢了,yum可以用了!第一件事情,就是去刪除 /etc/resolv.conf 裡面有問題的dns伺服器。