在 Debian 上使用 Cobbler 建立(导入)系统镜像,一般分为 安装 Cobbler → 配置 → 导入镜像 → 定义 profile/system → 测试安装 几个步骤。下面以 Debian 11/12 + Cobbler 3.x 为例说明。
sudo apt update
sudo apt install cobbler cobbler-web rsync debmirror apache2 tftp tftpd-hpa -y
启动服务:
systemctl enable --now cobblerd
systemctl enable --now apache2
systemctl enable --now tftp
编辑:
/etc/cobbler/settings.yaml
关键项(示例):
server: 192.168.1.10
next_server: 192.168.1.10
manage_dhcp: 1
manage_tftp: 1
server和next_server改成你的 Cobbler 服务器 IP
启用 Cobbler 管理 DHCP:
/etc/cobbler/settings.yaml
manage_dhcp: true
编辑 DHCP 模板:
/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
mkdir -p /mnt/debian
mount -o loop debian-12.4.0-amd64-DVD-1.iso /mnt/debian
cobbler import \
--path=/mnt/debian \
--name=debian12 \
--arch=amd64
导入完成后查看:
cobbler distro list
cobbler profile list
debmirror \
--arch=amd64 \
--dist=bookworm \
--section=main \
--method=http \
--root=/debian \
/var/www/debian
然后导入目录:
cobbler import --path=/var/www/debian --name=debian12
查看:
cobbler profile report
如需自定义 kickstart(preseed):
cobbler profile edit \
--name=debian12-x86_64 \
--kickstart=/var/lib/cobbler/kickstarts/debian.preseed
Debian 使用 preseed 而不是 kickstart(RedHat 系)
示例 preseed 片段:
d-i passwd/user-fullname string Debian User
d-i passwd/username string debian
d-i passwd/user-password password debian
d-i passwd/user-password-again password debian
cobbler system add \
--name=node01 \
--profile=debian12-x86_64 \
--mac=52:54:00:11:22:33 \
--ip-address=192.168.1.101
同步:
cobbler sync
systemctl status tftpd-hpa
https://IP/cobbler_web
默认用户:cobbler
不要写 kickstart,否则安装失败
如果你需要:
可以继续问我,我可以给你具体配置示例。