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

相关推荐
showker4 分钟前
ecstore等产品开启缓存-后台及前台不能登录原因-setcookie+session问题
java·linux·前端
运维行者_10 分钟前
运维实战:SSL 证书故障避坑指南(精简版)
运维·网络协议·ssl
AI扶我青云志17 分钟前
AGENT 和自动化工作流的区別
运维·自动化
victory043120 分钟前
progen2 docker镜像打包命令文档
运维·docker·容器
初学者_xuan27 分钟前
零基础新手小白快速了解掌握服务集群与自动化运维(十五)Redis模块-哨兵集群
运维·redis·自动化
conkl41 分钟前
在 CentOS 系统上实现定时执行 Python 邮件发送任务完整指南
linux·运维·开发语言·python·centos·mail·邮箱
江輕木43 分钟前
VMware安装配置CentOS 7
linux·运维·centos
wydaicls1 小时前
了解一下kernel6.12中cpu_util_cfs_boost函数的逻辑
linux·开发语言
Su-RE1 小时前
[Nginx] 3.由HTTP转发引出的重定向问题
运维·nginx·http
newxtc2 小时前
【四川政务服务网-注册安全分析报告】
运维·selenium·安全·政务·安全爆破