在 Debian / Ubuntu 等系统里,yum 本来就不应该使用,因为:
所以你在 Debian 上运行 yum 报错是正常现象。
sudo apt update
sudo apt install 软件名
例如:
sudo apt install nginx
| yum 命令 | apt 命令 |
|---|---|
| yum install xxx | apt install xxx |
| yum remove xxx | apt remove xxx |
| yum update | apt update && apt upgrade |
| yum search xxx | apt search xxx |
| yum list installed | dpkg -l |
| yum clean all | apt clean |
直接卸载即可:
sudo apt remove yum
检查系统:
cat /etc/os-release
根据系统自动选择:
if [ -f /etc/redhat-release ]; then
yum install xxx
else
apt install xxx
fi
yum: command not found说明:
✅ 解决:用 apt
This system is not registered说明:
✅ 解决:换 apt
Debian 上不要折腾 yum,直接用 apt。
如果你愿意,可以把具体报错信息或你想安装的软件发出来,我可以帮你写对应的 apt 命令。