Any of us was faced with fact that he need some custom installation of Linux. I spend few days to make my own ISO. Below are steps how you can do that. You should have ISO of linux you want to customize. In my case it was RHEL, so I download it from rhn network. After that I need to setup my system so I can reach content on ISO. I will create directories /rhel /newiso and /mount.

[root@setenforce ~]# mkdir /rhel In this directory I will copy content of ISO
[root@setenforce ~]# mkdir /newiso In this I will find my iso, setenforce.iso
[root@setenforce ~]# mkdir /mount In this I will mount RHEL.iso
[root@setenforce ~]# mount RHEL.iso /mount -o loop
[root@setenforce ~]# cp -rp /mount /rhel

Now you have all content of iso file in /rhel directory. You should copy your ks.cfg in this directory. Change your /rhel/isolinux/isolinux.cfg so he looks on next way:

label linux
kernel vmlinuz
append initrd=initrd.img ks=cdrom:/ks.cfg Change ks part with your configuration

On this way you don't need to enter where system can find your ks.cfg file. Now you should start next command inside /rhel directory

mkisofs -J -R -v -T -o /newiso/setenforce.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .

This will create setenforce.iso in directory /newiso. Last you should do is to write this iso on your CD/DVD so you can install your system.

How to make your ks.cfg

Second part of this is how to make ks.cfg file. Bigger part of ks.cfg you can get with command system-config-kickstart. This made me big problem. First of all, anaconda unmount /dev/cdrom before running post install script, so I need to make some part of script which will see where is my CD is physically.

%post --nochroot
cdrom=`cat /proc/sys/dev/cdrom/info | grep "drive name:" | sed 's/drive name://'| sed -e 's/^[ \t]*//'`

Mounting disk you will do on next way:

mount -t iso9660 /dev/$cdrom /mnt/sysimage/mnt/cdrom

Now you can copy files from your CD, because they are located in /mnt/sysimage/mnt/cdrom. For example, if you want to copy file from CD to /opt/SETENFORCE directory, you should do next:

cd /mnt/sysimage/mnt/cdrom
cp package.rpm /mnt/sysimage/opt/SETENFORCE

You should pay attention that this is nochroot environment, so if you want to make some directory which will be available on system, for example /opt/SETENFORCE, you should do next:

mkdir -p /mnt/sysimage/opt/SETENFORCE

After few iso's I see that rpm and chkconfig command doesn't work in nochroot environment, so if you want to install something which was copy in your /opt/SETENFORCE you should chroot that environment, so I add next:

%post
rpm -ivh /opt/SETENFORCE/package.rpm

This will install package named package.rpm All works like a charm, and I have my own customized RHEL.