CentOS7已于2024年6月30日正式停服,停服后默认的yum源已全部404无法使用,对于还在使用CentOS7系统的用户来说,无疑是一个很大的影响。

1、备份旧的yum源

在/etc/yum.repos.d/目录下创建一个bak目录,再将/etc/yum.repos.d/中的.repo源配置文件移动至bak目录中,当然如果您确定/etc/yum.repos.d/目录中的源配置没用,也可以将/etc/yum.repos.d/目录清空(rm -f /etc/yum.repos.d/*)。

mkdir -p /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/

2、配置Centos7源(x86_64架构)


吴昊在这里整理了多个Centos7国内镜像的源,任选其一即可,在Centos7停服后,默认的源已从centos改成了centos-vault,这里所有的源都是吴昊二次配置修改过的。


提供curl命令下载方式,以及wget命令下载方式,任选其一。


阿里云源(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/