温馨提示×

centos cobbler怎样加系统

小樊
40
2026-09-30 04:41:18
栏目: 智能运维

在 CentOS 上使用 Cobbler 添加(导入/定义)一个系统(操作系统),通常有以下几种常见场景。下面按最常用流程给你说明。


一、前提条件

确保你已经:

  • 安装好 Cobbler(cobbler / cobbler-web)
  • 启动服务
systemctl enable --now cobblerd httpd tftp dhcpd
cobbler check   # 按提示修复问题
cobbler sync

二、添加操作系统(Distro + Profile)

1️⃣ 准备系统 ISO

例如 CentOS-7 或 Rocky/Alma:

mkdir -p /mnt/iso
mount -o loop CentOS-7-x86_64-DVD.iso /mnt/iso

2️⃣ 导入系统(最简单方式)

cobbler import \
  --path=/mnt/iso \
  --name=centos7 \
  --arch=x86_64

执行后 Cobbler 会自动创建:

  • Distro:centos7-x86_64
  • Profile:centos7-x86_64

查看:

cobbler distro list
cobbler profile list

三、添加一台“客户端系统”(System)

如果你是指 给某台机器分配安装配置(PXE 自动安装):

1️⃣ 添加 system

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

2️⃣ 同步配置

cobbler sync

客户端从 PXE 启动即可自动安装。


四、手动添加 Distro(不使用 ISO 导入)

如果你已有 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

五、常见补充

✅ Kickstart 示例位置

/var/lib/cobbler/kickstarts/

✅ Web 界面

https://<cobbler-server>/cobbler_web

六、总结一句话

加系统 = 导入 Distro → 创建 Profile →(可选)绑定 System → cobbler sync

如果你是想:

  • 加 Windows
  • 加 CentOS Stream / Rocky / Alma
  • 做 自动化批量安装

可以告诉我具体场景,我可以给你更精确的命令。

0 踩