在 Debian 系统下是不使用 yum 的,yum 是 RHEL / CentOS / Fedora 等 Red Hat 系列发行版的包管理工具。
在 Debian / Ubuntu 中,对应的包管理工具是:
apt / apt-getdpkgDebian 的软件源配置文件是:
/etc/apt/sources.list
以及:
/etc/apt/sources.list.d/*.list
示例(Debian 12 bookworm):
deb http://deb.debian.org/debian bookworm main
deb http://deb.debian.org/debian bookworm-updates main
deb http://security.debian.org/debian-security bookworm-security main
修改后更新:
apt update
apt install nginx
apt search nginx
apt remove nginx
apt purge nginx # 删除配置
⚠️ 不推荐,但技术上可行:
apt update
apt install yum
但注意:
.repo 文件/etc/yum.repos.d/*.repo
例如:
[centos]
name=CentOS
baseurl=http://mirror.centos.org/centos/7/os/x86_64/
enabled=1
gpgcheck=0
⚠️ 风险:
| 系统 | 包管理器 |
|---|---|
| Debian / Ubuntu | apt |
| CentOS / RHEL | yum / dnf |
✅ Debian 请用 apt,不要配置 yum
如果你是想:
可以告诉我具体需求,我可以直接帮你改写命令。