- 进入yum的repos目录
cd /etc/yum.repos.d/
- 下载CentOS 7的repo文件
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
- 修改镜像源
vim CentOS-Base.repo
# vim命令模式下执行
:%s/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g
:%s/$releasever/$releasever-stream/g
- 修改所有的CentOS文件内容
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
- 更新镜像源
清除缓存:yum clean all
生成缓存:yum makecache
- 更新yum:
yum update