Debian live cd - cesetxeberria/pxeserver GitHub Wiki
Prepare the server
First of all we have to prepare our PXE server using one of these bootloaders
We also need to configure it as a nfs server.
Get the files from an official Debian iso
If you prefer to create your own, see here.
Download a debian live image from here.
wget -c https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-11.0.0-amd64-standard.iso
Once downloaded, create a directory to mount the iso file and mount it. Then create a new folder inside the tftp-root and copy all the needed files there.
mkdir -p /home/tftp/livecds/debian/iso
mount debian-live-11.0.0-amd64-standard.iso /home/tftp/livecds/debian/iso
cp -r /home/tftp/livecds/debian/iso/live /home/tftp/livecds/debian/
This will copy some files, config-4.19.0-8-amd64 filesystem.squashfs initrd.img-4.19.0-8-amd64 System.map-4.19.0-8-amd64 vmlinuz-4.19.0-8-amd64
We just need vmlinuz, initrd.img and filesystem.squashfs. The last one must be inside /home/tftp/livecds/debian/live folder. We will rename and move the others.
mv /home/tftp/livecds/debian/live/vmlinuz-4.19.0-8-amd64 /home/tftp/livecds/debian/vmlinuz
mv /home/tftp/livecds/debian/live/initrd.img-4.19.0-8-amd64 /home/tftp/livecds/debian/initrd.img
Add the livecd entry to your boot menu.
Using pxelinux
nano /home/tftp/syslinux/bios/pxelinux.cfg/default
label Debian live
menu clear
kernel /livecds/debian/vmlinuz
initrd /livecds/debian/initrd.img
append panic=10 ro boot=live root=/dev/nfs nfsroot=192.168.1.54:/home/tftp/livecds/debian swap
ipappend 2
Remember that 192.168.1.54 is just an example. You must use the ip of your own nfs server. Last line (ipappend 2) is very important. When Debian boots, it tries to get an ip address using dhcp, but as we are booting from pxe he already has one. With this line we are telling the system to keep it.
Using grub
nano /home/tftp/grub/grub.cfg
menuentry "Debian live" {
linux /livecds/debian/vmlinuz panic=10 ro boot=live root=/dev/nfs nfsroot=192.168.1.54:/home/tftp/livecds/debian ksdevice=bootif
initrd /livecds/debian/initrd.img
}
Remember that 192.168.1.54 is just an example. You must use the ip of your own nfs server. Last part of the first command (ksdevice=bootif) is very important. When Debian boots, it tries to get an ip address using dhcp, but as we are booting from pxe he already has one. With this line we are telling the system to keep it.
Using ipxe
nano /home/tftp/default.ipxe
:debianlive
kernel /livecds/debian/vmlinuz
initrd /livecds/debian/initrd.img
imgargs vmlinuz initrd=initrd.img panic=10 ro boot=live root=/dev/nfs nfsroot=192.168.1.54:/home/tftp/livecds/debian ksdevice=bootif
boot ||
goto MENU
Remember that 192.168.1.54 is just an example. You must use the ip of your own nfs server. Last part of the first command (ksdevice=bootif) is very important. When Debian boots, it tries to get an ip address using dhcp, but as we are booting from pxe he already has one. With this line we are telling the system to keep it.