运行 yum install xxx出现下面异常
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, 'Connection time-out')
错误:Cannot find a valid baseurl for repo: base
yum在安装时,需要进行配置yum源
centos-6 更换 yum 源:
只需要在centos命令行界面下执行一下几条命令
sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
yum clean all
yum makecache
centos-7 更换 yum 源:
#在国内使用默认 yum 源下载软件速度慢,更换国内的 yum 源可以提高软件下载速度
# https://www.cnblogs.com/reasonzzy/p/11143737.html
# 先执行
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# yum -y install yum-utils
# 更新 yum 源
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache