为CentOS Stream 9配置镜像
考虑到国际网络访问体验不佳,可以将CentOS Stream 9的安装源配置为国内镜像。建议使用清华大学的镜像站点,可以在这里找到其中关于CentOS Stream 9的镜像配置说明。
配置步骤
可遵照以下步骤进行配置:
- 备份现有的安装源配置文件:
Terminal window sudo cp /etc/yum.repos.d/centos.repo /etc/yum.repos.d/centos.repo.backupsudo cp /etc/yum.repos.d/centos-addons.repo /etc/yum.repos.d/centos-addons.repo.backup - 使用下面的内容来替换掉
centos.repo
文件中的所有内容(这些内容可以在上述说明页面中找到):centos.repo [baseos]name=CentOS Stream $releasever - BaseOSbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/BaseOS/$basearch/os# metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6hcountme=1enabled=1[baseos-debuginfo]name=CentOS Stream $releasever - BaseOS - Debugbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/BaseOS/$basearch/debug/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-debug-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[baseos-source]name=CentOS Stream $releasever - BaseOS - Sourcebaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/BaseOS/source/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-source-$stream&arch=source&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[appstream]name=CentOS Stream $releasever - AppStreambaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/AppStream/$basearch/os# metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6hcountme=1enabled=1[appstream-debuginfo]name=CentOS Stream $releasever - AppStream - Debugbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/AppStream/$basearch/debug/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-debug-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[appstream-source]name=CentOS Stream $releasever - AppStream - Sourcebaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/AppStream/source/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-source-$stream&arch=source&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[crb]name=CentOS Stream $releasever - CRBbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/CRB/$basearch/os# metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6hcountme=1enabled=1[crb-debuginfo]name=CentOS Stream $releasever - CRB - Debugbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/CRB/$basearch/debug/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-crb-debug-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[crb-source]name=CentOS Stream $releasever - CRB - Sourcebaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/CRB/source/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-crb-source-$stream&arch=source&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0 - 使用下面的内容来替换掉
centos-addons.repo
文件中的所有内容:centos-addons.repo [highavailability]name=CentOS Stream $releasever - HighAvailabilitybaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/HighAvailability/$basearch/os# metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6hcountme=1enabled=0[highavailability-debuginfo]name=CentOS Stream $releasever - HighAvailability - Debugbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/HighAvailability/$basearch/debug/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-debug-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[highavailability-source]name=CentOS Stream $releasever - HighAvailability - Sourcebaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/HighAvailability/source/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-source-$stream&arch=source&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[nfv]name=CentOS Stream $releasever - NFVbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/NFV/$basearch/os# metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6hcountme=1enabled=0[nfv-debuginfo]name=CentOS Stream $releasever - NFV - Debugbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/NFV/$basearch/debug/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-debug-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[nfv-source]name=CentOS Stream $releasever - NFV - Sourcebaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/NFV/source/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-source-$stream&arch=source&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[rt]name=CentOS Stream $releasever - RTbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/RT/$basearch/os# metalink=https://mirrors.centos.org/metalink?repo=centos-rt-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6hcountme=1enabled=0[rt-debuginfo]name=CentOS Stream $releasever - RT - Debugbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/RT/$basearch/debug/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-rt-debug-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[rt-source]name=CentOS Stream $releasever - RT - Sourcebaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/RT/source/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-rt-source-$stream&arch=source&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[resilientstorage]name=CentOS Stream $releasever - ResilientStoragebaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/ResilientStorage/$basearch/os# metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6hcountme=1enabled=0[resilientstorage-debuginfo]name=CentOS Stream $releasever - ResilientStorage - Debugbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/ResilientStorage/$basearch/debug/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-debug-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[resilientstorage-source]name=CentOS Stream $releasever - ResilientStorage - Sourcebaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/ResilientStorage/source/tree/# metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-source-$stream&arch=source&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialgpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0[extras-common]name=CentOS Stream $releasever - Extras packagesbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/$releasever-stream/extras/$basearch/extras-common# metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-$stream&arch=$basearch&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512gpgcheck=1repo_gpgcheck=0metadata_expire=6hcountme=1enabled=1[extras-common-source]name=CentOS Stream $releasever - Extras packages - Sourcebaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/$releasever-stream/extras/source/extras-common# metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-source-$stream&arch=source&protocol=https,httpgpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512gpgcheck=1repo_gpgcheck=0metadata_expire=6henabled=0
相关资源
可以直接下载上述2个配置好的文件,然后将它们放到/etc/yum.repos.d/
路径中: