Debian/Ubuntu Tips and Tricks

Debuntu

Debian/Ubuntu Tips and Tricks

How-To: Customize your Ubuntu Live CD — page 2

Posted by chantra on December 22nd, 2007

This entry is part 2 of 2 in the series How-To: Customize your Ubuntu Live CD

3. Customizing our future live CD

3.1. Removing packages

First of all, we are going to remove non-english language pack, and in order to free some more space, we are going to remove gnome-games packages.

# apt-get remove --purge gnome-games*
# apt-get remove --purge `dpkg-query -W --showformat='${Package}\n' | grep language-pack | egrep -v '\-en'`

Mind that you might want to remove some other software. In order to see installed software, you can run the following:

# dpkg-query -W --showformat='${Package}\n' | less

3.2. Updating the existing image

Now that we have remove softwares we do not need, we can update our /etc/apt/sources.list in order to enable universe and multiverse repository along with gutsy-updates, gutsy-security and the partner repository so we can install vmware-server.

Open and edit /etc/apt/sources.list

# vim /etc/apt/sources.list

and make it look like:

deb http://archive.ubuntu.com/ubuntu gutsy main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu gutsy main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu gutsy-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu gutsy-updates main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu gutsy-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted universe multiverse

deb http://archive.canonical.com/ubuntu gutsy partner
deb-src http://archive.canonical.com/ubuntu gutsy partner

Now we can update the image by running:

# apt-get update
# apt-get dist-upgrade

3.3. Installing new packages

Let install all multimedia packages that we might need. As per http://www.debuntu.org/how-to-play-dvd-under-ubuntu-linux, we need to install:

# apt-get install gstreamer0.10-ffmpeg gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse vlc mplayer mplayer-fonts
# /usr/share/doc/libdvdread3/install-css.sh

Then, let install RealPlayer:

# wget http://www.debian-multimedia.org/pool/main/r/realplay/realplayer_10.0.9-0.1_i386.deb -O /tmp/realplay.deb
# dpkg -i /tmp/realplay.deb

Now, let's install some utils that are not included by default on Ubuntu live cd but become handy most of the time:

# apt-get install rar unrar unace-nonfree

Plus, let's install some wireless network utils so we might be able to get wireless functionning with the live CD:

# apt-get install ndiswrapper-common ndiswrapper-utils-1.9 cabextract unshield \
bcm43xx-fwcutter \
kismet aircrack-ng

Let's add some other network network utility tools:

# apt-get install wireshark nmap ettercap traceroute

Also, we are going to add some firefox plugins:

# apt-get install flashplugin-nonfree mozilla-plugin-vlc

On the top of this, I want to be able to use skype and vmware-server:

# apt-get install libqt4-core libqt4-gui
# wget http://skype.com/go/getskype-linux-ubuntu -O /tmp/skype.deb
# dpkg -i /tmp/skype.deb
# apt-get install vmware-server

Well, that's about it, we now have whatever software that we (I) will need when using our live CD.
It is now about time to do some clean up.

4. Cleaning up the chroot

When we install packages, apt caches the packages, we will need to remove them in order to save some space:

# apt-get clean

Also, there is some files in /tmp that need to be removed:

# rm -rf /tmp/*

Before chrooting, we have added 2 files: /etc/hosts and /etc/resolv.conf, let remove them:

# rm -f /etc/hosts /etc/resolv.conf

Finally, we are ready to exit the chroot and repack the CD. We need first to umount /proc and /sys:

# umount /proc/
# umount /sys/
# exit

Finally, we are back to our host, as we have modified some packages, we need to rebuild some manifest files, recreate the squashfs and recreate the ISO.

5. Recreating the ISO

Fisrt, lets recreate the manifest files:

$ chmod +w ~/livecd/cd/casper/filesystem.manifest
$ sudo chroot ~/livecd/custom dpkg-query -W --showformat='${Package} ${Version}\n' > ~/livecd/cd/casper/filesystem.manifest
sudo cp ~/livecd/cd/casper/filesystem.manifest ~/livecd/cd/casper/filesystem.manifest-desktop

And regenerate the squashfs file:

$ sudo mksquashfs ~/livecd/custom ~/livecd/cd/casper/filesystem.squashfs
Parallel mksquashfs: Using 2 processors
Creating little endian 3.0 filesystem on ~/livecd/cd/casper/filesystem.squashfs, block size 65536.
....
....

Now, alternatively, you might want to customize the file: ~/livecd/cd/README.diskdefines
and finally, update ~/livecd/cd/md5sum.txt which contains the files in ~/livecd/cd md5 sums:

$ sudo rm ~/livecd/cd/md5sum.txt
$ sudo -s
# (cd ~/livecd/cd && find . -type f -print0 | xargs -0 md5sum > md5sum.txt)

We are now almost done, the last thing left is too create the ISO with the following command:

$ cd ~/livecd/cd
$ sudo mkisofs -r -V "Ubuntu-Live-Custom" -b isolinux/isolinux.bin -c isolinux/boot.cat -cache-inodes -J -l -no-emul-boot -boot-load-size 4 -boot-info-table -o ~/Desktop/Ubuntu-Live-7.10-custom.iso .

Here you go, you can now test your image by either booting your computer with or by using a virtualization/emulation software such as qemu, kvm, vmware.....

6. Conclusion

With a bit of work, one can customize an Ubuntu Live CD in order to remove/include some softwares, make sure the live CD is up-to-date, and on the top of this, allow administrator to deploy pre-customized Ubuntu distros.

Series Navigation<< How-To: Customize your Ubuntu Live CD

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>