Build a custom CentOS 5 install CD
I needed a custom install disc for CentOS 5 in order to bundle some additional RPMs. Revisor has the promise, but it remains unstable and mostly unusable many months after I first gave it a shot. So until they knock out those issues, here are the instructions for rolling your own. I couldn't find anything specific to C5, so based this loosely on some CentoS 4.1 instructions. Since a few of the tools have been updated since that release, I figured someone else could benefit. Grab Disc 1 of the CentOS 5 installer and download to your machine.
Copy the contents to your hard drive:
$ mount -t iso9660 /dev/hdc /media/c5disc1 $ mkdir ~/build/c5disc1 $ cd/media/c5disc1 $ tar -cf - . | ( cd ~/build/c5disc1 ; tar -xvpf - ) $ umount /media/c5disc1
NOTE: Make sure you have the file .discinfo in ~/build/c5disc1. If it's missing, the ISO will fail with a very non-intuitive error that: "The CentOS CD was not found in any of your CDROM drives. Please insert the CentOS CD and press OK to retry." This file is apparently critical to how anaconda reads the file, but it's not trapping that error in a useful way. Oh well. Just copy it from the original disc and put it in your build root, and all will be well.
Make sure you have the anaconda packages:
$ sudo yum -y install anaconda anaconda-help anaconda-runtime
Copy the custom packages into the new folder:
$ cp mypackage-x.y-z.i386.rpm ~/build/c5disc1/CentOS
Here's where things start to differ from the C4 instructions. The createrepo command wraps some of the individual steps previously needed (the entire Step 4 from the C4 post), so all you need to do is:
$ cd ~/build/c5disc1 $ discinfo=`head -1 ~/build/c5disc1/.discinfo` $ createrepo -u "media://$discinfo" -g repodata/comps.xml ~/build/c5disc1
Make the ISO using this command set:
$ isofilename = ~/build/c5-custom.iso $ mkisofs -r -R -J -T -v \ -no-emul-boot -boot-load-size 4 -boot-info-table \ -V "My Custom Linux 1.0" -p "Cool Dude" \ -A "My Custom Linux 1.0 - 2007/12/11" \ -b isolinux/isolinux.bin -c isolinux/boot.cat \ -x "lost+found" -o $isofilename ~/build/c5disc1 $ implantisomd5 $isofilename
To quickly test your new ISO, use qemu (as outlined in another post) That's it, so good luck!














Comments
You are really great. can you
You are really great. can you have any other blog for custom with custom boot image and installation graphics.
Thanks
Hites
Hello Greg Superb help on
Hello Greg
Superb help on rpm build
How can We disable package selection and just give rpms install list on disk without asking for selection .
Thank you
chetanM
@ChetanM - Yes, this is easy
@ChetanM - Yes, this is easy enough. See a previous comment on this thread about how to customize the package list of RPMs for your ISO. Making an RPM to handle a file copy is trivial, too. I created one for another project where the RPM's only purpose was to encapsulate a few shell commands for the %post routines.
Hello all Custom build of
Hello all
Custom build of CentOs is really cool stuff ,
Can we build one rpm just for copying one tar file and include it in rpm packages of CentOs iso
at the time of CentOs install .
In my case tar file is just pre-compiled binary .
regards
ChetanM
Thanks for this very simple
Thanks for this very simple but informative howto got it runnning perfectly :)
[...] Build a custom CentOS 5
[...] Build a custom CentOS 5 install CD « Nootech Notes (tags: linux sysadmin kickstart install rhel build redhat centos) [...]
Glad to hear it, and thanks
Glad to hear it, and thanks for posting your follow-up!
I finally got success. The
I finally got success. The story for it all is a bit long winded so I don't want to burn up your comment space on how I got this to work, but I SERIOUSLY would like to have something showing what I did so that others could benefit since there is jack-#$%* for documentation that explains who this is properly done. I had to practically stumble into the solution. bottom line was this command: 'createrepo --split -p -u "media://$discinfo" -o ~/maindir/disc1/Server/ -g ~/maindir/disc1/comps.xml /root/maindir/disc1/Server /root/maindir/disc2/Server'
This will let the primary.xml(located in Server/repodata for RHEL) file know to look for some stuff in CD1 and some stuff in CD2.
@dfused i didn't need a
@dfused i didn't need a multi-cd installer, so never played with that. but Peter van der Meulen's comments indicate he had it working fine. See if that helps?
I'm trying to create a custom
I'm trying to create a custom install but will need 2 CDs to accomplish my task. I've tried using the --split flag but that's not working right. Have you played any with this??
Hi, Thanx Greg for your quick
Hi,
Thanx Greg for your quick reply.
Createrepo doesn't show any error & even mkisofs doesn't show any. After mkisofs command, an iso file is created.
To check the dependencies I have used the follwing steps:
mkdir testdb
rpm --initdb --dbpath $PWD/testdb
rpm --test --dbpath $PWD/testdb -Uvh cd1/CentOS/RPMS/*.rpm
And whichever dependencies it shows, I resolved those & then I run Createrepo & then mkisofs commands.
Where should be the problem?
Thanx for your timely consideration.
Regards,
Manoj Kumar
@manoj Did the createrepo
@manoj
Did the createrepo step print out any errors, or maybe mkisofs? Did you validate that there are no unsatisfied dependencies with your custom packages?
http://wiki.mandriva.com/en/Development/Howto/Remaster_ISO#Quick_recipe_...
Hi Greg, Thanx for your handy
Hi Greg,
Thanx for your handy work.
Using above steps, I am able to create an iso. I write that iso on cd. I installed CentOS5.2 on another system. But only CentOS 5.2 rpms get installed but my custom rpms are not installed. Please guide me where I am wrong.
Regards,
Manoj Kumar
Hi Greg, I am following the
Hi Greg,
I am following the same steps to get a custom Centos5.2 dvd. But i hit a segfault during mkisofs.
Any inputs for this ?
actually I am trying to get a statically linked parted (1.8.8) to replace older version of parted (1.8.1) in the Centos 5.2. [older parted has a segfault bug]
Regards,
-Manish
@Marcus - Check this page for
@Marcus - Check this page for tips on how to customize the package groups.
http://256.com/gray/docs/redhat_boot/#trim
@sameer - is it ejecting at
@sameer - is it ejecting at the end of the installation, or while it's still installing?
why custom dvd ejects after
why custom dvd ejects after booting
need urgent help
why custom dvd ejects after
why custom dvd ejects after booting
Brilliant!
Brilliant!
Hi. Is there a way to add an
Hi.
Is there a way to add an custom package selection/group which is then pre-selected by default?
Best Regards
Marcus
Hi Summo Did you manage to
Hi Summo
Did you manage to change the OS name?
Regards
Nash
I'm also interested in
I'm also interested in building a custom cd for my asterisk distribution. I don't see where the actual Distro name is changed anywhere in this guide. This guide does come in handy to add some rpms needed to build asterisk but how could I go about creating a CD where the name of the OS would be "MY OS" instead of CentOS.
Hi Greg, the solution above
Hi Greg,
the solution above is the dog's b#llocks :-)
It works. Shows that i didn't do all that RHCE stuff for nothing :-D
Best regards,
Peter
Trying something to solve the
Trying something to solve the problem i mentioned in my first post. I added the .discinfo file from the first cd to the repo. Every cd has this file, only the file on cd2 has a "2" in it, the file on cd3 has a "3" in it and so on. That was probably why the installation asked me for cd2. I checked the .discinfo file from a dvd and it had "1,2,3,4,5,6" (loose the quotes) in it. Added this to the .discinfo and i'm building a new iso now.
Will keep you informed if this works or not.
Regards,
Peter
Hi Greg, thanks for the
Hi Greg,
thanks for the clear guide on building custom iso's.
Building the iso works fine and i can start installing rhel5, however, the installation asks me to insert CD2..
I think i did something wrong (dispite the clear howto..)
I copied the contents of the cd's to one directory and started building from there. I'll be Googling for this, but hopefully you have a quick answer for me :-)
Best regards,
Peter van der Meulen
the Netherlands
You can remove any packages
You can remove any packages you don't want or need, but you'll need to validate that you clear out any dependent packages. I had a script at one time to help me, but can't seem to find it right now. I'll post the link if/when I find it again, but here's a page that outlines one way to validate your packages:
http://wiki.mandriva.com/en/Development/Howto/Remaster_ISO#Quick_recipe_...
Hello Greg Thanks for your
Hello Greg
Thanks for your nice guide. I have got a question, what should be done in order to decrease the number of packages?
Kind Regards
Ali Majdzadeh Kohbanani
Where did you read that it's
Where did you read that it's no longer allowed? The only info I can find is that the behavior changed somewhat for that usage, but I don't see that it's been removed altogether.
In RHEL 4 one was able to
In RHEL 4 one was able to copy over files from the DVD in the %post --nochroot section of the ks.cfg.
In RHEL 5, this is no longer allowed. How do I work around it? i.e I have a preconfigured bastille settings file, a default background image, and a lockdown script.
@Darrell This is because you
@Darrell
This is because you copy/pasted his commands and it put in some funky utf8 type quote marks instead of the regular ". Try again with out using the quotes from the post.
Hello, I found this very
Hello,
I found this very helpful when trying to build a new RHEL 5.1 cd with extra packages and while I did not try your commands exactly as I had some other requirements I can confirm that this should work fine :)
Thanks again, kind regards.
Hi Greg, sorry to trouble
Hi Greg, sorry to trouble you, but i am having a little bit of trouble here accomplishing this. When I run mkisofs it returns:
genisoimage: Missing boot image name, use -eltorito-boot option."I'm not sure what can be wrong? Im trying to build this CentOS 5.1 Custom disk on my Fedora 8 Laptop? Think it could be the reason?
--
de
No, I didn't made any
No, I didn't made any customizations to any of the system packages. The steps outlined above are all that I needed.
When you find out if RHEL does or does not work the same, please add another comment to let others know. Thanks!
Cool I will give this a
Cool I will give this a shoot. Did you do any customization on your anaconda.
I don't use RHEL, but since
I don't use RHEL, but since CentOS 5 is based on RHEL 5, it should work exactly the same. You'll just need to build from a RH ISO obviously, but all the commands should otherwise be the same.
Will these steps work with
Will these steps work with RHEL 5
[...] Splash Screen for
[...] Splash Screen for Install CD December 13, 2007 — Greg Haygood To go along with the previous post about building a custom install CD, I wanted to create a custom splash screen with the [...]
Post new comment