www.linuxtech.cc

Mitgliederbereich user
pic
InfoWorld: Applying Theory ...
The notion of open source innovation continues to be interesting and elusive...

Times Online: The End of the (Free) P...
... [O]ur man from Mozilla, says that charging for sending e-mails could create a dangerous precedent on the previously free-to-access internet...

Ars Technica: Richard Stallman Casts ... ...I wasn't surprised to see him respond to a question about the merits of DRM with a quick and dismissive 'it is fundamentally unjust...'

pic
I finished with the Red Hat / Fedora CD article. The next one will cover an automated install script for Snort on Enterprise 3.0.
Creating a Single Installation CD for Red Hat/Fedora Distributions

Like most enterprise shops, we have multiple versions of a Red Hat running on development and production systems. This includes versions of Red Hat 9.0 along with Enterprise 2.1 and 3.0. Each of our in-house applications goes through a Q&A process to verify stability with a particular release. Sometimes we have up to 3 different releases of a particular version in production. For example, AS 2.1 Update 1, 3 and 5.

When new servers are built, it's usually done with kickstart scripts via a network install. Even though all of the media is located on a NFS share, we still have to use Disc 1 of the release to kickoff the installation. Finding a particular CD can lead to treasure hunts through co-workers desks or sometimes it requires burning a new CD. Then to ensure a huge pile of CD's in everyone's arsenal, each update for Enterprise requires a new installation CD. For example, installing ES 3.0 Update 3 requires Disc 1 from that release, if you try using Disc 1 from ES 3.0 Update 1 to perform the install; anaconda will kick back a message saying invalid media. Surprisingly, Red Hat has never really addressed this issue and they have left it up to technicians to come up with creative solutions.

This article is meant to provide the steps needed to create a single CD boot disc for installing different versions of Red Hat & Fedora from a shared media source which can be done over NFS, FTP or HTTP. I've also created an iso (33MB) which will allow you to kickoff the install process for the following releases;

Red Hat 9.0 AS 2.1 Update 6 AS 3.0 Update 4 ES 2.1 Update 6
ES 3.0 Update 4 Fedora Core 2 Fedora Core 3  

 

Package Installation

To start, you'll need a few packages installed. First is the mkisofs package which provides the utility to create .iso images. Next, the syslinux package contains the isolinux boot loader and utilities for converting graphic file formats. Practically all distros use isolinux including Red Hat. Finally, create a directory where you want to build the CD from (/installcd/isolinux). Also, create a few more directories for mounting ISO's (/installcd/t1, /installcd/t2).

mkdir -p /installcd/isolinux
mkdir -p /installcd/t1
mkdir -p /installcd/t2

Gathering Kernel & Ramdisk files

Linux goes through a two part boot process; the first stage loads the kernel, then the ramdisk kicks in which loads drivers and initializes a mock file system (Note: I'm referring to 'Linux' as an OS, not the actual kernel). The anaconda installer is no different. Each kernel/ramdisk set is matched to a particular OS release/update. You'll need to copy the vmlinuz and initrd.img files from each release into the /installcd/isolinux directory. The following example is for AS 2.1;

mount -o loop rhel-3-i386-as-disc1.iso /installcd/t1
mount -o loop /installcd/t1/images/boot.iso /installcd/t2
cp /installcd/t2/isolinux/vmlinuz /installcd/isolinux/as21
cp /installcd/t2/isolinux/initrd.img /installcd/isolinux/as21.img
umount /installcd/t1; umount /installcd/t2

The vmlinuz and initrd.img images from the boot.iso assume you want to perform an installation via NFS, HTTP or FTP. The vmlinuz and initrd.img files from the /isolinux directory off the installation CD assumes you want to perform the install from a local resource like the CD or hard drive. You could use these files and pass the boot option 'askmethod' which would prompt for additional installation methods but I have found this sometimes doesn't work properly so its best to use the files off the boot.iso image.

Repeat the above process for each release you would like to put on your CD. I used the following format when naming the kernel and initrd.img files.

Release Kernel Initrd.img

Red Hat 9.0
AS 2.1 Update 6
ES 2.1 Update 6
AS 3.0 Update 4
ES 3.0 Update 4
Fedora Core 2
Fedora Core 3

rh9
as21u6
es21u6
as30u4
es30u4
fc2
fc3

rh9.img
as21u6.img
es21u6.img
as30u4.img
es30u4.img
fc2.img
fc3.img

 

Creating the Splash Screen

Now that all the images are located in the /installcd/isolinux directory, the next step is to create a splash screen. This will be the first screen you'll see on bootup of the CD. If your using this in a corporate environment, one suggestion might be to include a company logo. Adding graphics to the splash screen is an optional task. If you want to use a text page for the boot up menu, just skip this section.

ISOLINUX uses a obscure graphic format that most people never heard of, LSS. The most detailed explanation of this format and how to create it can be found here. I'll give you the short version which will hopefully speed up the process. The LSS format is limited to 16 colors and 640x480 resolution. You'll need some room for the command line so don't create anything larger than 640x400 or else the top portion of the graphic will scroll off the screen. I'm not aware of any graphics editor that will save in the LSS format, so you will need to create it in some other graphics format and use the conversion utilities found in the syslinux or netpbm-progs packages.

Converting file formats GIF, JPEG, PNG or BMP into the LSS format can be a tricky process. For this demonstration, I created a simple header (640x115) in Adobe Illustrator and saved it in PNG format with 16 colors.

The conversion tools are a bit finicky to what your LANG variable is set to. Odds are its set to en_US.UTF-8. Set it to en_US. Next, convert the graphic into a portable pixmap. Finally, convert the pixmap into the LSS format.

export LANG=en_US
pngtopnm < splash.png > splash.pnm
ppmtolss16 < splash.pnm > splash.lss
cp splash.lss /installcd/isolinux

I've also had some success with 16 color bitmaps in Microsoft Paint

bmptoppm < splash.bmp > splash.ppm

Last, I gave Gimp a try which worked if I created the GIF from scratch (no importing existing GIFs).

giftopnm < splash.gif > splash.pnm

Creating the Menu

Next, copy the following files from the /isolinux directory from Disc 1 on any Red Hat release into your /installcd/isolinux

boot.cat
boot.msg
isolinux.bin
isolinux.cfg

The isolinux.cfg file is the equivalent of lilo.conf or grub.conf. An example of the syntax is listed below or you can view the full isolinux.cfg here.

timeout 28000
prompt 1
display boot.msg
F1 boot.msg
F2 f2boot.msg
F3 f3boot.msg
# ------------------------------------------
# Red Hat Enterprise AS 2.1
# ------------------------------------------
label as21
kernel as21
append initrd=as21.img

The *.msg files are plain text files that display their content when the function keys are pressed. They also can contain special codes for changing colors and setting graphic modes. The syslinux.doc explains this in detail which is usually located in /usr/share/doc/syslinux-2.*. Here is a sample of a boot.msg file.

# Clears Screen Ctrl-L
^L
# Enters Graphic Mode Ctrl-X & load splash.lss
^Xsplash.lss
# Set foreground and background colors : Ctrl-O
^O9A[F1-Main Menu] [F2-Boot Options] [F3- Info] ^O07

Creating the CD

Your /installcd/isolinux directory should include the kernel/initrd's, splash.lss, boot.cat, boot.msg, isolinux.bin, isolinux.cfg and any additional message files needed. Run the following command from /installcd assuming you used this as the default directory.

mkisofs -o installcd.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table /installcd

Next, burn the CD;

cdrecord dev=/dev/cdrom installcd.iso

Conclusion

After going through the above steps, you'll have a single CD for installing any Red Hat or Fedora release via HTTP, NFS or FTP. Including the kernel & ramdisk images on the CD is just the start of the customization; you could include driver disks and kickstart scripts also. I've created an iso which includes seven releases from our friends at Red Hat. VMWare GSX was used for testing the CD image which saved countless time since you never actually have to reboot to test the image. I plan on updating the CD to include Enterprise 4.0 and Fedora Core 4 in the next few months. Please check the www.linuxtech.cc/releases directory for updates.