Centos服务器相关
CENTOS8离线安装DOCKER
2021-08-12 560 2
简介 CENTOS8离线安装DOCKER
查看系统版本
cat /etc/redhat-release
首先在另一台有网的机器上,yum在线安装docker之前修改yum的配置文件;
yum默认是不会保留安装包的,然后修改yum的配置文件 /etc/yum.conf 把 keepcache=1;
yum 安装的依赖包、服务包,都在 cachedir=/var/cache/yum/$basearch/$releasever 下面,此目录可以在yum的配置文件中修改;
然后用 find /var/cache/yum/ -name "*.rpm" 找出所需的安装包和依赖包下载打包到离线机器上安装即可。
具体的目录 可以不一样,如CENTOS8中 find /var/cache/ -name "*.rpm"
安装docker的rpm包
=======================本处为YUM在线安装方式==========================
[root@master /]# yum install -y docker-ce-3:20.10.8-3.el8
Docker CE Stable - x86_64 19 kB/s | 15 kB 00:00
依赖关系解决。
====================================================================
软件包 架构 版本 仓库 大小
====================================================================
安装:
docker-ce x86_64 3:20.10.8-3.el8 docker-ce-stable 22 M
安装依赖关系:
container-selinux noarch 2:2.162.0-1.module_el8.4.0+830+8027e1c4 52 k
containerd.io x86_64 1.4.9-3.1.el8 docker-ce-stable 30 M
docker-ce-cli x86_64 1:20.10.8-3.el8 docker-ce-stable 29 M
docker-ce-rootless-extras x86_64 20.10.8-3.el8 docker-ce-stable 4.6 M
docker-scan-plugin x86_64 0.8.0-3.el8 docker-ce-stable 4.2 M
fuse-overlayfs x86_64 1.4.0-3.module_el8.4.0+830+8027e1c4 72 k
fuse3 x86_64 3.2.1-12.el8 baseos 50 k
fuse3-libs x86_64 3.2.1-12.el8 baseos 94 k
libcgroup x86_64 0.41-19.el8 baseos 70 k
libslirp x86_64 4.3.1-1.module_el8.4.0+575+63b40ad7 69 k
slirp4netns x86_64 1.1.8-1.module_el8.4.0+641+6116a774 51 k
事务概要
===================================================================
安装 12 软件包
准备中 : 1/1
安装 : docker-scan-plugin-0.8.0-3.el8.x86_64 1/12
运行脚本: docker-scan-plugin-0.8.0-3.el8.x86_64 1/12
安装 : docker-ce-cli-1:20.10.8-3.el8.x86_64 2/12
运行脚本: docker-ce-cli-1:20.10.8-3.el8.x86_64 2/12
运行脚本: container-selinux-2:2.162.0-1.module_el8.4.0+830+8027e1c4.n 3/12
安装 : container-selinux-2:2.162.0-1.module_el8.4.0+830+8027e1c4.n 3/12
运行脚本: container-selinux-2:2.162.0-1.module_el8.4.0+830+8027e1c4.n 3/12
安装 : containerd.io-1.4.9-3.1.el8.x86_64 4/12
运行脚本: containerd.io-1.4.9-3.1.el8.x86_64 4/12
运行脚本: libcgroup-0.41-19.el8.x86_64 5/12
安装 : libcgroup-0.41-19.el8.x86_64 5/12
运行脚本: libcgroup-0.41-19.el8.x86_64 5/12
安装 : fuse3-libs-3.2.1-12.el8.x86_64 6/12
运行脚本: fuse3-libs-3.2.1-12.el8.x86_64 6/12
安装 : fuse3-3.2.1-12.el8.x86_64 7/12
安装 : fuse-overlayfs-1.4.0-3.module_el8.4.0+830+8027e1c4.x86_64 8/12
运行脚本: fuse-overlayfs-1.4.0-3.module_el8.4.0+830+8027e1c4.x86_64 8/12
安装 : libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64 9/12
安装 : slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64 10/12
安装 : docker-ce-rootless-extras-20.10.8-3.el8.x86_64 11/12
运行脚本: docker-ce-rootless-extras-20.10.8-3.el8.x86_64 11/12
安装 : docker-ce-3:20.10.8-3.el8.x86_64 12/12
运行脚本: docker-ce-3:20.10.8-3.el8.x86_64 12/12
运行脚本: container-selinux-2:2.162.0-1.module_el8.4.0+830+8027e1c4.n 12/12
运行脚本: docker-ce-3:20.10.8-3.el8.x86_64 12/12
验证 : container-selinux-2:2.162.0-1.module_el8.4.0+830+8027e1c4.noarch 1/12
验证 : fuse-overlayfs-1.4.0-3.module_el8.4.0+830+8027e1c4.x86_64 2/12
验证 : libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64 3/12
验证 : slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64 4/12
验证 : fuse3-3.2.1-12.el8.x86_64 5/12
验证 : fuse3-libs-3.2.1-12.el8.x86_64 6/12
验证 : libcgroup-0.41-19.el8.x86_64 7/12
验证 : containerd.io-1.4.9-3.1.el8.x86_64 8/12
验证 : docker-ce-3:20.10.8-3.el8.x86_64 9/12
验证 : docker-ce-cli-1:20.10.8-3.el8.x86_64 10/12
验证 : docker-ce-rootless-extras-20.10.8-3.el8.x86_64 11/12
验证 : docker-scan-plugin-0.8.0-3.el8.x86_64 12/12
Installed products updated.
已安装:
container-selinux-2:2.162.0-1.module_el8.4.0+830+8027e1c4.noarch
containerd.io-1.4.9-3.1.el8.x86_64
docker-ce-3:20.10.8-3.el8.x86_64
docker-ce-cli-1:20.10.8-3.el8.x86_64
docker-ce-rootless-extras-20.10.8-3.el8.x86_64
docker-scan-plugin-0.8.0-3.el8.x86_64
fuse-overlayfs-1.4.0-3.module_el8.4.0+830+8027e1c4.x86_64
fuse3-3.2.1-12.el8.x86_64
fuse3-libs-3.2.1-12.el8.x86_64
libcgroup-0.41-19.el8.x86_64
libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64
slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64
完毕!
============离线安装方式=======================
将上述文件复制到目标机器上的指定目录当中,指行下列操作
[root@master mybak]# ll
总用量 273892
-rw-r--r--. 1 root root 31313020 8月 12 16:34 containerd.io-1.4.9-3.1.el8.x86_64.rpm
-rw-r--r--. 1 root root 52919 8月 12 16:34 container-selinux-2.162.0-1.module_el8.4.0+830+8027e1c4.noarch.rpm
-rw-r--r--. 1 root root 23086256 8月 12 16:34 docker-ce-20.10.8-3.el8.x86_64.rpm
-rw-r--r--. 1 root root 30760852 8月 12 16:34 docker-ce-cli-20.10.8-3.el8.x86_64.rpm
-rw-r--r--. 1 root root 4844664 8月 12 16:34 docker-ce-rootless-extras-20.10.8-3.el8.x86_64.rpm
-rw-r--r--. 1 root root 4377116 8月 12 16:34 docker-scan-plugin-0.8.0-3.el8.x86_64.rpm
-rw-r--r--. 1 root root 51396 8月 12 16:34 fuse3-3.2.1-12.el8.x86_64.rpm
-rw-r--r--. 1 root root 96540 8月 12 16:34 fuse3-libs-3.2.1-12.el8.x86_64.rpm
-rw-r--r--. 1 root root 74099 8月 12 16:34 fuse-overlayfs-1.4.0-3.module_el8.4.0+830+8027e1c4.x86_64.rpm
-rw-r--r--. 1 root root 185516505 8月 6 15:41 jdk-8u141-linux-x64.tar.gz
-rw-r--r--. 1 root root 71256 8月 12 16:34 libcgroup-0.41-19.el8.x86_64.rpm
-rw-r--r--. 1 root root 70675 8月 12 16:34 libslirp-4.3.1-1.module_el8.4.0+575+63b40ad7.x86_64.rpm
-rw-r--r--. 1 root root 52427 8月 12 16:34 slirp4netns-1.1.8-1.module_el8.4.0+641+6116a774.x86_64.rpm
-rw-r--r--. 1 root root 73180 8月 12 16:34 yum-utils-4.0.18-4.el8.noarch.rpm
[root@master mybak]# rpm -Uvh *.rpm --nodeps --force
警告:containerd.io-1.4.9-3.1.el8.x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 621e9f35: NOKEY
警告:container-selinux-2.162.0-1.module_el8.4.0+830+8027e1c4.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY
Verifying... ################################# [100%]
准备中... ################################# [100%]
正在升级/安装...
1:docker-scan-plugin-0:0.8.0-3.el8 ################################# [ 8%]
2:docker-ce-cli-1:20.10.8-3.el8 ################################# [ 15%]
3:container-selinux-2:2.162.0-1.mod################################# [ 23%]
4:containerd.io-1.4.9-3.1.el8 ################################# [ 31%]
5:libslirp-4.3.1-1.module_el8.4.0+5################################# [ 38%]
6:slirp4netns-1.1.8-1.module_el8.4.################################# [ 46%]
7:libcgroup-0.41-19.el8 ################################# [ 54%]
8:fuse3-libs-3.2.1-12.el8 ################################# [ 62%]
9:fuse3-3.2.1-12.el8 ################################# [ 69%]
10:fuse-overlayfs-1.4.0-3.module_el8################################# [ 77%]
11:docker-ce-rootless-extras-0:20.10################################# [ 85%]
12:docker-ce-3:20.10.8-3.el8 ################################# [ 92%]
13:yum-utils-4.0.18-4.el8 ################################# [100%]
[root@master mybak]#
--nodeps就是安装时不检查依赖关系,
比如你这个rpm需要A,但是你没装A,这样你的包就装不上,用了--nodeps你就能装上了。
--force就是强制安装,比如你装过这个rpm的版本1,如果你想装这个rpm的版本2,
就需要用--force强制安装
设置DOCKER开机运行
systemctl start docker.service
systemctl enable docker.service
查看DOCKER状态
systemctl status docker.service