温馨提示×

Debian Cobbler如何与PXE结合使用

小樊
40
2025-09-08 08:51:00
栏目: 智能运维

Debian Cobbler与PXE结合使用步骤如下:

  1. 环境准备

    • 关闭防火墙和SELinux:
      systemctl stop firewalld && systemctl disable firewalld
      sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
    • 安装Cobbler及相关服务:
      apt install cobbler cobbler-web tftpd-hpa dhcp3-server apache2 xinetd
    • 启动服务并设置开机自启:
      systemctl start cobblerd apache2 tftpd-hpa dhcpd
      systemctl enable cobblerd apache2 tftpd-hpa dhcpd
  2. 配置Cobbler

    • 修改/etc/cobbler/settings,设置server为服务器IP,启用manage_dhcp=1
    • 编辑/etc/cobbler/dhcp.template,配置DHCP网段、TFTP服务器地址等。
    • 同步配置:cobbler sync
  3. 导入Debian镜像并适配PXE

    • 挂载Debian ISO镜像并导入:
      mount -o loop /path/to/debian.iso /mnt
      cobbler import --path=/mnt --name=debian --arch=amd64
    • 下载Debian Netboot引导文件并拼接initrd:
      wget https://mirrors.ustc.edu.cn/debian/dists/stable/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz
      cat /var/www/cobbler/distro_mirror/debian/install.amd/initrd.gz /path/to/netboot.gz > /var/www/cobbler/pub/debian-netboot.gz
    • 编辑Distro配置,指定新的initrd路径:
      cobbler distro edit --name=debian-x86_64 --initrd "/var/www/cobbler/pub/debian-netboot.gz"
  4. 配置PXE引导参数

    • 创建系统配置并启用PXE:
      cobbler system add --name=test-pc --profile=debian-x86_64 --netboot-enabled=true
    • 同步配置:cobbler sync
  5. 客户端验证

    • 设置客户端BIOS/UEFI为PXE启动,重启后应从Cobbler服务器加载引导程序,进入自动化安装流程。

关键说明

  • Debian的PXE引导需使用netboot专用initrd,需手动拼接官方提供的引导文件。
  • cobbler check可检查配置错误,确保DHCP、TFTP等服务正常。
  • 可通过Kickstart文件(如/var/lib/cobbler/kickstarts/ks.cfg)实现无人值守安装。

参考来源:

0