Revision as of 12:31, 1 December 2008
Creating a Fedora Live CD/DVD Using the Live CD Tools
This project concerns tools to generate live CDs or DVD's on Fedora based systems including derived distributions such as RHEL, CentOS and others. You can find Fedora Live images for download at http://fedoraproject.org
See the project wiki for more details. Discussion of this project takes places at the email@example.com mailing list at http://www.redhat.com/mailman/listinfo/fedora-livecd-list.
This project and its source files are licensed under the GPLv2 license. See the file COPYING for details.
Live CD Design Goals
The live CD is designed in such a way that, when running from a live CD, the system should appear as much as possible as a standard system with all that entails; e.g., read-write rootfs (achieved using dm-snapshot), standard ext3 file system (for extended attributes) and so on.
Another design goal is that the live CD should be installable, i.e., a user should be able to install the bits from the live CD onto a hard disk without this process requiring network access or additional media.
Finally, another design goal is that the tool set itself should be separate from configuration; the same unmodified tool should be usable for building various live CD flavors with vastly different configurations, e.g., a GNOME live CD, a KDE live CD, a live cd with music programs, and so on.
Creating a Live CD
To create a live CD, the livecd-creator tool is used. Super user privileges are needed. The tool is more or less self-documenting, use the --help option to see options.
The livecd-creator tool is part of the
livecd-tools package. If it is not installed on your system, add it with:
su -c 'yum install livecd-tools'
How the Live CD Creator Works
In a nutshell, the livecd-creator program
- Sets up a file for the ext3 file system that will contain all the data comprising the live CD
- Loopback mounts that file into the file system so there is an installation root
- Bind mounts certain kernel file systems (/dev, /dev/pts, /proc, /sys, /selinux) inside the installation root
- Uses a configuration file to define the requested packages and default configuration options. The format of this file is the same as is used for installing a system via kickstart.
- Installs, using yum, the requested packages into the installation using the given repositories
- Optionally runs scripts as specified by the live CD configuration file.
- Relabels the entire installation root (for SELinux)
- Creates a live CD specific initramfs that matches the installed kernel
- Unmounts the kernel file systems mounted inside the installation root
- Unmounts the installation root
- Creates a squashfs file system containing only the ext3 file (compression)
- Configures the boot loader
- Creates an iso9660 bootable CD
Example #1: A Barebones Live CD
livecd-creator \ --config=/usr/share/livecd-tools/livecd-fedora-minimal.ks
will create a live CD that will boot to a login prompt.
Live CD Configuration Files
The configuration of the live CD is defined by a file that uses the same format as installing a system via kickstart. They can include some basic system configuration items, the package manifest and a script to be run at the end of the build process.
For the Fedora project, there are currently two different live CD configuration files. They are
|livecd-fedora-minimal.ks||The base live CD system|
|livecd-fedora-desktop.ks||Complete desktop with applications and input/output support for all supported locales in Fedora|
Example #2: Spinning the Fedora Desktop Live CD
Assuming that you use the livecd-fedora-desktop.ks configuration file, then the following command
livecd-creator \ --config=/usr/share/livecd-tools/livecd-fedora-desktop.ks \ --fslabel=Fedora-LiveCD
will create a live CD called "Fedora-LiveCD".
The name given by --fs-label is used:
- as a file system label on the ext3 and iso9660 file systems (As such, it's visible on the desktop as the CD name)
- in the isolinux boot loader.
If you have the repositories available locally and don't want to wait for the download of packages, just substitute the URLs listed in the configuration file to point to your local repositories.
Testing your Live CD using QEMU
qemu-kvm -m 512 -cdrom filename.iso
Replace filename.iso with the name of your created Live CD image. NOTE: be sure to "yum install kvm qemu" as root.
Live CD Installs
As of Fedora 7, anaconda has support for doing an installation from a live CD. To use this, double click on the Install to Hard Drive item on the desktop or run
if you don't have such an icon.
Live CD Media Verification
The live CD can incorporate functionality to verify itself. To do so, you need to have isomd5sum installed both on the system used for creating the image and installed into the image. This is so that the implantisomd5 and checkisomd5 utilities can be used. These utilities take advantage of embedding an md5sum into the application area of the iso9660 image. This then gets verified before mounting the real root filesystem.
Using Live Images from USB Media
USB sticks are becoming increasingly prevalent and are a nice way to use live images. You can take a live CD iso image and transform it so that it can be used on a USB stick. To do so, use the livecd-iso-to-disk script:
/usr/bin/livecd-iso-to-disk /path/to/live.iso /dev/sdb1
Replace /dev/sdb1 with the (unmounted) partition where you wish to put the live image. This is not a destructive process; any data you currently have on your USB stick will be preserved.
Additional information available at How to Install Live Image to USB Flash Drive.