Copy CDs to Disk
Trim Packages
Kickstart
Make CD
Troubleshooting
RedHat 8
My customized files:
Makefile
boot.msg
comps
ks.cfg
syslinux.cfg
The following document has been created because I've not been able to find a suitable alternative. Certainly there are numerous pages on how to install RedHat Linux using kickstart, but there are nuggets of information here that I still have been unable to find documented elsewhere about making custom boot CDs.
First things first. If you use the following procedures, please consider buying an official copy of RedHat Linux. You can usually get a copy for close to US$50 and I feel strongly that it is important to support the cause.
So I wanted to customize the RedHat installation CD which came with their 7.2 release. I wanted to:
To help with some of the below instructions, I have written a Makefile.
First thing to do is to copy the 2 CDs to your harddrive. You will be modifying configuration files and boot images, and then writing a new CD from this directory. You will need at least 1.4gb free for this operation.
The next stage of the process is to trim down the list of packages
until you get below the 700mb that will fit onto one CD. In general,
I sorted the RedHat/RPMS
directory by size and started at
the top and moved down removing the rpms that I knew I did not need.
You need to be careful here because there are dependencies between
packages that aren't always expected.
To check for dependencies, you can use the following commands. If
you have my Makefile installed, you can enter
make depend
to do this.
mkdir /tmp/testdb rpm --initdb --dbpath /tmp/testdb cd cdrom/Redhat/RPMS rpm --test --dbpath /tmp/testdb -Uvh *.rpm rm -rf /tmp/testdb
I'm not positive on what output from these commands to watch for which insures a "correct" list of RPMs but if you get any "is needed by" messages, they definitely need to be fixed before you can cut your CD. You will get two different types of dependencies. A certain number will be extraneous packages which you can remove because they are not needed on your CD. If you remove a package you might create other dependency problems, so make sure you run the above commands multiple times until you get no "is needed by" messages. However, others dependency errors will be RPMs that you want to install however can't because they depend on other packages. You will have to add to the RPMS directory the RPMs which satisfies these dependency problems. Make sure to remake the hdlist after adding or removing any RPMs.
If you get no "is needed by" lines and you get to the "Preparing" message with a progress bar then I think this means that you are good to go. It also seems like the 143 error code is okay while 144 and 145 are bad and need to be fixed.
NOTE: It may take a couple of cycles of adding packages, resolving dependencies, trimming packages to make more space for new packages, etc..
Comps File
In the RedHat/base
directory on the 1st CD is the comps
file which is what anaconda reads
when it displays the various packages of RPMs. It is also used used
by the %packages
section of the ks.cfg
file.
An example the comps file is:
4 1 Base { MAKEDEV anacron ... } 0 --hide Network Server { @ Network Support (arch !i386): vnc finger-server ? X Window System { i386: compat-libstdc++ libpcap } ... }
The leading 4 is the version number of the file. The
1 Base {
defines a collection of RPMs
associated with the Base package. The 1 means that it is enabled by
default. The
0 --hide Network Server {
defines the
Network Server package which is off by default. The --hide means that
it should be hidden from the user's package selection tool in
anaconda.
Here is my version of the comps file. I don't think that I edited it at all although you may need to if you have specific package requirements that don't map well into the Base and other standard package collections.
The @ Network Support
line means that the Network
Server package includes the Network Support package. The (arch
!i386)
line allows certain packages to be installed if (or in
this case if not) installing on specific architecture. The
? X Window System {
line means that
if X windows is installed then the packages in subsection are included
in Network Server package.
In any case, by looking at this file, you can see which RPMs you use when you install a Network Workstation and which ones are candidates for removal if you don't install X11 stuff. Again, be careful because there are dependencies, often obtuse, which may require packages that you would not expect.
NOTE: you should not need to include RPMs that you have in your directory because of dependencies in the comps file. They should be loaded automatically.
Rebuilding the hdlist
File
After you have trimmed down your packages, it has been recommended
that you use the anaconda-runtime tool
check-repository.py
(located in the
/usr/lib/anaconda-runtime/ directory) to check the comps file. This
utility checks to make sure every package listed in the comps file is
present in the RedHat/RPMS/ directory. If there are no errors the
installation should not fail. Thanks Vito!
If you have removed RPMs from the directory, you will need to
rebuild the hdlist
file which lists which RPMs are
available on the first CD. I think it assumes that if it is not on
the first CD then it must be on the second one. You will need to
build the genhdlist
utility which should be included in
the anaconda source release.
ftp://ftp.redhat.com/pub/redhat/redhat-7.2-en/os/i386/SRPMS/anaconda-7.2-7.src.rpm
In the utils
directory in the source tarball, should
be the genhdlist.c
which should be buildable with
make genhdlist
. Once you have the utility you can chdir
into your unpackages CD directory and type:
genhdlist --withnumbers --hdlist RedHat/base/hdlist `pwd`
If you have my Makefile installed, you can
enter make hdlist
to do this. I'm not sure what the
--withnumbers
does and it may not be necessary. At some
point I was trying to fix a warning message that I saw. If you
rebuild the hdlist
file, make the CD, and try to install
and it prompts for the 2nd CD in the set then you probably missed a
dependency. See the section on how to resolve
dependencies.
RedHat Linux (maybe others) has a built in automatic installation
system called kickstart. For more details see the good documentation on the RedHat site. The Anaconda installation
program uses the ks.cfg
configuration file to
automatically perform the installation. Here's a taste:
timezone America/New_York rootpw _foobarbaz_ part /boot --fstype ext3 --size 52 firewall --medium --ssh
The previous excerpt from my ks.cfg
file sets the
timezone to EDT, sets the root password, creates a 52mb /boot
partition on the disk, and enables a medium strength firewall which
allows in ssh connections.
Here is the full ks.cfg file that I use. There are a post script section at the end of the file which you can use to do any localized configurations such as adding accounts, enabling sudo, starting ntp, disabling the sendmail init.d script, etc..
WARNING: if you are not careful, you can blow away an entire system in seconds with kickstart on an installation CD. It is designed to be fast and efficient and it will repartition your drive very quickly if you aren't careful.
NOTE: to enable kickstart installation you have to tune the kernel options in the syslinux.cfg boot config file.
So I just got a message from a user who was able to get the
ks.cfg
to work on Redhat Enterprise 3 just by putting it
in the root of the CD #1 and adding the ks=cdrom
to the
boot options. This means that you may not have to put the
ks.cfg
file inside of the cdrom boot image as described
below. Not sure on what other versions this works for.
It took me a couple of tries to find the proper place to put my
ks.cfg
so that it would be seen by the installer. On the
cdrom there is the dosutils/autoboot/cdboot.img
file
which is a 2.88mb floppy image. This floppy is what the cdrom uses to
boot. It contains the bootstrap information, initial kernel, and file
system to load. The ks.cfg
file needs to be placed in
the /tmp
directory in the memory filesystem, which
happens to be a gziped ext2 filesystem -- seriously.
Here are the steps needed to copy the ks.cfg
file
onto the CD. If you have my Makefile
installed, you can enter make ks
to do this.
Warning: You need to be careful how much you add to the floppy image so that it does not run out of space.
NOTE: If this doesn't work when you boot, see the top of
this section on a different location for the ks.cfg
file.
So now you have edited your kickstart config file and have
installed it into the floppy image on the CD. You now need to edit
how it boots from the floppy. If you have my Makefile installed, you can enter
make editflop
to do this.
This mounts the boot floppy image again and edits the directory.
The files in the boot image boot.msg Initial screen shown by the bootloader expert.msg Screen you get by pressing F3 general.msg Screen you get by pressing F2 initrd.img Compressed memory filesystem ldlinux.sys DOS boot loader I suspect param.msg Screen you get by pressing F4 rescue.msg Screen you get by pressing F5 syslinux.cfg Boot loader configuration file including kernel arguments and options vmlinuz Linux kernel to load
To get the kickstart to work automatically,
you will need to tune the kernel boot parameters in the syslinux.cfg file. You should add the
ks=floppy
option to allow it to boot with kickstart
enabled by pressing enter on the boot screen. This is required to get
kickstart working.
My syslinux.cfg file is available, by
adding ks=floppy
and text
and removing the
vga=788
I caused it to install by default using the
kickstart config file in text mode.
Aside from adding the ks.cfg
file to the
initrd.img
and tuning the boot options, I have also
customized the boot.msg file to add my own
messages on the initial boot screen (you'll have to figure out the
format of the file yourself).
So you have adjusted your RPM list to get below 700mb and remade
the hdlist
file. You have added your ks.cfg
kickstart file with all of your favorite initialization settings and
written it into the cdboot.img
file. You have also tuned
the boot options and boot screen messages. Now you are ready to burn
a new CD. Make sure that your CD can hold the files in your cdrom
directory. You can redirect the mkisofs command below into a file (or
pipe through wc -c) to see how big it is.
If you have my Makefile installed, you can
enter make cdr
to make a CD-R, make cdrw
to
make a CD-RW, or make cd_image
to make a CD image file.
Below are the instructions on how to do this.
You will need SCSI support on your system. If you are trying to get your ATAPI cdrom drive working, you may need to:
Make sure that the IDE-CD modules are not installed:
And make sure that the IDE-SCSI and SCSI-generic modules are installed:
mkisofs -b dosutils/autoboot/cdboot.img -l -J -R -r -T \ -V 'Custom RH Install' . | \ cdrecord -v blank=fast speed=4 dev=0,0,0 -
blank=fast
argument to cdrecord
. You should be all set. Put your new CD in a computer which can be blown away and reboot it so it boots from the cdrom. Enjoy!
%post --nochroot # the --nochroot is necessary to not change root into the new installation cp /mnt/source/dir/file /mnt/sysimage/dir/file # where /mnt/source is the install media # and /mnt/sysimage is the new installation
Thanks to Arvind Singh for the following notes.
In the post section of ks.cfg, anaconda umounts the cdrom. If you need to copy files from the cdrom you have to temporarily mount the cdrom by creating a directory and mounting it as ISO.
mkdir /tmp/one mount -t iso9660 /tmp/cdrom /tmp/one cp /tmp/one/yourfiles /mnt/sysimage/root/ umount -f /tmp/one rmdir /tmp/one
Please submit your own feedback about these instructions.
Free Spam Protection Android ORM Simple Java Zip JMX using HTTP Great Eggnog Recipe