前置声明RHEL9 出来啦,没钱买订阅,试试Centos Stream 9体验体验
本教程目前使用的是清华源,目前阿里云没有对应的镜像
以下命令均可以使用dnf代替
开始替换 删除原来的源首先,我们前往文件夹/etc/yum.repos.d/下面的,删除所有的文件
具体命令如下
cd /etc/yum.repos.d/ rm -rf ./*导入新的源
我们在刚才的目录下,新建一个文件Centos.repo,接着导入下面这些信息
[baseos] name=CentOS Stream $releasever - BaseOS #mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=BaseOS&infra=$infra baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [appstream] name=CentOS Stream $releasever - AppStream #mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=AppStream&infra=$infra baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
具体命令如下
cd /etc/yum.repos.d/ touch Centos.repo vim Centos.repo #------这里是打开vim后的代码------# [baseos] name=CentOS Stream $releasever - BaseOS #mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=BaseOS&infra=$infra baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [appstream] name=CentOS Stream $releasever - AppStream #mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=AppStream&infra=$infra baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial刷新缓存
现在我们已经导入了源,需要清理掉旧的源信息,然后导入新的源
执行以下命令即可
yum clean all yum makecache结束
完事下班,现在你就已经接入清华的源了,享受Speed吧



