以下是将CentOS 8 Stream更换为阿里源的步骤:
1.先备份原来的源:
进入etc/yum.repos.d 目录下,然后创建目备份录
mkdir CentOS-Stream-repo-backup
备份原来的repo文件
sudo mv /etc/yum.repos.d/CentOS-Stream-BaseOS.repo /etc/yum.repos.d/CentOS-Stream-repo-backup
(如果备份剪切yum.repos.d目录下所有文件,用下面命令
sudo mv /etc/yum.repos.d/CentOS-Stream-*.repo /etc/yum.repos.d/CentOS-Stream-repo-backup
)
2.下载阿里云的repo文件:
sudo curl -o /etc/yum.repos.d/CentOS-Stream-BaseOS.repo http://mirrors.aliyun.com/repo/CentOS-Stream-BaseOS-8.repo
(经过测试以上源URL已经失效,可联系客服提供新的URL)
3.更新yum缓存:
sudo yum clean all
sudo yum makecache
4.测试是否生效:
sudo yum update (更新内核)
sudo yum upgrade(不更新内核)
如果能够正常更新,则表示已经成功更换为阿里源。