Centos7修改yum源

修改yum源

什么是yum源?

下载安装软件的仓库

需要使用阿里云的仓库,下载软件包

CentOS-Base.repo:CentOS系统的所有基础安装包

epel.repo:CentOS系统的扩展安装包

# 1.进入yum源存放的目录
[root@web02 ~]# cd /etc/yum.repos.d/

# 2.删除yum源存放目录中的所有文件
[root@web02 yum.repos.d]# rm -fr /etc/yum.repos.d/*

# 3.使用阿里云的源(先修改基础源:Base源)
## 如果有wget命令就用下面的方式
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

## 如果没有wget命令就使用curl
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

# 4.安装完base源,我们就可以安装wget命令
[root@web02 yum.repos.d]# yum install -y wget

# 5.使用阿里云的epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo