Now its time to build our PXE boot environment.
From here on, all our configurations will be relative to /var/lib/tftpboot and this will be referred to as the tftp root directory.
To begin with, we need to place the PXE boot loader element in our tftp root directory.
Install the syslinux package which contains all the files we need.
[root@deployment ~]# yum install -y syslinux
Now copy the PXE boot loader to our tftp root directory
[root@deployment ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
This one is an optional extra but if you would like to make your boot menu nice and graphical, copy the vesamenu.c32 file to the same location
[root@deployment ~]# cp /usr/share/syslinux/vesamenu.c32 /var/lib/tftpboot/
That’s it for making the “prerequisites” for a PXE environment, however the most important part is to create our custom boot menu.
In your tftp root directory (/var/lib/tftpboot), create a folder called pxelinux.cfg. This will be used to hold our default configuration file.
Whilst your at it, create a folder called images as well. I do this so I can store all my boot files for different operating systems in one nice neat location.
[root@deployment ~]# mkdir /var/lib/tftpboot/pxelinux.cfg [root@deployment ~]# mkdir /var/lib/tftpboot/images
Lets move on and make our default configuration file.
Create an empty text file called /var/lib/tftpboot/pxelinux.cfg/default
(Please note, for you windows users, there is no file extension here. If you create a default.txt file for example, it WILL NOT work).
My config file looks like this. I’ll go through the “relevant” values that really matter for you so you can understand how it all fits together.
1. You can see that I am calling the vesamenu.c32 file, which gives me a nice graphical boot menu.
2. I have set the timeout to 300 milliseconds. This is 30 seconds and it will count down until 0.
3. The ONTIMEOUT value is set to “local”. This value is set down at the end of the file. This tells the PXE environment to boot the first hard disk once the timeout is reached. This is important incase you set a destructive process in your boot environment. For example, formatting your hard disk full of data. You don’t want to do that by accident.
4. The remaining MENU values relate to the colour scheme and layout of my window.
default vesamenu.c32 prompt 0 timeout 300 ONTIMEOUT local MENU MARGIN 10 MENU ROWS 16 MENU TABMSGROW 21 MENU TIMEOUTROW 26 MENU COLOR BORDER 30;44 #20ffffff #00000000 none MENU COLOR SCROLLBAR 30;44 #20ffffff #00000000 none MENU COLOR TITLE 0 #ffffffff #00000000 none MENU COLOR SEL 30;47 #40000000 #20ffffff MENU BACKGROUND redhat.jpg MENU TITLE PXE Menu LABEL local menu label Boot from ^local drive localboot 0xffff LABEL RHEL 6 x86_64 MENU LABEL RHEL 6 x86_64 KERNEL images/rhel/6/x86_64/vmlinuz APPEND initrd=images/rhel/6/x86_64/initrd.img
Above, you will see rather important stanzars.
E.g. LABEL local
This is the stanza which boots the local disk on timeout.
LABEL RHEL 6 x86_64
This stanza is a default for simply booting a RHEL 6 installation environment. Of course you would then need to specify additional attributes like where you would like to perform your installation from? FTP, HTTP, NFS etc.
For example. Below I have set my network card to use DHCP to obtain an IP address, and then fetch all my installation files from a directory on the web server 10.0.0.10. I have also been a little cheeky and pre-set my Language and Keyboard layout as they are ALWAYS the same.
LABEL RHEL 6 x86_64 MENU LABEL RHEL 6 x86_64 KERNEL images/rhel/6/x86_64/vmlinuz APPEND initrd=images/rhel/6/x86_64/initrd.img ip=dhcp method=http://10.0.0.10/iso/rhel/6 lang=en_GB keymap=uk