一、背景
红帽系统官方通知CentOS7.X 系统于美国时间2024年7月1日全面停止维护,导致全网的CentOS7.X 系统无法使用,需要更换yum源后即可恢复正常使用。
二、更换命令
自动更新命令
# 一键换源命令
curl -O https://file.tsyvps.com/yumcentos7.sh && chmod +x yumcentos7.sh && ./yumcentos7.sh
手动更换步骤:
1.备份现有源
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2.下载阿里云源配置文件
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
# 或者
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
3.清理并重新建立缓存
sudo yum clean all && yum makecache fast
4.验证
yum repolist