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

相关推荐
宇钶宇夕8 分钟前
西门子 S7-200 SMART PLC: 3 台电机顺启逆停控制(下篇):逆序停止与安全保障实现
运维·自动化
的小姐姐14 分钟前
RMS设备检修管理系统_HawkEye智能运维平台_璞华大数据
大数据·运维
柯一梦28 分钟前
Linux权限以及常用热键集合
linux
UNbuff_01 小时前
Linux ip 命令使用指南
linux·网络·tcp/ip
努力努力再努力wz1 小时前
【C++进阶系列】:万字详解红黑树(附模拟实现的源码)
java·linux·运维·c语言·开发语言·c++
会飞的土拨鼠呀1 小时前
Linux负载如何判断服务器的压力
linux·服务器·php
zhongwenhua5201 小时前
tina linux新增mpp程序
linux·mpp·v853
斯普信专业组1 小时前
多输入(input)多输出(output)验证
运维·服务器·网络·fluent-bit
白鹭2 小时前
apache详细讲解(apache介绍+apache配置实验+apache实现https网站)
linux·运维·apache·apache配置·apache实现https网站
Anthony_2312 小时前
MySQL的常用命令
运维·数据库·mysql·adb·docker