Building your own LiveCD
The build scripts provided here should allow you to build your own Scientific Linux Live CD. This scripts (with some modifications) are also used to build the
CentOS 4 Live CD. You can either install Scientific Linux on a normal PC and use this system as a build system for your livecd. Or you can build the LiveCD in a chroot environment as described below.
WARNING: Do not run the build script on your PC ! On
ly run it on a special build PC or in the chroot environment !! The build scripts will change the system and will/can make your system unusable.
Some parts of the following description are taken from
How to make a CentOS 4 Live CD. You will need root access for many of these steps (for chroot and mount) but it is designed to not impact your main install. The build is done in a single directory.
No special livecd kernel is required. The standard Scientific Linux kernel can be used. You just have to install the unionfs and squashfs kernel modules for SL4 and aufs kernel modules for as SL5 as described below.
- Start with a working Scientific Linux 4/5 system. You will need a working yum setup.
- Make a new directory to build in, for example
LIVE=/scratch/livecd
mkdir -p $LIVE
- You need about 4 GB free space in the directory $LIVE to build a live CD having the size of 700 MB.
- Make some subdirectories
cd $LIVE
mkdir dev proc sys etc tmp
- Create some files to avoid error messages later
touch etc/fstab etc/mtab
- Mount some virtual filesystems. If you reboot, you will have to redo this step
mount --bind /dev dev
mount null -t proc proc
mount null -t sysfs sys
- Copy your existing yum.conf and /etc/yum.repos.d directroy into the new etc directory:
cp -a /etc/yum.conf $LIVE/etc
cp -a /etc/yum.repos.d $LIVE/etc/
- Create directory for rpm transaction lock:
mkdir -p $LIVE/var/lock/rpm
- Install the system with yum like this:
yum -c $LIVE/etc/yum.conf --installroot=$LIVE install yum rootfiles shadow-utils \
bind-utils gnupg vim-enhanced vixie-cron crontabs passwd which kudzu dhclient \
pciutils eject alsa-utils mkisofs wget kernel grub
- This should install around 130 packages for a total of about 110-150 MB.
- Enable the use of shadow passwords
cd $LIVE
sed -i "s|\*|x|" etc/passwd
sed -i "s|^root::|root:x:|" etc/passwd
cat etc/passwd | cut -d":" -f 1 | while read u; do echo "$u:*:12345:0:99999:1:::"; done >> etc/shadow
chmod 600 etc/shadow
- And for /etc/gshadow
cp -a etc/group etc/gshadow
sed -i "s|:x:|::|" etc/gshadow
sed -i "s|:[0-9]\+:|::|" etc/gshadow
chmod 600 etc/gshadow
- To allow choosing different keyboard layouts install
yum -c $LIVE/etc/yum.conf --installroot=$LIVE install kbd system-config-keyboard
- To install a basic graphical environment (x-server, login manager, windows manager)
yum -c $LIVE/etc/yum.conf --installroot=$LIVE install system-config-display gdm xterm icewm
- Without the package "system-config-display", the x-server will be not correctly configured !
- Install further rpms using yum, for example to add KDE
yum -c $LIVE/etc/yum.conf --installroot=$LIVE install kdeartwork kdebase \
kdegraphics kdelibs kdemultimedia kdenetwork kdepim kdesdk kdeutils
- You will have to play around until you find which packages you need.
- For example to access remote Linux systems you may want to add openssh client
yum -c $LIVE/etc/yum.conf --installroot=$LIVE install openssh-clients
- You can make any changes you would like to have on your Live CD now or you can do this later also in chroot.
- Copy resolv.conf to the chroot (so yum will work in the chroot)
cp /etc/resolv.conf $LIVE/etc
- Copy your networking configuration file
cp /etc/sysconfig/network $LIVE/etc/sysconfig/
- You may want to copy other system config files, like
cp /etc/sysconfig/i18n $LIVE/etc/sysconfig/
cp /etc/sysconfig/authconfig $LIVE/etc/sysconfig/
cp /etc/sysconfig/kernel $LIVE/etc/sysconfig/
cp /etc/sysconfig/clock $LIVE/etc/sysconfig/
- In case of SL5 squashfs is included in the kernel. You only have to install the squashfs-tools, which are part of SL5:
chroot $LIVE
yum install squashfs-tools
- Aufs (another union file system) seems to be more stable than unionfs. Aufs can be compiled against the SL5 kernel whereas the SL4 kernel is too old. Prebuild aufs RPMs for SL5 kernels can be found here http://www.livecd.ethz.ch/download/RPMS/5x
- Starting with kernel version 2.6.18-128.1.1.el5 aufs is now part of SL5, just run
yum install aufs
to install aufs and the related kernel module.
- If you run another kernel, you can rebuild aufs RPMS from the SRPMS: http://www.livecd.ethz.ch/download/SRPMS/5x. The usage of rpmbuild for aufs is described in the aufs.spec file.
- Download the latest build scripts (livecd-x.x.tar.gz) from here http://www.livecd.ethz.ch/download/build
- Copy the tarball to chroot, for example into the folder build
mkdir $LIVE/build
cp livecd-x.x.x.tar.gz $LIVE/build
- chroot into the p_w_picpath
chroot $LIVE
- Unpack the scripts in chroot
cd /build
tar xfvz livecd-x.x.x.tar.gz
- Change to the livecd build script directory
cd /build/livecd-x.x.x
- Change the configuration in the file livecd.conf:
vi livecd.conf
- You have to specify the kernel version that you have installed inside chroot environement. Assuming you kernel is 2.6.9-42.0.3.EL change in livecd.conf:
KERNEL="2.6.9-42.0.3.EL"
- And you have to define the OS_RELEASE in livecd.conf. For SL4, RHEL4, CentOS4 set
OS_RELEASE=4
For SL5, RHEL5, CentOS5 setOS_RELEASE=5
- Please note: Before livecd-2.9.0 you had to define the OS_RELEASE with an option passing to build-livecd.sh, see:
build-livecd.sh -h
- In addition you can set the OS update release. For example for SL 5.3 set
OS_UPDATE=3
- You can define more in livecd.conf, For example, in order to set the default runlevel of your LiveCD to 3, change in livecd.conf
RUNLEVEL=3
- Or if you want to add some extra boot parameters
EXTRA_BOOT_OPTIONS="kb=us nopasswd"
- Now run the build script
WARNING: Always run the scripts in the chroot environment !!./build-livecd.sh
- The creation of the compressed p_w_picpaths, particularly usr.mo, will take some time.
- If everything goes well, you should get the LiveCD ISO created in /tmp/livecd.iso or $LIVE/tmp/livecd.iso, respectively.
- For more information about the build scripts see also the README file provided within the tarball.