Adding CentOS 5.3 to PXE Boot

Getting Started

I needed to add a CentOS 5.3 64bit to our pxeboot environment. Here are the steps I had to take to get this done.

  1. Get the DVD iso
  2. Mount the dvd somewhere on the system & copy the files to the proper location
  3. Create the TFTP supporting files
  4. Bonus: Get kickstart working for fully automated install

Lets get rolling on this. ((Unlike other posts, these are just the commands I pulled from my history, they may not work for you exactly as they shown. If you're trying to follow this, make sure you've checked your paths and environment stuff.))

wget -c --limit-rate=100k 
mkdir /mnt/centos5.3
mount -t iso9660 -o loop CentOS-5.3-x86_64-bin-DVD.iso  /mnt/centos5.3
rm -rf CentOS-5.3-x86_64-bin-DVD.iso

Now we have the source files to install available. On a side note: because I've done previous work on this environment, I have the sources available via HTTP, NFS and FTP as well; this allows us to do a regular manual network installation without having to use the PXE Boot environment or CD.

TFTP stuff

Next up, tftp stuff. I have to refresh my memory before I step into this, tree will help.

[root@netboot-system-og tftpboot]# tree -L 5
.
|-- images
|   |-- centos
|   |   |-- x86
|   |   |   `-- 4.4
|   |   |       |-- initrd.3ware.img
|   |   |       |-- initrd.base.img
|   |   |       |-- initrd.img
|   |   |       |-- initrd.orig
|   |   |       |-- initrd.r8168.img
|   |   |       |-- initrd.r8169.img
|   |   |       `-- vmlinuz
|   |   `-- x86_64
|   |       `-- 5.2
|   |           |-- initrd.img
|   |           `-- vmlinuz
|   |-- live
|   |   `-- clonezilla
|   |       `-- 1.2.1-53
|   |           |-- filesystem.squashfs
|   |           |-- initrd1.img
|   |           `-- vmlinuz1
|   `-- oralce
|       `-- vmserver
|           `-- 2.1.2
|               |-- initrd.img
|               |-- initrd.img.old
|               |-- vmlinuz
|               `-- vmlinuz.old
|-- menu.c32
|-- pxelinux.0
`-- pxelinux.cfg
    |-- default
    `-- default.working.applianceks

13 directories, 21 files

First lets edit the necessary files in /tftp/pxelinux.cfg to support the new install. I simply copied my existing entry for the appliances and modified the names and locations to match what they should be; we'll put the files in place and rename them as needed after this. ((Notice that the diff only shows you the new entry, the only changes of course are the directories and files specific to the CentOS 5.3 installation.)) We then create the folder to host our Centos 5.3 initrd.img and vmlinuz files, then copy them in.

[root@netboot-system-og tftpboot]# mkdir -p images/centos/x86_64/5.3
[root@netboot-system-og iso-files]# cd /tftpboot/
[root@netboot-system-og pxelinux.cfg]# cp default default.bak
[root@netboot-system-og pxelinux.cfg]# vim default
[root@netboot-system-og pxelinux.cfg]# diff default default.bak
12,16d11
<< LABEL CentOS 5.3 x86_64 Generic Install with Kickstart
<< MENU LABEL CentOS 5.3 x86_64 Generic Appliance
<< KERNEL images/centos/x86_64/5.3/vmlinuz
<<  append vga=normal initrd=images/centos/x86_64/5.3/initrd.img ramdisk_size=32768 ks=http://10.10.18.10/linuxdistros/centos/x86_64/5.3/config/appliancecfg/generic-centos53-x86_64e.cfg ksdevice=eth0

Copy the vmlinuz and initrd into the new location, remember it should go into the folders we made earlier, and ultimately it must match what the tftp server will be looking for via /tftpboot/pxelinux.cfg/default. There are a couple or a few different locations in the CentOS distro where you will find vmlinuz and initrd.img files. The ones you want are under images/pxeboot, the README file in there explains:

The files in this directory are useful for booting a machine via PXE.

The following files are available:
vmlinuz - the kernel used for the installer
initrd.img - an initrd with support for all install methods and
drivers supported for installation of CentOS

So copy those in:

[01:03 AM] netboot-system-og:/opt/xyzcorpnetboot/sources/linuxdistros/centos/x86_64/5.3/images/pxeboot # cp initrd.img /tftpboot/images/centos/x86_64/5.3/
[01:04 AM] netboot-system-og:/opt/xyzcorpnetboot/sources/linuxdistros/centos/x86_64/5.3/images/pxeboot # cp vmlinuz !$
cp vmlinuz /tftpboot/images/centos/x86_64/5.3/

Once you've edited pxelinux.cfg/default, ((You may already have a file that does this and doesn't necessarily have to be called default.)) and copied in the vmlinuz and initrd.img files, then we need to edit the kickstart file and make sure that is configured properly. Notice where I called the file in the tftpboot:

10.10.18.10/linuxdistros/centos/x86_64/5.3/config/appliancecfg/generic-centos53-x86_64.cfg

I'm simply copying the one from another installation and will modify it to fit this new installation.

Notice that the folder that holds the files config does not exist, this is a custom location we created to keep thing separate YMMV. ((As long as you're paying attention to the file names and paths, it all should work out))

[12:35 AM] netboot-system-og:/opt/xyzcorpnetboot # cd sources/linuxdistros/centos/x86_64/5.3/
[12:35 AM] netboot-system-og:/opt/xyzcorpnetboot/sources/linuxdistros/centos/x86_64/5.3 # ls -la
total 356
drwxr-xr-x 7 root   root     4096 Jun 11 02:32 ./
drwxr-xr-x 4 apache apache   4096 Jun 11 02:28 ../
drwxr-xr-x 2    500    500 212992 Mar 21 06:18 CentOS/
-rw-r--r-- 1 root   root      212 Nov 20  2007 EULA
-rw-r--r-- 1 root   root    18009 Nov 20  2007 GPL
drwxr-xr-x 4 root   root     4096 Mar 21 06:18 images/
drwxr-xr-x 2 root   root     4096 Mar 21 06:14 isolinux/
drwxr-xr-x 2 root   root     4096 Mar 17 16:19 NOTES/
-rw-r--r-- 1 root   root      655 Mar  8 20:12 RELEASE-NOTES-cs
-rw-r--r-- 1 root   root     1401 Mar  8 20:12 RELEASE-NOTES-cs.html
-rw-r--r-- 1 root   root      839 Mar  8 20:12 RELEASE-NOTES-de
-rw-r--r-- 1 root   root     1571 Mar  8 20:12 RELEASE-NOTES-de.html
-rw-r--r-- 1 root   root      694 Mar  8 20:12 RELEASE-NOTES-en
-rw-r--r-- 1 root   root     1367 Mar  8 20:12 RELEASE-NOTES-en.html
-rw-r--r-- 1 root   root      694 Mar  8 20:12 RELEASE-NOTES-en_US
-rw-r--r-- 1 root   root     1367 Mar  8 20:12 RELEASE-NOTES-en_US.html
-rw-r--r-- 1 root   root      788 Mar  8 20:12 RELEASE-NOTES-es
-rw-r--r-- 1 root   root     1619 Mar  8 20:12 RELEASE-NOTES-es.html
-rw-r--r-- 1 root   root      852 Mar  8 20:12 RELEASE-NOTES-fr
-rw-r--r-- 1 root   root     1641 Mar  8 20:12 RELEASE-NOTES-fr.html
-rw-r--r-- 1 root   root      766 Mar  8 20:12 RELEASE-NOTES-ja
-rw-r--r-- 1 root   root     1565 Mar  8 20:12 RELEASE-NOTES-ja.html
-rw-r--r-- 1 root   root      706 Mar  8 20:12 RELEASE-NOTES-nl
-rw-r--r-- 1 root   root     1433 Mar  8 20:12 RELEASE-NOTES-nl.html
-rw-r--r-- 1 root   root      752 Mar  8 20:12 RELEASE-NOTES-pt_BR
-rw-r--r-- 1 root   root     1480 Mar  8 20:12 RELEASE-NOTES-pt_BR.html
-rw-r--r-- 1 root   root      801 Mar  8 20:12 RELEASE-NOTES-ro
-rw-r--r-- 1 root   root     1473 Mar  8 20:12 RELEASE-NOTES-ro.html
drwxr-xr-x 2 root   root     4096 Mar 21 06:08 repodata/
-rw-r--r-- 1    504    508   1512 Jun 14  2008 RPM-GPG-KEY-beta
-rw-r--r-- 1    504    508   1504 Jun 14  2008 RPM-GPG-KEY-CentOS-5
-r--r--r-- 1 root   root     7048 Mar 21 06:18 TRANS.TBL

So create the folder, in addition to the config/applianceconfig folder I'm also creating config/applianceconfig/files which will help later on with our process to add extra files, configs or drivers ((We use this location to grab additional files during our pre and post install scripts)).

[12:35 AM] netboot-system-og:/opt/xyzcorpnetboot/sources/linuxdistros/centos/x86_64/5.3 # mkdir -p config/appliancecfg/files
[12:38 AM] netboot-system-og:/opt/xyzcorpnetboot/sources/linuxdistros/centos/x86_64/5.3/config # ls -la
total 16
drwxr-xr-x 4 root root 4096 Jun 17 00:38 ./
drwxr-xr-x 8 root root 4096 Jun 17 00:38 ../
drwxr-xr-x 2 root root 4096 Jun 17 00:38 appliancecfg/

Then I copied the kickstart from our existing appliance; actually I copied all of the files that were there so I could get started quickly, its easier to take away what you don't need than to scramble to find bits and pieces as you need them. If I have any luck, some of the custom drivers we had to add to Centos 4.4 for better hardware support are just included in 5.3 and I won't have to redo any of those. My main task now is to get the kickstart file working.

Up to now, I'm able to boot a system into CentOS 5.3 64 bit, however the kickstart file seems to be ignored or it simply isn't working. Since I copied it from 4.4 maybe I need to modify it a lot more than I expected. The first indication that the kickstart failed was when I got prompted to select a locale for the date; it should have done this automatically. The date was one thing that failed, just for kicks I decided to pick the date/time location and move forward. The next hang up, was about 3 applications that do not exist for CentOS 5.3, after I hit continue for each one, the kickstart continued and finished the installation. So next up is just correcting those mistakes in the kickstart file and testing it again.

In order to keep this post from getting any longer, we'll tackle that issue in a new post in these series. For now, we accomplished the goal of adding a Centos 5.3 to our existing PXEboot environment; it doesn't work exactly as we want it yet... but its there and it already saves us the time of installing from CD which is painfully slow if you need to develop, test & reinstall constantly.