Ubuntu 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 Ubuntu iso
If you prefer to create your own, see here.
Download a ubuntu live image from here.
wget -c http://releases.ubuntu.com/18.04.4/ubuntu-18.04.4-desktop-amd64.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/ubuntu/iso
mount ubuntu-18.04.4-desktop-amd64.iso /home/tftp/livecds/ubuntu/iso
cp -r /home/tftp/livecds/ubuntu/iso/casper /home/tftp/livecds/ubuntu/
This will copy some files, filesystem.manifest filesystem.manifest-minimal-remove filesystem.manifest-remove filesystem.size filesystem.squashfs filesystem.squashfs.gpg initrd vmlinuz
We just need vmlinuz, initrd.img and filesystem.squashfs. The last one must be inside /home/tftp/livecds/ubuntu/casper folder. We will move the others.
mv /home/tftp/livecds/ubuntu/casper/vmlinuz /home/tftp/livecds/ubuntu/vmlinuz
mv /home/tftp/livecds/ubuntu/casper/initrd /home/tftp/livecds/ubuntu/initrd
Add the livecd entry to your boot menu.
Using pxelinux
nano /home/tftp/syslinux/bios/pxelinux.cfg/default
label Ubuntu live
menu clear
kernel /livecds/ubuntu/vmlinuz
initrd /livecds/ubuntu/initrd
append panic=10 ro boot=casper netboot=nfs root=/dev/nfs nfsroot=192.168.1.54:/home/tftp/livecds/ubuntu swap
ipappend 2
Remember tha 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 Ubuntu 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 "Ubuntu" {
set gfxpayload=keep
linux /livecds/ubuntu/vmlinuz panic=10 ro boot=casper netboot=nfs root=/dev/nfs nfsroot=192.168.1.65:/home/irudiak/tftp/livecds/ubuntu ksdevice=bootif
initrd /livecds/ubuntu/initrd.img
}
Remember tha 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 Ubuntu 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
:ubuntulive
kernel /livecds/ubuntu/vmlinuz
initrd /livecds/ubuntu/initrd.img
imgargs vmlinuz initrd=initrd.img panic=10 ro boot=casper netboot=nfs root=/dev/nfs nfsroot=192.168.1.65:/home/irudiak/tftp/livecds/ubuntu ksdevice=bootif
boot ||
goto MENU
Remember tha 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 Ubuntu 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.