1.备份系统自带yum源配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.back
2.通过curl下载yum源
需要服务器可以联网
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
如果是5,6,8,那就把7换成对应的数数字
网上给的更换yum源基本都是通过wget
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
如果有wget,可以用这个,没有就用curl那个
3.运行yum makecache生成缓存
yum makecache
4.更新yum源
yum -y update
5.安装wget
yum install -y wget