During a cool project where I was using FOG (free open-source ghost) I realized that having a PXE boot server can pose numerous advantages. I wanted a PXE boot server that included FOG and it’s capabilities along with a multitude of operating systems and utilities that can be installed / ran over the network. This can replace the need of having a X number of CDs/DVDs/USB sticks around and the best of it all, multiple PCs can be booted with the same live OS or utility at the same time.
- PXE booting base knowledge (check references for relevant links)
- installed and working FOG server (or a PXE server if FOG isn’t that necessary)
As mentioned in the beginning of the post I wanted to be able to :
- run FOG
- install OSs (Linux distros and Windows) over the network
- boot live OSs (mostly for Ubuntu, Ubuntu variants and Kali) over the network
- run utilities over the network
- add entries to the system in an easy way
It all comes down to the /tftpboot directory, where the boot menu is defined, along with all its graphic elements (background image, colors) and where the OS and utility files are being placed.
- install – the folder where OS and utility files are to be placed, each under the directory meant for it (e.g. linux distros in a version folder, located in a distro folder, located in the linux folder – install/linux/ubuntu/14.04)
- tes – the folder containing menu configuration files (*.cfg) and background pictures for the menu
- pxelinux.cfg – the folder containing “default” file to which TFTP is directed when PXE booting, which includes the “master.cfg” file, the main menu configuration file, where the menu structure and the background picture is being defined
- root-files – these files can be found directly under /tfptboot, and are used in the booting sequence
The boot menu structure follows the directory structure from above – to be more specific, the “install” folder and its subfolders.
Yup, its the CIA logo on the background – a quick google image search can give the most unexpected boot splash images.
An archive with the /tftpboot folder can be found on the Resources page.
How add a new linux distro
This example will cover the most simple scenario, that of downloading the net installer files from the distro source – in this case Ubuntu 14.04.
Download and extract the files in the desired location. The following assumes that you have created the path according to the directory structure.
tar xvfz netboot.tar.gz
We ended up with the following
Adding PXE menu entries
Now having the files in place, we have to add another menu element so that we can choose it when we PXE boot. When having the .cfg files already available (like in this case) I prefer to include them in the master menu, by adding a new menu entry that leads to the .cfg files available. To do this, I’m modifying the menu cfg file reserved for the linux sub menu
And adding an entry like the one below:
# Ubuntu 14.04 netinstall
MENU BEGIN Ubuntu 14.04
MENU TITLE Ubuntu 14.04
The problem now is that the available .cfg files for the Ubuntu netinstaller that we’ve just downloaded does not include path information related to our structure. The menu.cfg file which is referenced above looks like this :
menu title Installer boot menu
menu begin advanced
menu title Advanced options
menu label ^Back..
menu label ^Help
Display help screens; type ‘menu’ at boot prompt to return to this menu
Notice the path ubuntu-installer/amd64/boot-screens/ . This must be prepended with the full path required for TFTP to understand where to get its files from. ubuntu-installer/amd64/boot-screens/ would turn into install/linux/ubuntu/14.04/ubuntu-installer/amd64/boot-screens/
It would go really slow to modify each of the paths manually for each files and that’s why I used the below sed line, which replaces the initial path with the full one.
sed -i ‘s|ubuntu-installer|install/linux/ubuntu/14.04/ubuntu-installer|g’ *.cfg
Now boot up your machine with the PXE server and check out the new entry under linux :