Linux安装软件时如何选择要安装的格式

25 阅读1分钟

以安装docker为例

官网上的描述如下:不同的平台支持不同的格式

Supported platforms

Docker provides .deb and .rpm packages for the following Linux distributions and architectures:

Platformx86_64 / amd64
Ubuntu
Debian
Red Hat Enterprise Linux (RHEL)
Fedora

确认自己的Linux发行版

在Linux服务器上运行以下命令,查看操作系统的详细信息

cat /etc/os-release

查看输出: 命令会输出多行信息,请重点关注以下两行:

  • NAME=:发行版的名称。
  • ID=:发行版的系统 ID。

[root@server ~]# cat /etc/os-release

NAME="CentOS Linux"

VERSION="7 (Core)" ID="centos"

ID_LIKE="rhel fedora"

根据上面的输入结果可知Linux服务器运行的CentOS Linux7,CentOS 属于 Red Hat 系的发行版

发行版本与软件包格式对应关系

输出示例中的 ID对应的发行版应选择的软件包格式
ubuntudebianUbuntu, Debian 等.deb
rhel, fedora, 或 centosRHEL, CentOS, Fedora 等.rpm

根据上面的对应关系可知需要使用 .rpm 格式的软件包,并通过 yum 命令来安装 Docker。