Cobbler管理Ubuntu镜像的实操指南
一 核心概念与目录
二 方式一 导入Ubuntu ISO镜像(推荐上手)
mount -o loop,ro /path/ubuntu-22.04-live-server-amd64.iso /mntcobbler import --name=ubuntu-22.04 --arch=x86_64 --path=/mntcobbler profile list、cobbler profile report --name=ubuntu-22.04-x86_64cobbler profile edit --name=ubuntu-22.04-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ubuntu-22.04.seedcobbler syncls /var/lib/tftpboot/pxelinux.cfg/default 与 /var/lib/tftpboot/images/ubuntu-22.04-x86_64/d-i debian-installer/locale string en_US.UTF-8、d-i console-setup/layoutcode string usd-i netcfg/choose_interface select autod-i partman-auto/disk string /dev/sda、d-i partman-auto/method string regulard-i clock-setup/utc boolean true、d-i passwd/root-login boolean trued-i mirror/http/hostname string 192.168.1.10、d-i mirror/http/directory string /cobbler/ks_mirror/ubuntu-22.04-x86_64d-i debconf/priority select critical、tasksel/first multiselect ubuntu-server三 方式二 使用debmirror创建网络镜像并导入
sudo apt-get install debmirrorsudo debmirror -a amd64 --method http --dist jammy --section main,restricted,universe,multiverse --host archive.ubuntu.com /data/ubuntu-mirrorcobbler import --path=/data/ubuntu-mirror --name=ubuntu-22.04-mirrorcobbler profile edit --name=ubuntu-22.04-mirror-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ubuntu-22.04.seedcobbler sync四 网络与PXE引导配置
server: Cobbler服务器地址(如:192.168.1.10)next_server: TFTP地址(通常与server一致)manage_dhcp: 是否由Cobbler生成并管理DHCP(0/1)manage_tftpd: 是否由Cobbler管理TFTP(0/1)subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.100 192.168.1.200; option routers 192.168.1.1; filename "pxelinux.0"; next-server 192.168.1.10; }disable = no,重启xinetdcobbler get-loaders(自动下载/校验常用引导文件,如pxelinux.0、menu.c32等)cobbler sync(自动更新DHCP、TFTP与PXE菜单)五 常用维护命令与排错要点
cobbler distro list、cobbler profile list、cobbler system listcobbler distro report --name=...、cobbler profile report --name=...cobbler profile edit --name=... --kickstart=...、cobbler system add ...cobbler sync、systemctl restart cobblerd httpd xinetdcobbler check(按提示修复缺失组件、引导器、配置项)