Softpanorama
May the source be with you, but remember the KISS principle ;-)

Contents Bulletin Scripting in shell and Perl Network troubleshooting History Humor

Modifying ISO image to include kickstart file and other useful files

News Administration Recommended Books Recommended Links Installation RHEL5 registration Oracle Linux Loopback filesystem
Kickstart Installation of Red Hat from a USB drive Modyfying ISO image Networking NTP configuration LVM  Xinetd Etc

Introduction

The ISO9660 file structure is not designed for modification, everything has a strictly defined place with no room to extend files or directories. You copy the whole file structure it to working directory, modify that, and re-create a new image from this working directory.

There are several step you need to accomplish

  1. Extracting the source ISO image to work directory
  2. Adding your custom files to the tree
  3. Creating a new ISO Image which includes your modifications
  4. Burning a new CD/DVD

Your additions are limited mostly by the capacity limits of a DVD. Skilled sysadmins create custom DVDs that automatically partitions the hard drives, install Linux, installed several add-on packages (for example for Oracle), created user accounts, and setup the networking. 

Extracting the source ISO image to work directory

First create a directory that will house the modified image. For example: 

$ mkdir /tmp/RHEL_custom

Now we need to mount the source ISO image locally so we can work with it.

# mount -t iso9660 -o loop RHEL-5.6-x86_64-DVD.iso /media

To extract the source ISO files into another directory. This will take a couple of minutes as we are copying more then 3GB of information: 

cd /media
tar cf - . | (cd /tmp/RHEL_custom; tar xfp -)

Adding your custom files to the tree

I will point out just a couple things that will come in handy. The ks.cfg file is what the install routine will use while loading the OS. I usually create a different file name and explicitly set that file name when I boot off the CD. That way I know I am giving the installation my custom configuration. If my custom config file was named ks-dev.cfg, then when I boot off the CD, I would type something like the following.
boot: linux text ks=cdrom:/ks-dev.cfg

The installation will proceed normally, but you will not be prompted for anything that you have already specified in the config file. You can have multiple config files in your image and just specify the appropriate one at boot time.

Within the ks.cfg file you can specify pre-install and post-install scripts. As you might expect, these are standard scripts that will be run either before or after the install process. These are quite handy for copying files from the CD, running install routines, or automated configuration. These scripts are probably where you will do the bulk of your configuration.

If you have additional packages that you want to install, you can copy them into the custom image directory. This way they will be included in the image when we create the new ISO. You can then put a postinstall script in place to install and configure those packages automatically at install time. As long as you do not exceed the capacity of a CD or DVD, then you can add as much as you want.

If you will not be burning physical media and will only be using the ISO image file, such as for VM/VB installs, then you have no size limits.

There are multiple samples of  custom kickstart configuration files that can be downloaded from the Internet.

For example

Creating a new ISO Image which includes your modifications

Once all of your modifications are complete, you just need to put it all together and create a new ISO image. Below is the command I use.
cd /tmp/RHEL_custom
mkisofs -o RHEL-5.6-x86_64-custom.iso -b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V "RHEL 5.6 Custom ISO" .

Top updates

Softpanorama Switchboard
Softpanorama Search


NEWS CONTENTS

Old News ;-)

[Nov 18, 2011] ISO Master - GUI Tool to edit ISO Images in openSUSE SUSE & openSUSE

susegeek.com

ISO Master which is claimed to be the best ISO editing tool is a graphical editor for ISO images. ISO Master is useful for extracting, deleting, or adding files and directories to or from an ISO image. ISO Master can read .ISO files (ISO9660, Joliet, RockRidge, and El Torito), most .NRG files, and some single-track .MDF files and can save and only save as .ISO.

The supported operations include, add/delete files and directories under the ISO image, Modify/delete the Boot records. extract files from the ISO etc.

Install ISO Master

Packman as always hosts a 1-click install Yast Metapackage for ISO Master. This installer is supported on openSUSE 11.0, openSUSE 10.3, openSUSE 10.2, and SUSE 10.1 & 10.0

[Nov 18, 2011] Edit and create your bootable iso image – the easy way « Ubuntu and friends

ISO Master

ISO Master allows you to modify the content of an ISO file without damaging the bootrecord and ruining the image’s bootable capabilities. If you ever need to add or remove content from a CD Image, then ISO Master is the application you should use!

Creating a custom Red Hat installation DVD

October 2005

How to create a single CD for fast and easy customized installation.

Setting up the build directory:

The first thing to do is to copy all the cdrom ISOs to one location:

mkdir -p /mnt/disk{1,2,3,4}
mount -o loop RHEL4-U1-i386-AS-disc1.iso /mnt/disk1
mount -o loop RHEL4-U1-i386-AS-disc2.iso /mnt/disk2
mount -o loop RHEL4-U1-i386-AS-disc3.iso /mnt/disk3
mount -o loop RHEL4-U1-i386-AS-disc4.iso /mnt/disk4
We now copy all the files from the directories to a single directory: mkdir -p /data/isobuild
rsync -rv /mnt/disk{4,3,2,1}/* /data/isobuild/
We also need to copy across the .diskinfo file that is not caught by our *:
cp /mnt/disk1/.diskinfo /data/isobuild/

The .diskinfo file identifies the CD as being a correct Red Hat Installer disk and is checked by anaconda during the start of the install.

We could now build the DVD as it is but we really should have a fiddle first :-)

Adding more software to the DVD

We could add some of our own rpms to /data/isobuild/RedHat/RPMS; however by just doing this does not make them available at install time. There is an XML file that is read and ensures that the packages are installed in the correct order.

So let us throw a few random packages into the mix:

Add some java:

cp jre-1_5_0_03-linux-i586.rpm /data/isobuild/RedHat/RPMS/
Some encryption for GAIM:
cp gaim-encryption-2.36-3.rf.i386.rpm /data/isobuild/RedHat/RPMS/
Updating the comps.xml file

We need to ensure that the host computer has anaconda and anaconda-runtime installed: up2date anaconda anaconda-runtime

Before we update the XML dependency file we need to sort out package orders. If you have added a lot of new packages you may need to remove some old packages that you have replaced with newer versions to stop conflicts.

So the first command is: PYTHONPATH=/usr/lib/anaconda /usr/lib/anaconda-runtime/pkgorder \ /data/isobuild/ i386 > /data/isobuild/xander-pkgorder

This creates a list of files in the order it needs to install them in the file /data/isobuild/xander-pkgorder. Sometimes an occasional RPM will not provide the information anaconda needs. You can edit the file manually and insert your RPMs at the end.

Next we need to generate the dependency file:

/usr/lib/anaconda-runtime/genhdlist --fileorder /data/isobuild/xander-pkgorder \ /data/isobuild/

You will probably have a few hiccoughs the first time you run these commands. Most may be resolved by adding the missing entries to the pkgorder file or deleting duplicate packages.

Creating an automated installer We could *now* if we wanted to build our DVD; however we can make an automated installer.

So crack open system-config-kickstart and create a kickstart file with all the packages and partitioning etc you need for your systems.

copy the resulting file to /data/isobuild/ks.cfg

we can now edit the file /data/isobuild/isolinux/isolinux.cfg

copy or change the three lines:

label linux
  kernel vmlinuz
  append initrd=initrd.img ramdisk_size=8192
to
label xander
  kernel vmlinuz
  append initrd=initrd.img ramdisk_size=8192 ks=cdrom:/ks.cfg
Then change the default at the top of the file to xander. This means that the default action is to install directly from the DVD using your kickstart file.

Building the DVD iso

Now to build the iso:

cd /data/isobuild

chmod a+w isolinux/isolinux.bin

mkisofs -r -T -J -V "Custom RHEL4 Build" -b isolinux/isolinux.bin \
 -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \
-boot-info-table -o /data/custom-RHEL4-dvd.iso  /data/isobuild/
Burning the DVD

Now we can burn the image to the CD. I assume the CD writer is already set up on your system. We use cdrecord below, but you can use other programs as well. The command is invoked as:

cdrecord -v speed=4 dev=0,0,0 /data/custom-RHEL4-dvd.iso
The speed and dev options depend on your system. The device for the dev argument can be determined by using the -scanbus option to cdrecord:
cdrecord -scanbus
Using the DVD

Once the image is burned onto the DVD, insert the DVD into the target machine and boot the machine. You should get the custom message that you created earlier. At this point, you can either press Enter at the boot prompt or let it timeout. When it times out it uses the default label, which we specified as ks (Kickstart).

Recommended Links

Softpanorama hot topic of the month

Softpanorama Recommended



Etc

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available in our efforts to advance understanding of environmental, political, human rights, economic, democracy, scientific, and social justice issues, etc. We believe this constitutes a 'fair use' of any such copyrighted material as provided for in section 107 of the US Copyright Law. In accordance with Title 17 U.S.C. Section 107, the material on this site is distributed without profit exclusivly for research and educational purposes.   If you wish to use copyrighted material from this site for purposes of your own that go beyond 'fair use', you must obtain permission from the copyright owner. 

ABUSE: IPs or network segments from which we detect a stream of probes might be blocked for no less then 90 days. Multiple types of probes increase this period.  

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least


Copyright © 1996-2016 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License.

The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

Last modified: February 10, 2017