废话不多说,原因都懂,更换国内yum源,直接上硬货

1、进入root用户,切换至yum.repos.d目录

cd /etc/yum.repos.d/

2、创建新文件夹并将源文件备份为repo.bak

mkdir backup && mv *repo backup/

3、下载国内yum源文件

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

4、更新下载yum源地址

sed -i -e “s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g” /etc/yum.repos.d/CentOS-*

sed -i -e “s|releasever|releasever-stream|g” /etc/yum.repos.d/CentOS-*

5、生成缓存

yum clean all && yum makecache