Skip to content

PXE

Perfect! I’ll generate a ready-to-use preseed file for Ubuntu 22.04 PXE static install with:

  • Static IP configuration
  • One root partition (/)
  • One default user (ubuntu)
  • Auto timezone, locales, and packages
  • Network boot compatible

This will allow fully unattended PXE installation.


Create /var/lib/tftpboot/ubuntu/preseed.cfg:

# Localization
d-i debian-installer/locale string en_US.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
# Network configuration (static)
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string ubuntu-pxe
d-i netcfg/get_domain string local
d-i netcfg/disable_dhcp boolean true
d-i netcfg/get_ipaddress string 192.168.1.150
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 192.168.1.1
d-i netcfg/get_nameservers string 8.8.8.8
# Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string
# Clock and time zone
d-i clock-setup/utc boolean true
d-i time/zone string Etc/UTC
d-i clock-setup/ntp boolean true
# Partitioning
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select atomic
d-i partman-auto/disk string /dev/sda
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
# Root password
d-i passwd/root-login boolean false
d-i passwd/make-user boolean true
d-i passwd/user-fullname string Ubuntu User
d-i passwd/username string ubuntu
d-i passwd/user-password password ubuntu
d-i passwd/user-password-again password ubuntu
# Install base system
tasksel tasksel/first multiselect standard
d-i pkgsel/include string openssh-server
d-i pkgsel/upgrade select none
# Boot loader
d-i grub-installer/only_debian boolean true
d-i finish-install/reboot_in_progress note
# Avoid prompts
d-i debconf/priority string critical
d-i preseed/late_command string \
in-target sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config; \
in-target systemctl enable ssh

Edit /var/lib/tftpboot/pxelinux.cfg/default:

DEFAULT menu.c32
PROMPT 0
TIMEOUT 50
ONTIMEOUT ubuntu
MENU TITLE PXE Boot Menu
LABEL ubuntu
MENU LABEL Install Ubuntu 22.04 Static
KERNEL ubuntu/linux
APPEND initrd=ubuntu/initrd.gz auto=true priority=critical preseed/file=/ubuntu/preseed.cfg ---

  • Adjust IP addresses and netmask/gateway for your network.
  • Password is ubuntu (change for production).
  • After booting, installation is fully automated: disk is wiped, system is installed, SSH enabled.
  • The PXE client will reboot automatically at the end.

  1. Ensure /var/lib/tftpboot/ubuntu/linux and /var/lib/tftpboot/ubuntu/initrd.gz exist
  2. Ensure /var/lib/tftpboot/ubuntu/preseed.cfg exists and is readable
  3. Test PXE boot on a VM first to verify IP and install

If you want, I can also create a version with multiple clients using unique IPs automatically, so you can deploy many machines at once via PXE fully unattended.

Do you want me to do that?