下面给你一个**在 Debian 上用 Cobbler 批量装机(PXE 自动安装)**的实战流程,适合从零开始。以 Debian 11/12 + Cobbler 3.x 为例。
sudo apt update
sudo apt install -y cobbler cobbler-web tftp tftp-hpa xinetd \
isc-dhcp-server apache2 debmirror
有些 Debian 版本 cobbler 在 backports 中,可自行启用。
编辑 /etc/cobbler/settings.yaml(或 .yaml 新版):
server: 192.168.1.10
next_server: 192.168.1.10
manage_dhcp: 1
manage_tftp: 1
pxe_just_once: 1
server和next_server改成你的 Cobbler IP
编辑 /etc/cobbler/dhcp.template:
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option domain-name-servers 8.8.8.8;
range 192.168.1.100 192.168.1.200;
}
然后:
cobbler sync
mount -o loop debian-12-amd64-DVD-1.iso /mnt
cobbler import --path=/mnt --name=debian12 --arch=x86_64
查看:
cobbler distro list
/var/lib/cobbler/kickstarts/debian12.seed
d-i debian-installer/locale string en_US
d-i keyboard-configuration xkb-keymap select us
d-i netcfg/get_hostname string debian
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.de.debian.org
d-i mirror/http/directory string /debian
d-i partman-auto/method string lvm
d-i partman-auto/choose_recipe select atomic
d-i passwd/root-password password rootpw
d-i passwd/root-password-again password rootpw
d-i finish-install/reboot_in_progress note
cobbler profile add \
--name=debian12-auto \
--distro=debian12-x86_64 \
--kickstart=/var/lib/cobbler/kickstarts/debian12.seed
cobbler system add \
--name=node01 \
--profile=debian12-auto \
--mac=00:11:22:33:44:55
systemctl enable --now cobblerd
systemctl enable --now apache2
systemctl enable --now tftpd-hpa
cobbler sync
debian12-autonext_server 不一致cobbler sync
systemctl restart tftpd-hpa
preseed 不完整,需补全模块
cobbler web 管理ansible 做装后初始化如果你愿意,我可以:
你现在是 BIOS 还是 UEFI?装机规模大概多少台?