CentOS7停更后可用yum源配置指南

V1Panys 发布于 2025-04-29 114 次阅读


1. 备份系统原始yum源配置文件

在/etc/yum.repos.d/目录下创建一个bak目录,然后将/etc/yum.repos.d/中的.repo源配置文件移动至bak目录中

mkdir -p /etc/yum.repos.d/bak

2.配置yum源(x86_64架构)

这里整理了多个Centos7国内镜像的源,任选其一即可 在Centos7停服后,默认的源已从centos改成了centos-vault(感谢来自吴昊大佬blog.whsir.com的整理&配置)

阿里云源(curl方式)

curl -o /etc/yum.repos.d/Centos7-aliyun.repo https://mirrors.wlnmp.com/centos/Centos7-aliyun-x86_64.repo

阿里云源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-aliyun-x86_64.repo -P /etc/yum.repos.d/

网易源(curl方式)

curl -o /etc/yum.repos.d/Centos7-163.repo https://mirrors.wlnmp.com/centos/Centos7-163-x86_64.repo

网易源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-163-x86_64.repo -P /etc/yum.repos.d/

腾讯源(curl方式)

curl -o /etc/yum.repos.d/Centos7-tencent.repo https://mirrors.wlnmp.com/centos/Centos7-tencent-x86_64.repo

腾讯源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-tencent-x86_64.repo -P /etc/yum.repos.d/

中国科学技术大学源(curl方式)

curl -o /etc/yum.repos.d/Centos7-ustc.repo https://mirrors.wlnmp.com/centos/Centos7-ustc-x86_64.repo

中国科学技术大学源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-ustc-x86_64.repo -P /etc/yum.repos.d/

荆楚理工学院源(curl方式)

curl -o /etc/yum.repos.d/Centos7-jcut.repo https://mirrors.wlnmp.com/centos/Centos7-jcut-x86_64.repo

荆楚理工学院源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-jcut-x86_64.repo -P /etc/yum.repos.d/

清华源(curl方式)

curl -o /etc/yum.repos.d/Centos7-tuna.repo https://mirrors.wlnmp.com/centos/Centos7-tuna-x86_64.repo

清华源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-tuna-x86_64.repo -P /etc/yum.repos.d/

南阳理工学院源(curl方式)

curl -o /etc/yum.repos.d/Centos7-nyist.repo https://mirrors.wlnmp.com/centos/Centos7-nyist-x86_64.repo

南阳理工学院源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-nyist-x86_64.repo -P /etc/yum.repos.d/

3.配置yum源(适用于非x86架构)

阿里云源(curl方式)

curl -o /etc/yum.repos.d/Centos7-aliyun.repo https://mirrors.wlnmp.com/centos/Centos7-aliyun-altarch.repo

阿里云源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-aliyun-altarch.repo -P /etc/yum.repos.d/

网易源(curl方式)

curl -o /etc/yum.repos.d/Centos7-163.repo https://mirrors.wlnmp.com/centos/Centos7-163-altarch.repo

网易源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-163-altarch.repo -P /etc/yum.repos.d/

腾讯源(curl方式)

curl -o /etc/yum.repos.d/Centos7-tencent.repo https://mirrors.wlnmp.com/centos/Centos7-tencent-altarch.repo

腾讯源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-tencent-altarch.repo -P /etc/yum.repos.d/

中国科学技术大学源(curl方式)

curl -o /etc/yum.repos.d/Centos7-ustc.repo https://mirrors.wlnmp.com/centos/Centos7-ustc-altarch.repo

中国科学技术大学源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-ustc-altarch.repo -P /etc/yum.repos.d/

荆楚理工学院源(curl方式)

curl -o /etc/yum.repos.d/Centos7-jcut.repo https://mirrors.wlnmp.com/centos/Centos7-jcut-altarch.repo

荆楚理工学院源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-jcut-altarch.repo -P /etc/yum.repos.d/

清华源(curl方式)

curl -o /etc/yum.repos.d/Centos7-tuna.repo https://mirrors.wlnmp.com/centos/Centos7-tuna-altarch.repo

清华源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-tuna-altarch.repo -P /etc/yum.repos.d/

南阳理工学院源(curl方式)

curl -o /etc/yum.repos.d/Centos7-nyist.repo https://mirrors.wlnmp.com/centos/Centos7-nyist-altarch.repo

南阳理工学院源(wget方式)

wget https://mirrors.wlnmp.com/centos/Centos7-nyist-altarch.repo -P /etc/yum.repos.d/

4.清理缓存重建缓存

yum clean all
yum makecache

至此配置已全部完成

人间客
最后更新于 2025-05-07