ubuntu

Cobbler如何实现Ubuntu自动化安装

小樊
53
2025-08-12 09:03:03
栏目: 智能运维

Cobbler实现Ubuntu自动化安装步骤如下:

  1. 安装Cobbler及相关组件

    sudo apt update  
    sudo apt install cobbler cobbler-web dhcp3-server tftpd-hpa xinetd  
    
  2. 配置DHCP服务器
    编辑/etc/dhcp/dhcpd.conf,添加子网、IP范围、网关、DNS及TFTP引导文件路径(filename "pxelinux.0"; next-server <Cobbler服务器IP>)。
    指定DHCP监听接口:sudo nano /etc/default/isc-dhcp-server,设置INTERFACESv4="eth0"(替换为实际网卡)。
    重启DHCP服务:sudo systemctl restart isc-dhcp-server

  3. 配置TFTP服务器
    编辑/etc/xinetd.d/tftp,设置server_args = -s /var/lib/tftpboot,启用TFTP服务。
    重启xinetd:sudo systemctl restart xinetd

  4. 导入Ubuntu镜像
    下载Ubuntu ISO镜像(如ubuntu-20.04.iso),执行:

    sudo cobbler import --path /path/to/iso --name ubuntu-20.04  
    
  5. 创建Cobbler配置文件

    • 添加Profile(关联镜像与安装配置):
      sudo cobbler profile add --name ubuntu-20.04-profile --distro ubuntu-20.04 --kickstart /var/lib/cobbler/kickstarts/default.seed  
      
    • (可选)自定义Kickstart文件,存放于/var/lib/cobbler/kickstarts/,通过--kickstart参数指定。
  6. 设置PXE启动
    将目标系统MAC地址与Profile绑定:

    sudo cobbler system add --name client-system --profile ubuntu-20.04-profile --interface auto --mac AA:BB:CC:DD:EE:FF  
    
  7. 同步配置并启动服务

    sudo cobbler sync  
    sudo systemctl start cobblerd  
    sudo systemctl enable cobblerd  
    

完成以上步骤后,客户端通过PXE启动即可自动安装Ubuntu系统,安装过程可通过Kickstart文件定制。

0
看了该问题的人还看了