1、备份CentOS-Linux-BaseOS.repo
mv /etc/yum.repos.d/CentOS-Linux-BaseOS.repo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo.backup
2、获取 阿里yum 配置文件
wget -O /etc/yum.repos.d/CentOS-Linux-BaseOS.repo http://mirrors.aliyun.com/repo/Centos-8.repo
3、修改下载的CentOS-Linux-BaseOS.repo阿里配置文件中地址,镜像地址
cd /etc/yum.repos.d
vim CentOS-Linux-BaseOS.repo
所有mirrors.cloud.aliyuncs.com 替换为 mirrors.aliyun.com
所有releasever 替换为 releasever-stream
4、更新yum 缓存
yum mackecache
如果出现
Errors during downloading metadata for repository 'appstream':
- Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/Devel/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
Errors during downloading metadata for repository 'epel':
- Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/Devel/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
或其他提示类似提示,只需将/etc/yum.repos.d文件夹下对应的repo文件删除或修改文件名 尾部.backup,因为访问的还是原来的地址 不是新下载及修改后CentOS-Linux-BaseOS.repo中的地址
镜像地址https://mirrors.aliyun.com/centos/8-stream/BaseOS/x86_64/os/repodata/repomd.xml