1.安装基本工具 wget
[root@localhost ~]# yum install -y wget
2.进入存放 yum 源配置的目录
[root@localhost ~]# cd /etc/yum.repos.d/
3.创建目录,用来存放系统自带的 yum 源配置文件
[root@localhost yum.repos.d]# mkdir backup
4.对系统初始默认源配置文件进行备份
[root@localhost yum.repos.d]# mv C* backup/
5.下载阿里云yum源
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CenOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
6.清除旧缓存
[root@localhost ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up list of fastest mirrors
7.创建新缓存
[root@localhost ~]# yum makecache
8.安装必要的软件包
[root@localhost ~]# yum -y install vim tree nmap sysstat gcc gcc-c++ make telnet
至此,Centos 7 设置使用阿里云镜像做 yum 源完毕!