Having to install Debian from time to time really made me think to doing the install over the network, rather than always making USB sticks or mounting a ISO file in a VM.
The steps to set up PXE on Debian are quite easy - all in all maybe a 10 minute process.
…So, let’s get to it!
You need a working Debian install - That’s it.
Everything else can be installed from the official repositories.
Setting up TFTP
The first thing on the agenda ist installing a TFTP service/daemon.
I will use tftpd-hpa - you can of course use something else like dnsmasq for example (Which has TFTP builtin).
$ sudo apt install tftpd-hpa
Here is a example of how to configure the service. (Be aware to change the given IP address to your needs!)
$ sudo vim /etc/default/tftpd-hpa
TFTP_OPTIONS="--secure -4 -v"
TFTP_OPTIONS: This example only uses IPv4 (-4) and -v (verbose).
TFTP_ADRESS: Specifies the IP address to listen on
TFTP_DIRECTORY: This is the path were we later store the necessary files
Creating the PXE directory
Depending on your configuraiton you might need to create the directory.
$ sudo mkdir /srv/pxe
Restart the service after all the configuration is done.
$ sudo systemctl restart tftpd-hpa.service
Preparing the needed files
Change to the created directory, download the needed files and extract them.
$ cd /srv/pxe
$ sudo wget https://deb.debian.org/debian/dists/bookworm/main/installer-amd64/current/images/netboot/netboot.tar.gz
$ sudo tar xzvf netboot.tar.gz
You can now boot a Debian installer over the network.
Make sure to set your desired system to boot over network.
(Most likely there is a option in the BIOS that you can switch on)
Making a UEFI system bootable over the network is a simple as linking the correct bootloader (GRUB) in the created directory.
$ cd /srv/pxe
$ ln -s debian-installer/amd64/grubx64.efi .
$ ln -s debian-installer/amd64/grub .
Configure your DHCP service
Your DHCP server of choice must be configured to point at the TFTP server/service. (This will make it possible to download the required files!)
I personally use OPNSense - as seen on the following screenshot.
Alter the TFTP server options (TFTP hostname and Bootfile) and you will be ready to go.
Beware: Keep in mind specifying the right boot file!
Setting up a Debian host to do PXE booting is quite simple and saves a lot of hassle.
No more making USB sticks let alone CD/DVD’s!
#debian #pxe #tftp