1. Verify that the network can connect to the Alibaba Cloud mirror
# 验证网络是否可以连接阿里云镜像
ping mirrors.aliyun.com
1.1 Check whether the ping is successful:
2 Manual configuration
2.1 Delete the original yum source
# 删除原yum源
rm -rf /etc/yum.repos.d/*
2.2 Download the Aliyun Centos-7.repo file
# wget命令下载: wget [options] [url]
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# curl命令下载: curl [options] [url]
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
2.3 Clear and generate cache
# 清除yum缓存
yum clean all
# 缓存阿里云镜像
yum makecache
3 Script layout
# 创建shell脚本文件
vi /opt/aliyun_yum.sh
Insert the following:
#!/bin/bash
# 删除原