简短回答:fetchdebian 本身是一个“下载”工具,不能直接“离线安装”,但可以用它来为离线环境准备 Debian 包。
具体说明如下:
fetchdebian(以及类似的 apt-get download、apt-offline、debmirror 等)主要用于:
.deb 包及其依赖它不会自动完成安装步骤。
如果你要在没有网络的机器上装 Debian 包,一般这样做:
# 示例:下载 nginx 及其依赖
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests \
--no-conflicts --no-breaks --no-replaces --no-enhances nginx | grep "^\w" )
或用:
apt-get install --download-only nginx
包会保存到:
/var/cache/apt/archives/
用 U 盘 / 移动硬盘把 .deb 文件拷过去。
sudo dpkg -i *.deb
# 若有依赖问题
sudo apt-get install -f
如果你想要更省事:
✅ fetchdebian 可以帮你准备离线安装所需的 deb 包
❌ 但它不能代替 dpkg / apt 在离线机器上完成安装
如果你愿意,我可以给你一个完整可复制的离线安装脚本示例。