在 CentOS 上使用 Cobbler 添加(导入/定义)一个系统(操作系统),通常有以下几种常见场景。下面按最常用流程给你说明。
确保你已经:
cobbler / cobbler-web)systemctl enable --now cobblerd httpd tftp dhcpd
cobbler check # 按提示修复问题
cobbler sync
例如 CentOS-7 或 Rocky/Alma:
mkdir -p /mnt/iso
mount -o loop CentOS-7-x86_64-DVD.iso /mnt/iso
cobbler import \
--path=/mnt/iso \
--name=centos7 \
--arch=x86_64
执行后 Cobbler 会自动创建:
centos7-x86_64centos7-x86_64查看:
cobbler distro list
cobbler profile list
如果你是指 给某台机器分配安装配置(PXE 自动安装):
cobbler system add \
--name=web01 \
--profile=centos7-x86_64 \
--mac=52:54:00:11:22:33 \
--ip-address=192.168.1.100 \
--subnet=255.255.255.0 \
--gateway=192.168.1.1 \
--hostname=web01.local \
--interface=eth0
cobbler sync
客户端从 PXE 启动即可自动安装。
如果你已有 vmlinuz 和 initrd.img:
cobbler distro add \
--name=centos7-custom \
--kernel=/path/vmlinuz \
--initrd=/path/initrd.img \
--arch=x86_64 \
--breed=redhat
再创建 profile:
cobbler profile add \
--name=centos7-custom \
--distro=centos7-custom \
--kickstart=/var/lib/cobbler/kickstarts/centos7.ks
/var/lib/cobbler/kickstarts/
https://<cobbler-server>/cobbler_web
加系统 = 导入 Distro → 创建 Profile →(可选)绑定 System → cobbler sync
如果你是想:
可以告诉我具体场景,我可以给你更精确的命令。