tee > /opt/tftp/bios/pxelinux.cfg/default << 'EOF'
DEFAULT menu.c32
NU TITLE ULTIMATE PXE SERVER - By Griffon - Ver 2.0
PROMPT 0
TIMEOUT 0
MENU COLOR TABMSG 37;40 #ffffffff #00000000
MENU COLOR TITLE 37;40 #ffffffff #00000000
MENU COLOR SEL 7 #ffffffff #00000000
MENU COLOR UNSEL 37;40 #ffffffff #00000000
MENU COLOR BORDER 37;40 #ffffffff #00000000
LABEL Ubuntu Server 20.04.1
kernel /boot/live-server/vmlinuz
initrd /boot/live-server/initrd
append ip=dhcp ds=nocloud-net;s=http://192.168.100.1/autoinstall/user-data url=http://192.168.100.1/iso/ubuntu-20.04.3-live-server-amd64.iso
EOF
tee > /opt/tftp/grub/grub.cfg << EOF
if loadfont /grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
set timeout=5
menuentry "Ubuntu server 20.04 autoinstall" {
set gfxpayload=keep
linux /boot/live-server/vmlinuz root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url='http://192.168.100.1/iso/ubuntu-20.04.3-live-server-amd64.iso' autoinstall ds=nocloud-net\;s=http://192.168.100.1/autoins
tall/ ---
initrd /boot/live-server/initrd
}
EOF
menuentry 之前是配置样式,也可以删除,重点关注menuentry "Ubuntu server 20.04 autoinstall"
内的配置。
#cloud-configautoinstall:apt:geoip:truepreserve_sources_list:falseprimary:-arches:[amd64,i386]uri:https://mirrors.tuna.tsinghua.edu.cn/ubuntu-arches:[default]uri:https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/user-data:timezone:Asia/Shanghaiidentity:username:ubuntuhostname:serverpassword:"$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"#The crypted password is just “ubuntu”.kernel:kernel:{package:linux-generic}keyboard:{layout:us,toggle:null,variant:''}locale:en_US.UTF-8network:ethernets:ens160:{dhcp4:true}version:2ssh:allow-pw:trueauthorized-keys:[]install-server:truestorage:config:-{ptable:gpt,path:/dev/sda,wipe:superblock-recursive,preserve:false,name:'',grub_device:true,type:disk,id:disk-sda}-{device:disk-sda,size:1048576,flag:bios_grub,number:1,preserve:false,grub_device:false,type:partition,id:partition-0}-{device:disk-sda,size:42946527232,wipe:superblock,flag:'',number:2,preserve:false,grub_device:false,type:partition,id:partition-1}-{fstype:ext4,volume:partition-1,preserve:false,type:format,id:format-0}-{path:/,device:format-0,type:mount,id:mount-0}updates:securityversion:1