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

相关推荐
namehu1 小时前
阿里云 acme.sh install timeout(超时)问题解析与解决方案
linux·前端·https
南极浮冰2 小时前
【无标题】
linux·人工智能·python
小孙姐2 小时前
Linux-Day02.Linux指令
linux·运维·服务器
@BreCaspian2 小时前
Kazam产生.movie.mux后恢复视频为.mp4
linux·ubuntu·音视频
搞不懂语言的程序员2 小时前
Linux Epool的作用
linux·服务器
jzy37112 小时前
主机管理优化方案:安全加固、资源整合与跨团队协作
linux·tomcat
Neng_Miao2 小时前
文件与目录操作命令
linux·运维
倔强的石头1063 小时前
【Linux指南】软件安装全解析:从源码到包管理器的进阶之路
linux·运维·服务器
爱地球的曲奇3 小时前
Linux环境下(Ubuntu)Fortran语言如何安装配置NetCDF
linux·ubuntu·netcdf
freshman_y3 小时前
15个命令上手Linux!
linux·运维·服务器