CentOS7停服后yum源配置指南

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国内镜像的源,任选其一即可,提供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/

荆楚理工学院源(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、配置Centos7源

只要当前不是x86_64架构的,都使用以下配置,适用于aarch64、i386、ppc64等!

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

附:Centos7-aliyun.repo配置文件内容(非x86_64架构系统),配置文件通过$basearch变量自动识别系统架构。

4、清理缓存重建缓存

yum clean all
yum makecache

此时CentOS7的yum源配置完成,可以像原来一样使用了。

posted @   吕振江  阅读(5552)  评论(3编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
浏览器标题切换
浏览器标题切换end
点击右上角即可分享
微信分享提示

目录导航