安装FetchDebian
更新系统并安装:
sudo apt update
sudo apt install fetchdebian
配置FetchDebian
编辑配置文件 /etc/fetchdebian.conf
(或 ~/.fetchdebianrc
):
sudo nano /etc/fetchdebian.conf
常用配置项:
mirror
:镜像源(如 https://deb.debian.org/debian/
)distribution
:Debian版本(如 buster
、bullseye
)components
:组件(如 main contrib non-free
)architectures
:架构(如 amd64
、arm64
)output
:输出目录(如 /var/cache/fetchdebian
)mirror = "https://deb.debian.org/debian/"
distribution = "bullseye"
components = "main contrib non-free"
architectures = "amd64"
output = "/var/cache/fetchdebian"
同步软件仓库
运行以下命令同步镜像:
sudo fetchdebian update
(可选)设置定期同步
编辑cron任务:
sudo crontab -e
添加定时任务(如每日凌晨2点同步):
0 2 * * * /usr/bin/fetchdebian update