Introduction
This document will describe How to Create a Linux LiveCD using kickstart method. This is the very fast and convenient method of producing LiveCDs. This method can be used only on RedHat based distribution only e.g. Fedora, CentOS. The Method of producing LiveCDs based on Debian distribution is different and is not described here. A manual procedure of modifying a LiveCD is described in the following link.
OS Remastering CentOS 5.5 using Manual Method
Objective
We will be creating a highly customized CentOS 5.5 Based LiveCD which will have some external third party rpm packages as well.
Software Requirement
1) CentOS 5.5 DVD
This can be downloaded from below link
http://mirror.as29550.net/mirror.centos.org/5.5/isos/i386/CentOS-5.5-i386-bin-DVD.iso
2) Third Party RPM package which is to be installed in Live CD. In this case we are using NTFSProgs package which is not available in CentOS repositories.
http://packages.sw.be/ntfsprogs/ntfsprogs-1.13.1-1.el5.rf.i386.rpm
Procedure Overview
First we will install a regular CentOS 5.5 on a system. This can be done on a VM as well. In this installed machine we will build our LiveCD.
Install the Base System
We installed the CentOS 5.5 using CentOS 5.5 DVD in a VM. We used KVM for this purpose.
First create the Virtual Harddisk using following command. and then run VM and finish OS installation
qemu-img create -f qcow2 /VIRTUAL/QEmu/CentOS/CentOS-5.5-i386.img 10G
kvm -smp 4 -m 2048 -hda /VIRTUAL/QEmu/CentOS/CentOS-5.5-i386.img -cdrom /DATA/Install/ISO/CentOS/CentOS-5.5-i386-bin-DVD.iso -usb -usbdevice tablet -vnc :40 -net nic,macaddr=00:00:00:00:00:01 -net tap,script=
I installed the system with minimum utilities. Only Base and Administration Utilities.
Configure the Base system.
Add a repository for LiveCD tools.
Create a file /etc/yum.repos.d/CentOS-LiveCD.repo with following contents.
# Name: CentOS LiveCD repository
[livecd]
name = CentOS $releasever - LiveCD
baseurl = http://www.nanotechnologies.qc.ca/propos/linux/centos-live/$basearch/live
enabled=1
protect=0
gpgkey = http://www.nanotechnologies.qc.ca/propos/linux/RPM-GPG-KEY-PGuay
Install LiveCD tools.
Run the following command to install the LiveCD tools.
yum install livecd-tools syslinux
This is our full blown running OS on a harddisk. We will be creating the LiveCD in this system. All the following commands henceforth will be carried out in this machine only.
Mount cdrom
Run the following command to mount the cdrom.
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
Prepare the directory containing third party tools.
mkdir /root/livecdkickstart_files
Place the files in this above directory which you want to include in your customized LiveCD. In this case we had included following files.
BackupRestore.sh
command.txt
isolinux.cfg
kick.ks
ntfsprogs-1.13.1-1.el5.rf.i386.rpm
pcbackup_keys
README
root_ssh_config
ssh
WindowsPCBackup.sh
In the above listed files kick.ks is the kickstart file which will contain all the instructions for the customization of LIveCD. kick.ks is given at the end of this article.
Following are the contents of isolinux.cfg file
default menu.c32
timeout 100
menu title Welcome to BackupRestore CD ver 1.0 !
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color timeout_msg 0 #ffffffff #00000000
menu color timeout 0 #ffffffff #00000000
menu color cmdline 0 #ffffffff #00000000
menu hidden
menu hiddenrow 5
label linux0
menu label Backup This System
kernel vmlinuz0
append initrd=initrd0.img root=CDLABEL=LiveBackupRestoreCD rootfstype=iso9660 ro liveimg mode=Backup vga=0x314
label linux1
menu label Restore This System
kernel vmlinuz0
append initrd=initrd0.img root=CDLABEL=LiveBackupRestoreCD rootfstype=iso9660 ro liveimg mode=Restore vga=0x314
Create the LiveCD
Once you have required files and kickstart file run the following command to create the LiveCD.
cd /root/livecdkickstart_files
livecd-creator --config=kick.ks --fslabel=LiveBackupRestoreCD
kick.ks file
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use hard drive installation media
#harddrive --dir=/tmp/fedora --partition=sda8
repo --name=cdrom --baseurl=file:///tmp/fedora
# To compose against the current release tree, use the following "repo" (enabled by default)
repo --name=released --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-13&arch=$basearch
# To include updates, use the following "repo" (enabled by default)
repo --name=updates --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f13&arch=$basearch
# Root password
rootpw --iscrypted $1$x9PSyNru$RR5iKsKjlRpaMBgGrg3a81
# System authorization information
auth --useshadow --passalgo=md5
# Use text mode install
text
# System keyboard
keyboard uk
# System language
lang en_GB
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
#logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Europe/London
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all
%post
%end
%packages --nobase
@admin-tools
openssh-server
-PackageKit-yum-plugin
-coolkey
-fedora-release-notes
-finger
-fprintd-pam
-ftp
-gnupg2
-hunspell
-iptstate
-irda-utils
-jwhois
-krb5-workstation
-lftp
-mlocate
-mtr
-nc
-nss_db
-nss_ldap
-pam_krb5
-pam_pkcs11
-pam_smb
-perf
-rdate
-rdist
-rsh
-sos
-sssd
-talk
-tcp_wrappers
-telnet
-time
-tree
-vconfig
-words
-ypbind
%end