yum源配置文件CentOS-Base.repo完整内容

1.CentOS Yum 源配置文件 CentOS-Base.repo 的完整内容示例:

以下是适用于不同版本 CentOS 系统的 CentOS-Base.repo 文件的标准模板。这些模板基于常见的国内镜像源(如阿里云、清华大学等),可以帮助解决仓库配置失败的问题。

适用于centos 7的CentOS-Base.repo:

复制代码
[base]
name=CentOS-$releasever - Base - Mirrors Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

[updates]
name=CentOS-$releasever - Updates - Mirrors Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

[extras]
name=CentOS-$releasever - Extras - Mirrors Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

[centosplus]
name=CentOS-$releasever - Plus - Mirrors Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

此配置文件使用了阿里云的镜像源。

2.适用于centos 8的CentOS-Base.repo:

复制代码
[baseos]
name=CentOS-$releasever - BaseOS - Mirrors Tuna Tsinghua
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[appstream]
name=CentOS-$releasever - AppStream - Mirrors Tuna Tsinghua
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[extras]
name=CentOS-$releasever - Extras - Mirrors Tuna Tsinghua
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[powertools]
name=CentOS-$releasever - PowerTools - Mirrors Tuna Tsinghua
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

此配置文件采用了清华大学开源软件镜像站作为镜像源。

2.通用性:

  1. 将上述内容保存为 /etc/yum.repos.d/CentOS-Base.repo 文件。

  2. 替换原有的 CentOS-Base.repo 文件后,执行以下命令刷新缓存:

    sudo yum clean all
    sudo yum makecache

相关推荐
feng14561 天前
OpenSREClaw - 故障复盘和变更评审双 Agent 案例
运维·人工智能
linux修理工1 天前
chrome官方下载地址
运维·服务器
无忧智库1 天前
IT运维正在经历一场真正的范式革命:从告警风暴到AIOps自主自愈的完整工程解构(WORD)
运维
笨笨饿1 天前
69_如何给自己手搓一个串口
linux·c语言·网络·单片机·嵌入式硬件·算法·个人开发
cn_lyg1 天前
Linux的入门级常用操作命令
linux·运维·服务器
就叫飞六吧1 天前
TOML vs YAML:为什么 Cargo 选择 TOML?
linux·运维·服务器
MiNG MENS1 天前
nginx 代理 redis
运维·redis·nginx
IMPYLH1 天前
Linux 的 test 命令
linux·运维·服务器·chrome·bash
xrui581 天前
2026实战:深度解析 Gemini 3.1 镜像站函数调用在自动化运维工单中的应用
linux·服务器·网络
HackTwoHub1 天前
Linux 内核史诗级本地提权 全网深度复现、原理完整分析( CVE-2026-31431)
linux·运维·安全·web安全·网络安全·代码审计·安全架构