Debian 没有 yum 命令,是因为 yum 是 Red Hat 系列发行版(如 RHEL、CentOS、Fedora)使用的包管理工具,而 Debian 系列(如 Debian、Ubuntu)使用的是另一套包管理体系。
下面给你详细解释一下:
.debdpkgapt-getapt常用命令示例:
apt update
apt install nginx
apt remove nginx
.rpmrpmyumdnf示例:
yum install nginx
dnf install nginx
从技术上说:
yum 是为 RPM 包系统 设计的因此:
即使强行安装 yum,也无法正常工作
| 功能 | Red Hat (yum/dnf) | Debian (apt) |
|---|---|---|
| 更新软件源 | yum makecache |
apt update |
| 安装软件 | yum install pkg |
apt install pkg |
| 删除软件 | yum remove pkg |
apt remove pkg |
| 搜索软件 | yum search pkg |
apt search pkg |
| 查看信息 | yum info pkg |
apt show pkg |
这是正常现象,不是系统坏了。
如果你看到类似错误:
bash: yum: command not found
说明你当前系统是 Debian/Ubuntu,而不是 CentOS/RHEL。
cat /etc/os-release
或:
lsb_release -a
Debian 没有 yum,是因为它属于不同的 Linux 派系,使用的是 apt/dpkg 体系,而不是 RPM/yum 体系。
如果你愿意,我也可以帮你把 yum 命令翻译成对应的 apt 命令,或者讲讲 apt / yum / dnf 的历史演变。