Debian 环境下使用 Cobbler 批量部署
一 架构与准备
二 安装与基础配置
sudo apt-get update && sudo apt-get install -y cobbler cobbler-web dhcp3-server tftpd-hpa xinetd debmirrorserver 与 next_server 为 Cobbler 服务器地址(如 192.168.1.2)manage_dhcp=1、manage_dns=1(若使用 Bind)default_password_crypted,可用 openssl passwd -1 生成哈希sudo systemctl enable --now tftpd-hpa(或确保 xinetd 正确配置并启用)sudo cobbler sync;随后重启相关服务(cobblerd/dhcp/tftp)。三 导入镜像与准备引导
sudo mount -o loop /debian-12.11.0-amd64-DVD-1.iso /mnt/debiansudo cobbler import --path=/mnt/debian --name=debian12.11cobbler distro list、cobbler profile listwget -O /root/debian12.11-netboot.gz https://mirrors.ustc.edu.cn/debian/dists/stable/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gzcat /var/www/cobbler/distro_mirror/debian12.11/install.amd/initrd.gz /root/debian12.11-netboot.gz > /var/www/cobbler/pub/debian12.11-netboot.gzcobbler distro edit --name debian12.11-x86_64 --initrd /var/www/cobbler/pub/debian12.11-netboot.gzinitrd.gz 并非为 PXE 场景准备,直接使用常导致安装器无法拉取所需组件,需按上述方式拼接 Netboot 版本。四 自动化应答与批量主机配置
d-i debian-installer/locale string en_US、d-i keyboard-configuration/xkb-keymap select usd-i passwd/root-login boolean trued-i passwd/make-user boolean falsed-i passwd/root-password password YourStrongPass!d-i passwd/root-password-again password YourStrongPass!d-i netcfg/choose_interface select autod-i mirror/country string manuald-i mirror/http/hostname string mirrors.tuna.tsinghua.edu.cnd-i mirror/http/directory string /debiand-i apt-setup/security_host string mirrors.tuna.tsinghua.edu.cnd-i apt-setup/security_path string /debian-securityd-i apt-setup/security_suite string bookworm-securitycobbler profile add --name=debian12.11-auto --distro=debian12.11-x86_64 --kickstart=/var/lib/cobbler/templates/bookworm.seedcobbler system add --name=node01 --mac=00:11:22:33:44:55 --profile=debian12.11-auto --ip-address=192.168.1.101 --subnet=255.255.255.0 --gateway=192.168.1.1 --interface=eth0 --static=1 --hostname=node01.example.com --name-servers="8.8.8.8 1.1.1.1"cobbler system edit --name=node01 --netboot-enabled=truecobbler sync(每次新增或修改 System/Profile/Distro 后均需执行)。五 部署与扩容及常见问题
next-server 与 filename "pxelinux.0" 正确。