温馨提示×

如何靠fetchdebian下debian包

小樊
52
2026-10-11 09:09:58
栏目: 智能运维

你提到的 fetchdebian 可能是指 在 Debian / Ubuntu 等系统中,通过 apt / apt-get 下载 .deb 安装包(而不立即安装),或者是某个具体工具(如 fetch-debian 脚本)。下面我分几种常见情况说明。


一、用 apt 下载 Debian 包(最常用)

1️⃣ 只下载不安装

sudo apt download 包名

例如:

apt download curl

会在当前目录生成:

curl_*.deb

2️⃣ 下载并包含所有依赖(推荐)

apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests \
  --no-conflicts --no-breaks --no-replaces --no-enhances 包名 | grep "^\w")

或者更简单一点(不递归依赖):

apt-get install --download-only 包名

下载位置:

/var/cache/apt/archives/

3️⃣ 使用 apt-rdepends(需要安装)

sudo apt install apt-rdepends
apt-rdepends -d 包名 | grep -v "^ " | xargs apt download

二、使用 dpkg + apt 离线方案

在有网络的机器:

apt-get install --reinstall --download-only 包名
cp /var/cache/apt/archives/*.deb /tmp/debs/

在无网络的机器:

sudo dpkg -i /path/to/*.deb
sudo apt -f install

三、如果是 fetch-debian 工具(或脚本)

有些项目会提供类似:

fetch-debian package_name

如果是这种情况,请提供:

  • 工具来源(GitHub?文档链接?)
  • 报错信息

我可以给你精确命令。


四、从 Debian 官网手动下载(无需 apt)

直接访问:

  • https://packages.debian.org/
  • https://snapshot.debian.org/

搜索包名 → 选择架构 → 下载 .deb


如果你能告诉我: ✅ 是 在线还是离线 ✅ 是否要 依赖一起下 ✅ 用的系统(Debian / Ubuntu / 其他)

我可以给你一键脚本。

0 踩