Merging CentOS install images

So I had an interesting problem. I wanted to install CentOS 4.1 on a box which had new enough hardware that you needed 4.4 or better. Getting this to work was an interesting problem, here’s how…

First grab the .iso’s for CentOS 4.1 (or what version of the OS you want) and the first disc iso of 4.4 (or what kernel/anaconda you want). I mounted via loopback the first CD’s as ~/4.1 and ~/4.4.

On the 4.1 .iso you’ll need to replace the following files with their 4.4 equivalents:


Then delete the kernel RPM’s from the ~/4.1/CentOS/RPMS/ directory and copy over the rpms from 4.4.

You’ll need to check the dependencies for the RPM’s you just copied over:

rpm -qp –requires ~/4.1/CentOS/RPMS/kernel-*.rpm

Then check to make sure all the dependencies are ok. In this case, I needed to upgrade mkinitrd too, so I deleted the 4.1 version and copied over the 4.4 RPM. Make sure any RPM’s you copy over have their dependencies are taken care of, recursively.

Once all the dependencies are all taken care of you need to update the hdlist files, run:

/usr/lib/anaconda-runtime/genhdlist –withnumbers –hdlist ~/4.1/CentOS/base/hdlist ~/4.1

In my case, I’m doing a kickstart over NFS, so all my RPM’s are in ~/4.1/CentOS/RPMS, if you’re using CD’s, you’ll need to mount each disc and list each of them on the command line in order (disc1, 2, 3, 4).

Then you need to update the yum .hdr files in ~/4.1/headers using the yum-arch tool. The issue here is that you need to create the .hdr files for all the RPM’s on all the CD’s so you’ll need to copy all the RPM’s to a single directory or run the tool multiple times and merge everything manually. Again, easier if you’re doing a NFS, HTTP or FTP based kickstart.

And that’s about it. :) Although I probably forgot something, but I think that’s mostly it.

2 thoughts on “Merging CentOS install images

  1. I forgot to mention there’s also a “createrepo” command which is supposed to create XML versions of the header files (puts them in a “repodata” directory instead) for use with newer versions of RHEL/CentOS. Of course, my CentOS disks have BOTH headers/repodata so who knows what I’m supposed to have. I do know that the hdlist/hdlist2 files are VERY important and need to be updated anytime you want to add an RPM to the install list.

Leave a Reply