天天看點

yum指令出現“Error: Cannot find a valid baseurl for repo: base”解決辦法

1、通過執行如下指令修改fastestmirror.conf的配置參數

sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf

2、備份檔案

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

3、如果是香港伺服器或者海外,替換為官方Vault源

curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Official.repo

如果是國内建議使用阿裡雲,執行如下

curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo

國内伺服器使用海外的源有些安裝不上,如我遇到的下面這個問題,後來換回國内的阿裡的就無問題

繼續閱讀