1、首先备份当前配置文件,一般直接删除
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.tencent.com/repo/centos8_base.repo wget -O /etc/yum.repos.d/CentOS-Linux-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
3、运行 yum makecache 生成缓存
yum makecache
还有
yum clean all之类的
yum install epel-release //扩展包更新包
yum update //更新yum源