centos 7.4 配置阿里YUM源镜像

环境:centos 7.4

只搭建阿里源

步骤一:安装wget,已安装则跳过此步骤

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
-bash: wget: 未找到命令
[root@localhost yum.repos.d]# yum -y install wget

步骤二:移除旧YUM源

[root@localhost ~]# mkdir -p /etc/yum.repos.d/bak && mv /etc/yum.repos.d/* /etc/yum.repos.d/bak
mv: 无法将目录"/etc/yum.repos.d/bak" 移动至自身的子目录"/etc/yum.repos.d/bak/bak" 下

步骤三:下载阿里源配置

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

步骤四:清楚缓存,查看YUM源

[root@localhost ~]# yum clean all
[root@localhost ~]# yum repolist