前言
公司最近需要把所有服务全部部署到麒麟服务器上,其中包含各种服务器:nginx、redis、emqx、influxDB、kafka、zookeeper、minio、mysql以及各个应用等。
我淋过雨,所以我也想为别人撑伞。网上关于 arm64 系统的资料很少,耗费了很多时间试错。所以把这类的东西全部总结写下来,希望对后面的同学有所帮助
一、准备工作
(因为是第一次安装这玩意儿,尽量使用root账号,避免操作的时候碰到一些权限问题)
2、查看操作系统版本
[root@ArmServer docker]# uname -a
Linux ArmServer.XHKJ 4.19.90-24.4.v2101.ky10.aarch64 #1 SMP Mon May 24 14:45:37 CST 2021 aarch64 aarch64 aarch64 GNU/Linux
[root@ArmServer docker]# cat /proc/version
Linux version 4.19.90-24.4.v2101.ky10.aarch64 (KYLINSOFT@localhost.localdomain) (gcc version 7.3.0 (GCC)) #1 SMP Mon May 24 14:45:37 CST 2021
3、查看操作系统架构
[root@ArmServer docker]# uname -m
aarch64
二、安装docker
下载地址:https://download.docker.com/linux/static/stable/
选择系统架构对应的文件目录:aarch64
(我目前使用的docker版本是:docker-20.10.7.tgz)
2、下载 docker-compose离线包
2.1、下载地址:https://github.com/docker/compose/releases
选择对应系统架构的离线安装包
(我目前使用的版本是:v2.17.2)
2.2、 Github的链接有时候可能访问不了,所以我自己建了个链接,有需要的自行下载(免费)https://download.csdn.net/download/qq_34725844/88633719
3、准备 docker.service系统配置文件
(复制以下内容保存为 docker.service 文件)
docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
4、安装 docker 和 docker compose 离线包
# 解压 docker 到当前目录
tar -xvf docker-20.10.7.tgz
# 将 docker 文件移动到 /usr/bin 目录下
cp -p docker/* /usr/bin
# 将 docker-compose 文件复制到 /usr/local/bin/ 目录下,并重命名为 docker-compose
cp docker-compose-linux-aarch64 /usr/local/bin/docker-compose
# 设置 docker-compose 文件权限
chmod +x /usr/local/bin/docker-compose
# 将 docker.service 移到 /etc/systemd/system/ 目录
cp docker.service /etc/systemd/system/
# 设置 docker.service 文件权限
chmod +x /etc/systemd/system/docker.service
# 重新加载配置文件
systemctl daemon-reload
# 启动docker
systemctl start docker
# 设置 docker 开机自启
systemctl enable docker.service
4.2、验证安装是否成功
4.2.1查看 docker 版本
[root@ArmServer bin]# docker -v
Docker version 20.10.7, build f0df350
4.2.2查看docker-compose 版本
[root@ArmServer bin]# docker-compose -v
Docker Compose version v2.17.2