下面给你一份在 Debian 上配置 Cobbler(自动化系统安装)的实用指南,涵盖安装 → 基本配置 → 导入镜像 → 添加系统 → 启动服务的完整流程。
apt update
apt install -y cobbler cobbler-web dhcpd tftp tftp-hpa xinetd syslinux bind9
注:Debian 仓库中 Cobbler 一般为 2.x 或 3.x
vim /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
编辑 Cobbler 的 DHCP 模板:
vim /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 dynamic-bootp 192.168.1.100 192.168.1.200;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
同步配置:
cobbler sync
vim /etc/xinetd.d/tftp
确保:
disable = no
重启 xinetd:
systemctl restart xinetd
mount -o loop CentOS-7-x86_64-DVD.iso /mnt
cobbler import --path=/mnt --name=centos7 --arch=x86_64
查看导入结果:
cobbler distro list
vim /var/lib/cobbler/kickstarts/centos7.ks
示例(最小化):
auth --useshadow --enablemd5
bootloader --location=mbr
clearpart --all --initlabel
part / --fstype=ext4 --size=8000
part swap --size=2048
network --bootproto=dhcp
rootpw --plaintext password
firewall --disabled
selinux --disabled
reboot
%packages
@base
%end
cobbler profile edit --name=centos7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.ks
cobbler system add \
--name=node01 \
--profile=centos7-x86_64 \
--mac=52:54:00:11:22:33 \
--ip-address=192.168.1.101 \
--netmask=255.255.255.0 \
--gateway=192.168.1.1
同步:
cobbler sync
systemctl enable --now cobblerd
systemctl enable --now dhcpd
systemctl enable --now tftp
检查状态:
cobbler check
cobbler synchttps://服务器IP/cobbler_web
默认用户:
cobbler / cobbler
如果你需要:
可以继续问我。