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/bakmv /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 allyum makecache
此时CentOS7的yum源配置完成,可以像原来一样使用了。
还没有评论,来说两句吧...