当前位置: 首页 > news >正文

《CentOS Stream 9 阿里云 yum 源修改:解锁系统更新新速度》

《CentOS Stream 9 阿里云 yum 源修改:解锁系统更新新速度》

开篇

在当今数字化飞速发展的时代,操作系统的稳定与高效至关重要。对于使用 CentOS Stream 9 的用户而言,yum 源的选择直接影响着软件包的获取速度和系统的整体性能。你是否曾因 yum 源的缓慢而苦恼,导致系统更新和软件安装过程漫长无比?别担心,今天我们就来深度剖析如何修改 CentOS Stream 9 的阿里云 yum 源,让你的系统更新如闪电般迅速!

主体

一、修改 centos.repo 文件:精心布局系统源基石

在对系统的 yum 源进行调整时,centos.repo 文件就如同系统的基石,至关重要。首先,我们要做的是备份 centos.repo 文件为 centos.repo.bak,这一步操作是为了确保在后续的修改过程中,即使出现意外情况,我们也能轻松回退到原始状态。

mv /etc/yum.repos.d/centos.repo /etc/yum.repos.d/centos.repo.bak
vim  /etc/yum.repos.d/centos.repo 

接下来,我们将以下精心配置的内容粘贴到 centos.repo 文件中。这些配置涵盖了多个不同的软件源,每个源都有其独特的作用。

[baseos]
name=CentOS Stream $releasever - BaseOS
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1

[baseos-debug]
name=CentOS Stream $releasever - BaseOS - Debug
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[baseos-source]
name=CentOS Stream $releasever - BaseOS - Source
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/source/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[appstream]
name=CentOS Stream $releasever - AppStream
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1

[appstream-debug]
name=CentOS Stream $releasever - AppStream - Debug
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[appstream-source]
name=CentOS Stream $releasever - AppStream - Source
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[crb]
name=CentOS Stream $releasever - CRB
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=0

[crb-debug]
name=CentOS Stream $releasever - CRB - Debug
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/$basearch/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[crb-source]
name=CentOS Stream $releasever - CRB - Source
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/source/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

二、修改 centos - addons.repo 文件:完善系统源拼图

同样,centos - addons.repo 文件也是我们不能忽视的关键一环。我们先对其进行备份,以确保操作的安全性。

mv /etc/yum.repos.d/centos-addons.repo /etc/yum.repos.d/centos-addons.repo.bak
vim /etc/yum.repos.d/centos-addons.repo 

然后,将以下详细配置信息粘贴进去:

[highavailability]
name=CentOS Stream $releasever - HighAvailability
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/HighAvailability/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=0

[highavailability-debug]
name=CentOS Stream $releasever - HighAvailability - Debug
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/HighAvailability/$basearch/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[highavailability-source]
name=CentOS Stream $releasever - HighAvailability - Source
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/HighAvailability/source/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[nfv]
name=CentOS Stream $releasever - NFV
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/NFV/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=0

[nfv-debug]
name=CentOS Stream $releasever - NFV - Debug
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/NFV/$basearch/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[nfv-source]
name=CentOS Stream $releasever - NFV - Source
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/NFV/source/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[rt]
name=CentOS Stream $releasever - RT
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/RT/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=0

[rt-debug]
name=CentOS Stream $releasever - RT - Debug
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/RT/$basearch/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[rt-source]
name=CentOS Stream $releasever - RT - Source
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/RT/source/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[resilientstorage]
name=CentOS Stream $releasever - ResilientStorage
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/ResilientStorage/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=0

[resilientstorage-debug]
name=CentOS Stream $releasever - ResilientStorage - Debug
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/ResilientStorage/$basearch/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[resilientstorage-source]
name=CentOS Stream $releasever - ResilientStorage - Source
baseurl=http://mirrors.aliyun.com/centos-stream/$stream/ResilientStorage/source/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

[extras-common]
name=CentOS Stream $releasever - Extras packages
baseurl=http://mirrors.aliyun.com/centos-stream/SIGs/$stream/extras/$basearch/extras-common/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1

[extras-common-source]
name=CentOS Stream $releasever - Extras packages - Source
baseurl=http://mirrors.aliyun.com/centos-stream/SIGs/$stream/extras/source/extras-common/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0

三、清理并重建 yum 缓存:焕新系统源活力

最后,我们需要清理并重建 yum 缓存,这一步就像是给系统源注入新的活力,让我们刚刚修改的配置能够生效。

wget https://mirrors.aliyun.com/epel/epel-next-release-latest-9.noarch.rpm
wget https://mirrors.aliyun.com/epel/epel-release-latest-9.noarch.rpm
yum -y install epel-next-release-latest-9.noarch.rpm
yum -y install epel-release-latest-9.noarch.rpm
yum clean all && yum makecache

通过以上一系列精心操作,我们成功地将 CentOS Stream 9 的 yum 源修改为阿里云 yum 源。这不仅能显著提升系统更新和软件安装的速度,还能确保软件包的来源可靠。在数字化的浪潮中,让我们紧跟时代步伐,充分利用阿里云的强大资源,为我们的系统性能注入新的活力。同时,这也为我们后续的系统维护和优化奠定了坚实的基础。你是否已经迫不及待地想要尝试一下呢?

相关文章:

  • Unity百游修炼(3)——Tank_Battle(双人对战)详细制作全流程
  • Vue纷争:DefineProps 的作用是否因为DefineModel而减弱
  • 日语学习-日语知识点小记-构建基础-JLPT-N4N5阶段(12):普通(ふつう)形 :变化方式 :日常朋友家人之间对话
  • 基于SpringBoot + Spring AI + Vue的全栈AI对话系统开发全流程解析
  • 使用uniapp内置组件webview消息传递
  • Zookeeper(67) Zookeeper在HBase中的应用是什么?
  • MySQL进阶04-MVCC实现原理
  • Unity中动态切换光照贴图的方法
  • 京准电钟解读:为何不能用网络上的NTP时间源服务器
  • leetcode 1472. 设计浏览器历史记录 中等
  • 数据存储:一文掌握存储数据到MongoDB详解
  • 【PyTorch][chapter-33][transformer-5] MHA MQA GQA, KV-Cache
  • Sublime Text4安装、汉化
  • WordPress网站502错误全面排查与解决指南
  • prometheus部署和告警设置
  • (十)趣学设计模式 之 外观模式!
  • 【计算机网络】IP协议
  • 飞鱼科技游戏策划岗内推
  • PydanticToolsParser 工具(tool call)把 LLM 生成的文本转成结构化的数据(Pydantic 模型)过程中遇到的坑
  • 第一章 SQL简介
  • 松原公司做网站的流程/磁力bt种子搜索
  • 政府制作网站收费标准/seo草根博客
  • 网站建设建议/理发美发培训学校
  • 石龙镇仿做网站/优化设计答案四年级上册语文
  • 中央疫情二十条措施最新/免费seo软件
  • 长沙招聘网58同城/seo搜索是什么