上一篇,测试了 debian 11 的pxe自动安装:https://liujia.anqun.org/index.php/archives/3994/ 。 这里想试试 ubuntu 22.04的。
- /srv/tftp/os-images/bullseye/netboot/pxelinux.cfg/01-08-00-27-49-b4-6c # 偷懒,直接使用 debian 11 netboot 中的 pxelinux 文件。仅对pxelinux的配置文件内容做改动。其中 vmlinuz 和 initrd 是从 ubuntu-22.04.1-live-server-amd64.iso 提取到的。http://192.168.3.1/jammy/ 中有 user-data 和 meta-data 配置文件 - DEFAULT linux
 SAY Now booting the kernel from SYSLINUX...
LABEL linux
#  KERNEL debian-installer/amd64/linux
#  APPEND auto=true hostname=auto2 domain=local preseed/url=tftp://192.168.3.1/os-images/bullseye/preseed.cfg initrd=debian-installer/amd64/initrd.gz
KERNEL http://192.168.3.1/jammy/vmlinuz
INITRD http://192.168.3.1/jammy/initrd
APPEND ip=dhcp autoinstall ds=nocloud-net;s=http://192.168.3.1/jammy/ url=http://192.168.3.1/jammy/ubuntu-22.04.1-live-server-amd64.iso
 
- http://192.168.3.1/jammy/user-data # 自动安装的应答文件内容,这里仅设置用户及安装openssh-server - #cloud-config
autoinstall:
 identity:
hostname: jammy2
password: $6$5lpwCLsKLEzMkSJc$keOAhA6aO/5RocGThmhVA7LSNuW911Rx5HHXFEa75oGK20cEdAAgn14H5f5nGeq6QgcSyLPrWcg1.JvjXbhrN/
username: ubuntu
 locale: zh_CN.UTF-8
 ssh:
install-server: yes
 late-commands:
 - 'echo "ubuntu ALL=(ALL) NOPASSWD:ALL" > /target/etc/sudoers.d/ubuntu-nopw'
 - chmod 440 /target/etc/sudoers.d/ubuntu-nopw
 version: 1
 
遇到的问题,安装ubuntu 22.04的虚拟机分配了4GB内存,还不够用,用6GB内存后才顺利安装完成。
参考: