更新CentOS默认yum源/镜像源为mirrors.aliyun.com

1、首先备份系统自带的yum源配置文件     /etc/yum.repos.d/CentOS-Base.repo

     在进行此类更改时候,先对系统默认源文件进行备份,备份是一个很好的习惯,此处如果权限不够,就使用root权限

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

 

更新CentOS默认yum源/镜像源为mirrors.aliyun.com_CentOS

 

更新CentOS默认yum源/镜像源为mirrors.aliyun.com_CentOS_02

2、进入yum源配置文件所在的文件夹

cd /etc/yum.repos.d/

3、下载aliyun的yum源配置文件到/etc/yum.repos.d/

CentOS 7:

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

更新CentOS默认yum源/镜像源为mirrors.aliyun.com_配置文件_03

4、运行yum makecache生成缓存

yum makecache

5、更新系统,运行安装rpel源命令,安装完成之后你就可以直接使用yum来安装额外的软件包

yum -y update
yum -install epel-release

更新CentOS默认yum源/镜像源为mirrors.aliyun.com_配置文件_04

更新CentOS默认yum源/镜像源为mirrors.aliyun.com_CentOS_05

更新CentOS默认yum源/镜像源为mirrors.aliyun.com_配置文件_06