在 Debian 系统里使用 yum 本身就是不合适的,因为:
所以你在 Debian 上执行 yum 通常会看到类似:
command not found
或
yum: command not found
常见操作对照:
| 功能 | yum(CentOS) | Debian 对应 |
|---|---|---|
| 安装软件 | yum install nginx |
apt install nginx |
| 更新软件源 | yum makecache |
apt update |
| 升级系统 | yum update |
apt upgrade |
| 搜索软件 | yum search nginx |
apt search nginx |
| 删除软件 | yum remove nginx |
apt remove nginx |
示例:
sudo apt update
sudo apt install nginx
只有在以下情况才需要:
那你应该:
# 进入 CentOS 容器
docker run -it centos bash
# 再使用 yum
yum install xxx
不要直接在 Debian 装 yum 来管理 Debian 系统
cat /etc/os-release
如果是:
ID=debian → 用 aptID=centos / ID=rhel → 用 yum / dnf如果你愿意,可以把 具体的 yum 报错信息贴出来,我可以帮你精准分析。