FetchDebian可通过APT包管理器(推荐,简单快捷)或手动编译(适用于无APT环境的场景)安装。
打开终端,依次执行以下命令更新APT源列表并安装FetchDebian:
sudo apt update
sudo apt install fetchdebian
安装完成后,通过fetchdebian --version验证是否成功安装。
若APT源中无FetchDebian,可从GitHub克隆仓库手动编译:
git clone https://github.com/fetchdebian/fetchdebian.git
cd fetchdebian
sudo apt install build-essential git python3-pip # 安装依赖
./autogen.sh && ./configure && make
sudo make install
安装完成后,同样用fetchdebian --version验证。
FetchDebian的核心功能包括下载镜像和管理软件包,以下是常见操作:
使用list命令查看所有支持的Debian版本(如buster、bullseye)及对应架构(amd64、arm64):
fetchdebian list
通过search命令查找指定版本的镜像(如“buster”代表Debian 11):
fetchdebian search buster
download命令,格式为<版本> <架构>:fetchdebian download buster amd64
latest命令,指定架构即可:fetchdebian latest amd64
iso命令,格式同“download”:fetchdebian iso buster amd64
FetchDebian也可用于下载Debian软件包(二进制文件或源代码):
fetchdebian vim
-s或--source选项:fetchdebian -s vim
-v或--version指定版本:fetchdebian -v vim=2:8.2-1
-o或--output设置保存路径:fetchdebian -o ~/downloads vim
-m或--mirror指定镜像URL(如国内清华镜像):fetchdebian -m https://mirrors.tuna.tsinghua.edu.cn/debian/ vim
通过配置文件可定制FetchDebian的默认行为,避免每次输入重复参数。
~/.fetchdebianrc(仅当前用户生效)/etc/fetchdebian.conf(所有用户生效)编辑配置文件(如sudo nano /etc/fetchdebian.conf),添加以下内容:
[mirror]
url = https://deb.debian.org/debian/ # 默认镜像源
[distribution]
name = Debian
codename = bullseye # 默认下载版本
[components]
main = true
contrib = true
non-free = true # 是否包含contrib/non-free组件
[download]
output = /var/cache/fetchdebian # 默认下载目录
threads = 4 # 下载线程数(提升速度)
保存后,FetchDebian会自动应用这些配置。
sha256sum命令验证校验和(FetchDebian会生成.sha256文件):sha256sum /path/to/debian.iso
将输出与官方提供的校验和对比,确保文件未被篡改。export http_proxy=http://proxy.example.com:8080设置代理(临时生效),或修改配置文件中的mirror选项为可访问的镜像源。sudo apt install -f自动解决依赖关系。