centos7更新yum安装docker-ce使用阿里源

centos7更新yum安装docker-ce使用阿里源240209版
#!/bin/bash
##  卸载之前的docke
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine \
                  docker-ce

##  备份 /etc/yum.repos.d/CentOS-Base.repo
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.$(date "+%y%m%d%H%M%S").backup
##  更换为阿里源
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
##  安装epel
sudo yum install -y epel-release
##  使用阿里提供的epel源
sudo curl -o /etc/yum.repos.d/epel-7.repo  http://mirrors.aliyun.com/repo/epel-7.repo
##   安装yum必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
##   添加软件源信息
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
## Step 3
sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
##  清空yum缓存
sudo yum clean all
##  重建yum缓存
sudo yum makecache fast
##  安装
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
##  启用启动docker服务
sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status docker

Centos7的yum使用国内源阿里源163源等提高下载速度

02-11 09:20