CentOS -配置yum源
1 切换到yum目录
cd /etc/yum.repos.d/
2 创建一个备份文件夹
mkdir backup
3 把原配置都放进备份的文件
mv CentOS-* backup
4 下载阿里云YUM源配置文件
方式1 -用curl
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
方式2 -用wget(新建的不推荐用,要用到)
安装wget
yum install wget -y
用wget安装
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
5.如果出现了用yum install xxxxxx
报错
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
然后重启网卡
systemctl restart network