1.yum update保持yum最新状态
yum update
2.使用官方脚本自动安装docker,安装为最新版本
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
发生报错的话参考下面配置yum:
Error: Failed to download metadata for repo ‘epel-archive’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
这个问题是因为centos8已经停止相关依赖更新,需要重新配置yum源
配置yum
1先备份源文件夹,可选
mv /etc/yum.repos.d /etc/yum.repos.d.bak
2 创建源文件目录
mkdir -p /etc/yum.repos.d
3 下载新的yum源,使用阿里云配置
1|curl https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo > /etc/yum.repos.d/Centos-vault-8.5.2111.repo
2|curl https://mirrors.aliyun.com/repo/epel-archive-8.repo > /etc/yum.repos.d/epel-archive-8.repo
4 重建缓存
yum clean all && yum makecache
5重新执行第二步的官方安装脚本