A live CD is a bootable CD with a complete Linux system on it. A live CD which contains the Campcaster packages can be used to demo Campcaster without having to install anything on the hard drive.
It can also be used to create a new, complete Ubuntu system on the hard drive, with Campcaster automatically installed on it.
The live CD creation process consists of the following steps:The live CD produced with this HOWTO (as of revision 3055) has the following issues:
$ export WORK=~/mylivecd $ mkdir -p $WORKMount a (K)Ubuntu Linux Live CD
$ mount -t iso9660 /dev/hdc /cdromor the ISO image:
$ sudo mount -t iso9660 -o loop /path/to/dapper-live-i386.iso /cdromThen copy the content of the disk into a new directory, set the write permission on the new directory’s content, and unmount the Live CD (or the ISO image):
$ cd $WORK $ mkdir ubuntu-livecd $ cp -a /cdrom/. ubuntu-livecd $ chmod -R u+w ubuntu-livecd $ sudo umount /cdromThe directory contains about 690 MB. You need a copy, because it will be modified.
$ rm -rf $WORK/ubuntu-livecd/programsThe Live CD works fine without these programs. That saves about 30 MB.
The visible content of the Live CD is mainly used for booting. (K)Ubuntu Linux itself is contained in a compressed filesystem image in $WORK/ubuntu-livecd/casper/filesystem.squashfs.
To decompress and read this file, you need the squashfs module (installed by default on Ubuntu Dapper), and the squashfs-tools
package.
Finally loopback mount the compressed filesystem on a new mount point, say $WORK/old:
$ mkdir $WORK/old $ sudo mount -t squashfs -o loop,ro $WORK/ubuntu-livecd/casper/filesystem.squashfs $WORK/oldHave a look at $WORK/old. You should see the root of the (K)Ubuntu filesystem.
$ sudo dd if=/dev/zero of=$WORK/ubuntu-fs.ext2 bs=1M count=2500Format the file with an Ext2 filesystem:
$ sudo mke2fs $WORK/ubuntu-fs.ext2mke2fs will warn you that ubuntu-fs.ext2 a not a real device. This is ok, proceed.
$ mkdir $WORK/new $ sudo mount -o loop $WORK/ubuntu-fs.ext2 $WORK/new
$ sudo cp -a $WORK/old/. $WORK/newWe can umount $WORK/old now, because we have copies of all the data we need:
$ sudo umount $WORK/old
Now it’s time to fine-tune the system to your needs, chrooting into the new system and using the standard Debian/Ubuntu tools.
First, prepare the /proc filesystem and create the /etc/resolv.conf and /etc/hosts files in the copied filesystem. Then stop some services to make sure their ports are available in the chrooted system. Finally, chroot into you live CD environment:
$ sudo mount -t proc -o bind /proc $WORK/new/proc $ sudo cp /etc/resolv.conf /etc/hosts $WORK/new/etc/ $ sudo /etc/init.d/campcaster-scheduler stop $ sudo /etc/init.d/postgresql-8.1 stop $ sudo /etc/init.d/apache2 stop $ sudo chroot $WORK/new /bin/bash
Now you are at the root of the (K)Ubuntu filesystem. Tweak the system as you like:
# vi /etc/apt/sources.list # (Enable the universe and campware repositories.) # apt-get update # apt-get install campcaster-studio # apt-get clean # vim /opt/campcaster/etc/campcaster-scheduler.xml # (Change the sound # vim /opt/campcaster/etc/campcaster-studio.xml # devices to "default".)
Stop the services started by the package installer, and leave the (K)Ubuntu filesystem:
# /etc/init.d/campcaster-scheduler stop # /etc/init.d/postgresql-8.1 stop # /etc/init.d/apache2 stop # exit $ sudo umount $WORK/new/proc $ sudo rm $WORK/new/etc/resolv.conf $WORK/new/etc/hostsYou are back at your own system.
$ sudo chroot $WORK/new dpkg-query -W --showformat='${Package} ${Version}n' > $WORK/ubuntu-livecd/casper/filesystem.manifestNext, clear the free disk space. Even if some Debian packages were removed, the unused space on the modified filesystem still holds the content. Fill all free space on the modified filesystem with zeroes (this will eventually fail with “no space left”), then remove the zero file:
$ sudo dd if=/dev/zero of=$WORK/new/dummyfile $ sudo rm $WORK/new/dummyfileNow, all unused data blocks are filled with zeroes and compress to almost nothing.
$ sudo rm $WORK/ubuntu-livecd/casper/filesystem.squashfs $ cd $WORK/new $ sudo mksquashfs . $WORK/ubuntu-livecd/casper/filesystem.squashfsThis is the most time-consuming step. Umount $WORK/new now, we are done:
$ cd $WORK $ sudo umount $WORK/new
$ cd $WORK/ubuntu-livecd $ sudo find . -type f -print0 |xargs -0 md5sum |sudo tee md5sum.txtNow build the ISO image file, ubuntu-new.iso:
$ cd $WORK $ sudo mkisofs -o Ubuntu+Campcaster.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -r -V "Ubuntu+Campcaster Live CD" -cache-inodes -J -l ubuntu-livecd
Burn Ubuntu+Campcaster.iso to a disk and you are done!
For testing, a virtual PC like qemu is great.