1. 查看服务器软硬件信息
1.1 判断操作系统类型
操作系统 | 基于发行版 |
---|---|
统信 UOS | Debian |
河汉麒麟 (StartOS) | Debian |
openEuler | CentOS |
优麒麟 (Ubuntu Kylin) | Ubuntu |
中标麒麟 (Kylin) | Debian |
EulerOS | CentOS |
Deepin | Debian |
- 查看 Linux 操作系统的发行版信息
cat /etc/os-release
PRETTY_NAME="Deepin 20.1"
NAME="Deepin"
VERSION_ID="20.1"
VERSION="20.1"
ID=Deepin
HOME_URL="https://www.deepin.org/"
BUG_REPORT_URL="https://bbs.deepin.org/"
- 显示以后零碎的内核版本、主机名、内核编译工夫等详细信息
uname -a
Linux cloudstrief-PC 5.4.70-amd64-desktop #1 SMP Wed Oct 14 15:24:23 CST 2020 x86_64 GNU/Linux
- 显示以后零碎的发行版信息以及版本号等详细信息
lsb_release -a
No LSB modules are available.
Distributor ID: Deepin
Description: Deepin 20.1
Release: 20.1
Codename: n/a
- 显示以后零碎的发行版信息
cat /etc/issue
Deepin GNU/Linux 20.1 \n \l
- 查看 Linux 操作系统的内核版本信息
cat /proc/version // 它会输入一个蕴含操作系统内核版本号、编译工夫等信息的文件,其中包含内核名称、版本号、编译器版本号、架构等信息
Linux version 5.4.70-amd64-desktop (deepin@deepin-PC) (gcc version 8.3.0 (Uos 8.3.0.3-3+rebuild)) #1 SMP Wed Oct 14 15:24:23 CST 2020
1.2 判断 CPU 架构
- 查看 cpu 架构信息
uname -m
x86_64
- 查看 cpu 架构详细信息
lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 39 bits physical, 48 bits virtual
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 60
Model name: Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz
Stepping: 3
CPU MHz: 3260.809
CPU max MHz: 3600.0000
CPU min MHz: 800.0000
BogoMIPS: 6392.44
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear flush_l1d
1.3 判断是否反对 Docker 运行环境
依据下面操作系统和 cpu 架构信息断定以后国产软硬件服务器是否反对 Docker 运行环境
[外链图片转存失败, 源站可能有防盗链机制, 倡议将图片保留下来间接上传 (img-PKCl418h-1692667075077)(/media/202306/2023-06-19_161636_656091.png)]
常见的国产操作系统参考:https://www.modb.pro/osrank
2. Docker 环境装置
2.1 在线装置形式
2.1.1 基于 centOS 装置 docker
参考地址:https://docs.docker.com/engine/install/centos/
- 根底环境装置
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
- docker 装置
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- docker 启动
sudo systemctl start docker
2.1.2 基于 Debian 装置 docker
参考地址:https://docs.docker.com/engine/install/debian/
- 根底环境装置
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
buster stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- docker 装置
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
2.1.3 基于 fedora 装置 docker
参考地址:https://docs.docker.com/engine/install/fedora/
- 根底环境装置
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
- docker 装置
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- docker 启动
sudo systemctl start docker
2.1.4 基于 RHEL 装置 docker
参考地址:https://docs.docker.com/engine/install/rhel/
- 根底环境装置
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
- docker 装置
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- docker 启动
sudo systemctl start docker
2.1.5 基于 SLES 装置 docker
参考地址:https://docs.docker.com/engine/install/sles/
- 根底环境装置
sudo zypper addrepo https://download.docker.com/linux/sles/docker-ce.repo
- 装置 docker
sudo zypper install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- docker 启动
sudo systemctl start docker
2.1.6 基于 Ubuntu 装置 docker
参考地址:https://docs.docker.com/engine/install/ubuntu/
- 根底环境装置
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)"signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \"$(. /etc/os-release && echo "$VERSION_CODENAME")"stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- 装置 docker
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
2.1.7 基于 Raspbian 装置 docker
参考地址:https://docs.docker.com/engine/install/raspbian/
- 根底环境装置
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)"signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/raspbian \"$(. /etc/os-release && echo "$VERSION_CODENAME")"stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- 装置 docker
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
2.2 离线装置形式
二进制装置阐明
https://docs.docker.com/engine/install/binaries/
二进制安装包地址
https://download.docker.com/linux/static/stable
依据你的 CPU 架构类型(x86_64、aarch64 等)抉择对应的安装包
- aarch64 架构 docker 离线包文件:aarch64 架构 docker 离线包
- x86_64 架构 docker 离线包文件:x86-64 架构 docker 离线包
以后提供 aarch64 和 x86_64 架构的 docker 离线包文件,其余架构离线包请自行去二进制安装包地址下载
2.2.1 docker 装置
- 解压离线包文件
tar xzvf /path/to/<FILE>.tar.gz
- 将二进制文件挪动到可执行门路上的目录,例如
/usr/bin/
sudo cp docker/* /usr/bin/
- 启动 Docker 守护过程
sudo dockerd &
2.3 装置后操作
参考地址:https://docs.docker.com/engine/install/linux-postinstall/
2.3.1 docker 服务自启
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
2.3.2. 权限设置
sudo groupadd docker
sudo usermod -aG docker $USER
2.4 公有镜像源配置 (须要时配置)
- 创立配置文件
sudo touch /etc/docker/daemon.json
- 编辑配置文件,退出内容
sudo vim /etc/docker/daemon.json
内容
{
"insecure-registries": ["镜像源地址"]
}
按 Esc 键退出文档编辑框,而后按 shift + ; 调出命令行输出 wq 回车,保留返回终端运行页面
3. docker compose 装置
3.1 在线装置形式
参考地址:https://docs.docker.com/compose/install/linux/
- 基于 Ubuntu 和 Debian
sudo apt-get update
sudo apt-get install docker-compose-plugin
- 基于 RPM
sudo yum update
sudo yum install docker-compose-plugin
3.2 离线装置形式
3.2.1 离线包地址
离线装置文档地址:https://docs.docker.com/compose/install/standalone/
离线安装包地址:https://github.com/docker/compose/releases/
依据你的 CPU 架构类型(x86_64、aarch64 等)抉择对应的安装包
- aarch64 架构 docker compose 离线包文件:aarch64 架构 docker compose 离线包
- x86_64 架构 docker compose 离线包文件:[x86-64 架构 docker compose 离线包
](https://download.csdn.net/download/huaweichenai/88240245)
以后提供 aarch64 和 x86_64 架构的 docker compose 离线包文件,其余架构离线包请自行去安装包地址下载
3.2.2 离线装置 docker compose
sudo cp /path/to/docker-compose-linux-XXX /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose