Linux(CentOS7)修改默认yum源为国内的阿里云、网易yum源

修改方式:

echo 备份当前的yum源
mv /etc/yum.repos.d /etc/yum.repos.d.backup4comex
echo 新建空的yum源设置目录
mkdir /etc/yum.repos.d
echo 下载阿里云的yum源配置
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

然后重建缓存:

yum clean all
yum makecache

clipboard

========================我是可爱的分割线========================

执行报错“-bash: wget: command not found”的解决方式

执行报错:

clipboard[1]

原来默认的centos最小版是没有安装wget的。我们需要先yum安装一下。

回滚配置

cp /etc/yum.repos.d.backup4comex/* /etc/yum.repos.d

然后yum安装wget

yum -y install wget 

clipboard[2]

然后再次获取:

rm -rf /etc/yum.repos.d
mkdir /etc/yum.repos.d
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
原文地址:https://www.cnblogs.com/sx66/p/11587215.html