Centos7系统更换yum源镜像为国内镜像教程

一、centos7 修改为网易的yum源

1.执行命令:cd /etc/yum.repos.d/
进入yum源配置目录
Centos7系统更换yum源镜像为国内镜像教程

2.执行命令:mv CentOS-Base.repo CentOS-Base.repo.bak备份服务器原有的yum源文件
Centos7系统更换yum源镜像为国内镜像教程
3.下载国内网易的yum源镜像,本文演示系统是Centos7所以下载的是网易的Centos7的yum源
Centos7系统更换yum源镜像为国内镜像教程
Centos7系统更换yum源镜像为国内镜像教程
4.执行命令:mv CentOS6-Base-163.repo CentOS-Base.repo

更换yum源配置文件
Centos7系统更换yum源镜像为国内镜像教程
5.执行命令:yum makecache 生成yum源缓存
Centos7系统更换yum源镜像为国内镜像教程
6.执行命令:yum -y update

更新yum源,等待更新完毕即可。
Centos7系统更换yum源镜像为国内镜像教程


二、centos7 修改为阿里的yum源

  1. 备份本地yum源
 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak 

2.获取阿里yum源配置文件

 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 

3.更新cache

 yum makecache 

4.安装

 yum -y update