Set up a debian pxe server with syslinux - cesetxeberria/pxeserver GitHub Wiki

Download debian netinst iso, burn it to a cd or a usb and install. Just the minimal install will suffice.

As root user install dnsmasq pxelinux and syslinux-efi.

apt-get install dnsmasq pxelinux syslinux-efi

Create a new folder for the tftp-root and two subfolders: one for bios clients and another one for efi clients.

mkdir -p /home/tftp/syslinux/bios
mkdir -p /home/tftp/syslinux/efi

Copy needed files

cp /usr/lib/PXELINUX/pxelinux.0 /home/tftp/syslinux/bios/
cp /usr/lib/syslinux/modules/bios/* /home/tftp/syslinux/bios/
cp /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi /home/tftp/syslinux/efi/
cp /usr/lib/syslinux/modules/efi64/* /home/tftp/syslinux/bios/efi

Create a new folder for the installation menu in the bios folder. Then create a link to this subfolder inside efi, so we can use a single file for both.

mkdir /home/tftp/syslinux/bios/pxelinux.cfg
ln -s /home/tftp/syslinux/bios/pxelinux.cfg /home/tftp/syslinux/bios/pxelinux.cfg

Create a simple "Hello world" file for the menu.

nano /home/tftp/syslinux/bios/pxelinux.cfg/default

ui menu.c32
prompt 0
default Hello
timeout 20

label Hello

Create new file /etc/dnsmasq.d/custom

nano /etc/dnsmasq.d/custom

interface=eth0
bind-dynamic
dhcp-range=192.168.1.54,proxy
enable-tftp
tftp-root=/home/tftp
pxe-service=x86PC, "syslinux bios", syslinux/bios/pxelinux
pxe-service=x86-64_efi, "syslinux efi", syslinux/efi/syslinux.efi

'eht0' in the first line and '192.168.1.54' in the third one are just examples. Must be filled with your own interface name and network address. You can get your interface name with

ip -o link | grep "state UP" | awk '{print substr($2, 1, length($2)-1)}'

And your network address with

ip route show | grep src | awk '{print substr($1, 1, length($1)-3)}'

Restart dnsmasq

systemctl restart dnsmasq

Now you can try to pxe boot your client. You shoud see this screen