提升 Debian Cobbler 安装速度的可落地方案
一 核心原则
二 配置本地 apt 源,避免外网回源
# 关闭安装器联网
d-i netcfg/enable boolean false
# 使用本地镜像
d-i mirror/country string manual
d-i mirror/http/hostname string 192.168.1.10
d-i mirror/http/directory string /cobbler/ks_mirror/debian-12-x86_64
d-i mirror/http/proxy string
# 安全与更新源也指向本地
d-i apt-setup/security_host string 192.168.1.10
d-i apt-setup/security_path string /cobbler/ks_mirror/debian-12-x86_64
# 避免安装器访问外网
d-i preseed/run string wget -O /target/etc/apt/sources.list.d/local.list \
"http://192.168.1.10/cobbler/ks_mirror/debian-12-x86_64/dists/bookworm/main/binary-amd64/Packages.gz" \
&& echo "deb [trusted=yes] http://192.168.1.10/cobbler/ks_mirror/debian-12-x86_64 bookworm main contrib non-free" \
> /target/etc/apt/sources.list.d/local.list \
&& echo "deb [trusted=yes] http://192.168.1.10/cobbler/ks_mirror/debian-12-updates bookworm-updates main contrib non-free" \
>> /target/etc/apt/sources.list.d/local.list \
&& echo "deb [trusted=yes] http://192.168.1.10/cobbler/ks_mirror/debian-12-security bookworm-security main contrib non-free" \
>> /target/etc/apt/sources.list.d/local.list
说明:
三 正确导入发行版并校验
sudo mount -o loop /path/to/debian-12-amd64.iso /mnt
sudo cobbler import --path=/mnt --name=debian-12-x86_64 --arch=amd64
sudo umount /mnt
sudo cobbler sync
sudo apt-get install -y debmirror pykickstart
sudo cobbler check
sudo cobbler sync
说明:
四 优化 PXE 与网络链路
五 进阶优化与验证