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

相关推荐
君之嘞9 小时前
【操作系统基础】认识操作系统:系统调用
linux·运维·microsoft
渡我白衣9 小时前
访问文件后出现的 ~$ 文件是什么?它和缓冲机制、数据丢失有什么关系?
linux
爱倒腾的老唐9 小时前
07、Linux 文件管理
linux·运维·服务器
24zhgjx-fuhao9 小时前
基于时间的ACL
运维·网络
Raymond运维10 小时前
MySQL包安装 -- RHEL系列(离线RPM包安装MySQL)
linux·运维·数据库·mysql
-dcr10 小时前
24.grep 使用手册
linux·运维开发·grep
心灵宝贝10 小时前
libopenssl1_0_0-1.0.2p-3.49.1.x86_64安装教程(RPM包手动安装步骤+依赖解决附安装包下载)
linux·运维·服务器
tryCbest10 小时前
Windows和Linux设置Https(SSL)访问
linux·windows·https
btyzadt11 小时前
Ubuntu中安装Nuclei教程
linux·运维·ubuntu
养生技术人11 小时前
Oracle OCP认证考试题目详解082系列第45题
运维·数据库·sql·oracle·开闭原则·ocp