Debian 下安装与使用 fetchdebian
一 安装步骤
sudo apt update
sudo apt install -y fetchdebian
fetchdebian --version
which fetchdebian
sudo apt update 刷新索引。二 常用用法
fetchdebian vim
fetchdebian vim=2:8.2.0875-1
fetchdebian -s curl
fetchdebian -b nginx
fetchdebian -d /path/to/dir nginx
# 或
fetchdebian -o /path/to/dir nginx
fetchdebian -v git
fetchdebian -q git
fetchdebian package_name --proxy http://proxy.example.com:8080
fetchdebian package_name --mirror http://mirror.example.com/debian
while read p; do fetchdebian "$p"; done < package_list.txt
以上命令覆盖了常见的下载与离线场景,具体选项名以你安装的版本为准。
三 离线安装与依赖处理
mkdir -p /tmp/pkgs
fetchdebian -d /tmp/pkgs nginx
sudo dpkg -i /tmp/pkgs/*.deb
sudo apt-get -f install # 如有缺依赖,尝试自动补齐
apt-cache depends package_name
apt-rdepends package_name
apt-get -f install 完成配置。四 常见问题与排查
sudo apt update,再 sudo apt install -y fetchdebian;确认 $PATH 包含 /usr/bin。--mirror 指定更快镜像,或通过 --proxy 配置代理。fetchdebian --help 查看本机支持选项。sudo apt-get -f install,或在联网机用 apt-cache/apt-rdepends 预查依赖并一并下载。