1、备份旧的yum源

在/etc/yum.repos.d/目录下创建一个bak目录,再将/etc/yum.repos.d/中的.repo源配置文件联通至bak目录中centos 7 yum 源,其实假若您确定/etc/yum.repos.d/目录中的源配置没用linux 删除文件夹,也可以将/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命令下载形式linux更改ip地址,以及wget命令下载形式centos 7 yum 源,任选其二。

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

centos 7 yum 源_配置Centos7国内镜像源_备份yum源配置文件

荆楚理工大学源(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形式)

备份yum源配置文件_配置Centos7国内镜像源_centos 7 yum 源

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/

配置Centos7国内镜像源_centos 7 yum 源_备份yum源配置文件

中国科学技术学院源(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源配置完成,可以像原先一样使用了。

5、封面图

Tagged:
Author

这篇优质的内容由TA贡献而来

刘遄

《Linux就该这么学》书籍作者,RHCA认证架构师,教育学(计算机专业硕士)。

发表回复