This documenation will show you how to "remaster" the
CactiEZ CD, in order to add your own packages (or otherwise customize it for you organization), and then reburn the CD.
First, I would like to point out, that this documentation is based off a ton of google searches in order to find the right information. I could not find any concise place that contains more than one or two bits of information, and most of it not directed at the
CentOS distribution. There is actually a lot more than this that is required if you happen to want to start from scratch off the base
CentOS CDs, I just have happened to do most of the work for you already.
In the process of creating and testing the CD's that I created, I can say that it is definitely so much faster and easier to use a virtual server application, such as VMWare, to test the CD installation, than actually using a real machine.
I definitely don't mind you using this information, or the
CactiEZ CD as your base, but I would like to ask that if you want to help improve the CD (within reason ofcourse) then let me know so that I can incorporate the changes into the official CD, instead of having to have multiple forks running around. This makes it easier on you, and on me when having to support these installs.
This documentation is based off of a host machine already running
CactiEZ, so if you are not using it, you may require additional RPMs.
We will start off by installing these packages, and all dependecies.
anaconda-runtime
mkisofs
anaconda
Use this command to make it easy on yourself.
yum install anaconda-runtime mkisofs anaconda
Next, you want to either mount the ISO using these commands
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
(Skip this step if you plan on using another way to get the CD files on the server)
For this tutorial, we will place the files in a directory in root called
/CD
Copy the files either remotely via SCP (using
WinSCP), or from the mounted CD with this command.
mkdir /CD
cp -R /media/cdrom/* /CD
copy /media/cdrom/.discinfo /CD
The copy command for some odd reason creates files called
TRANS.TBL in every directory that it copied to, so we will get rid of those now.
find /CD -name TRANS.TBL -exec rm {} \;
Now unmount the CDRom if you had mounted it
umount /media/cdrom
Now we create these scripts, I put them in /root/
makeiso.sh
#!/bin/bash
export PYTHONPATH=/usr/lib/anaconda
/usr/lib/anaconda-runtime/genhdlist /CD/
/usr/lib/anaconda-runtime/pkgorder /CD i686 > /CD/CentOS/base/pkgorder
/usr/lib/anaconda-runtime/genhdlist --withnumbers --fileorder /CD/CentOS/base/pkgorder --hdlist /CD/CentOS/base/hdlist /CD
find /CD -name TRANS.TBL -exec rm {} \;
mkisofs -r -T -J -V "CactiEZ" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -v -o /root/Cacti.iso /CD
testrpms.sh
#!/bin/bash
cd /CD/CentOS/RPMS
mkdir /tmp/testdb
rpm --initdb --dbpath /tmp/testdb
rpm --test --dbpath /tmp/testdb -Uvh *.rpm
rm -fr /tmp/testdb
You will want to make both of these scripts executable by running these commands
chmod +x /root/makeiso.sh
chmod +x /root/testrpms.sh
testrpms.sh is used for when you add RPM packages to the CD. It will test all the packages to ensure that there are no dependecy problems. This is exceedingly useful, as you don't have to wait until after you created the CD and tried to install it, to find out you are missing a package. Upon running the script, it is safe to ignore any warning, such as
warning: apr-0.9.4-24.5.c4.1.i386.rpm: V3 DSA signature: NOKEY, key ID 443e1821
as these just mean that you do not have a GPG key for the package, but it will install successfully without it. If you see this
Preparing... # # # # # # # # # # [100%]
then it means there are no dependecies problems, so you are now able to create the CD.
makeiso.sh is the script that does the actual CD creating. We create the list of packages, and the proper order they should be installed in, and then we creat the ISO image. The script as written will place the ISO in /root directory.
Now you can make modifications to the /CD directory, and easily test the CD and recreate the ISO.
The most important file that you will deal with is
ks.cfg which will be directly in the /CD/ directory. This file is the "automation" script which tells the installer what to do. Here you specify what packages to install, the root password, and all the commands to run after the installation if complete.
The two important areas in this script are marked by
%post --nochroot
and
%post
Everything after the
%post --nochroot is not using the "normal" base root that you are accustomed to. Instead the physical hard drives are mounted. You can access the normal root here
/mnt/sysimage
Generally here we mount the CD-Rom and do any work we have to do with it (like copying all the files off), before changing to the "normal" root.
Now when we switch to
%post all the paths are exactly as they will be on your new install. Here we can do most anything we want, such as starting services (
MySQL must be started inorder to import databases!), removing services we don't want, changing directory permissions, setting up the cron jobs, etc... It is important to note, that most of these items can also be done in the
--nochroot enviroment, but I find it easier this way, as I believe so will you.
An important directory on the CD is
This is the directory where you will place any RPMs that you want installed. You can also remove old RPMs that aren't needed anymore (for instance if you add upgraded RPMs) or if you decide to remove features (be sure to remove the listing for the RPMs in
ks.cfg or else your install will fail!).