1.安装wget
yum install -y wget
2.备份配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
3.下载国内yum源文件(华为yum源)
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
(阿里yum源)
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
4.清理缓存
yum clean all
5.重新生成缓存
yum makecache
6. 查看yum源信息
yum repolist
7. 修改内容后更新yum源
yum -y update