由于国内网络原因,在CentOS 8 上通yum安装一些软件速度可能会很慢,因此需要更换国内的yum源,以下是更换成阿里云的yum源。
环境: CentOS Linux release 8.1.1911 (Core);
1.备份原有的repo文件
cd /etc/yum.repos.d && mkdir bak && mv *.repo ./bak
以上文件都需要重新命名,因为阿里云源里Centos-8.repo
包含了上述所有文件,如果按照传统手法只更改CentOS-Base.repo
这个文件 会出现一下提示
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
2.修改为阿里云
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
3.运行yum makecache生成缓存
yum clean all
yum makecache