KNOW-HOW Livecd-creator

Building a custom live CD with Fedora’s livecd-creator ORIGINAL SPIN jlye, Fotolia

Fedora 7 comes with new tools for creating custom live CDs and tive. Some of the steps in the are memory intensive, so throw as much custom .iso files. We’ll show you how to get started with Fedora's new RAM as you can at the computer run- ning livecd-creator. If you don’t have command-line tool, livecd-creator. enough RAM, your machine will use BY COLIN MCGREGOR the hard drive for extra memory, which slows down the process. By default, livecd-creator puts a large he traditional technique for ra’s new command-line tool, livecd-cre- number of temporary files in /var/tmp, building a Live CD is to enter a ator, offers an alternative approach. which, depending on the size of your Tseries of commands that create Live-cd-creator lets you assemble a Live /var partition, could be a problem. My directories to represent the file systems CD using a few simple commands, and solution was to create an extra on the finished CD. Then you can manu- you can even use a kickstart .ks configu- in /home, where I had a lot of free space. ally install the files you need in the ap- ration file to specifies the contents of the I started up a terminal session and en- propriate directories, manipulate them finished CD. Fedora 7 also comes with a tered the following: as necessary, and assemble the directo- GUI-based tool, Revisor (Figure 1), for ries into an .iso file, and the .iso is creating custom .isos and Live CDs, and su burned onto a CD or DVD. other similar utilities – such as open- <> This procedure is often error prone, SUSE’s Kiwi – are available. This article cd /var and if you find you need to make some focuses on how to build a custom Live rm -rf tmp minor revisions three months down the CD with livecd-creator. mkdir /home/tmp road, you must repeat the process. ln -s /home/tmp tmp One solution to the repetition is to Getting Ready exit write scripts that assemble the files and Livecd-creator is not cross platform, so build the CD. Homegrown scripts, how- the computer you are using needs to be A small bug that can cause considerable ever, add additional complications. Fedo- running Fedora or a close Fedora rela- grief with livecd-creator has shown up in

48 ISSUE 85 DECEMBER 2007 Livecd-creator KNOW-HOW

Building a custom live CD with Fedora’s livecd-creator See /usr/share/livecd-tools/ for some repo -name=development U ready-made .ks configuration files. --mirrorlist=http://mirrors.U The Fedora project provides two Live fedoraproject.org/mirrorlist?U CD configuration files: repo=rawhide&arch=$basearch • livecd-fedora-minimal.ks – the base Live CD system Rather than directly editing the template • livecd-fedora-desktop.ks – complete .ks file, you may want to add your cus- ORIGINAL SPIN desktop with applications and tomizations through an include file: input/ output support for supported locales. %include U The easiest approach to creating a cus- included-livecd-setup.ks tom CD is to start with one of these tem- plate files and then add your own cus- This command will let you apply the tomizations. changes on top of the basic configura- Simply copy the file to your livecd di- tion file. rectory, and edit the file as necessary. Consult the Fedora documentation for a Adding and Removing full description of the kickstart file for- Packages mat. Once you have tinkered with the basic An example of a setting you may wish settings, you’ll need to decide which to change is the time zone: packages to include on the Live CD. The .ks file format provides a means for add- timezone US/Central ing and removing packages from the Live CD configuration. Add the core See /usr/share/zoneinfo for a full list of Fedora packages as follows: valid time zones. For nations like the United States and %packages Canada, which are stretched across a @base number of time zones, there is a direc- @core tory with the country name and a collec- @hardware-support tion of definition files, one for each time @admin-tools zone. @base-x Also, you must tell the software where the yum package-manager program. to get the packages and files used to cre- The %packages line tells the system to This bug is found in some updates to ate the Live CD, so make sure you have treat the subsequent lines as software to Fedora 7 and some of the pre-release ver- a line like the following in your .ks file: be added or removed. sions of Fedora 8. The solution is to per- form a regular software update or grab an updated version of yum from http:// koji.fedoraproject.org/koji/ .ks File The Live CD definition will appear in a kickstart-style .ks file. Kickstart files are normally used to allow people to auto- mate Fedora installation. See /usr/share/ livecd-tools/ for some example livecd-cre- ator-oriented kickstart files. Depending on what you're doing, the files in /usr/share/livecd-tools/ may be all you need. Search online for more sample .ks files. I created a directory called livecd in my home directory for .ks files. Any line that starts with a hash # in the files will be ignored. It is a good idea to make lib- eral use of # marks (rather than deleting unused lines) to simplify any changes you make later. Figure 1: Revisor is a GUI-based tool built on livecd-creator.

DECEMBER 2007 ISSUE 85 49 KNOW-HOW Livecd-creator

DESKTOP="KDE" DISPLAYMANAGER="KDE" EOF

Once you have defined a .ks file, or a collection of connected .ks files, it is time to create the .iso file that you will burn onto a CD or DVD:

livecd-creator -config=my-U config-file.ks -fslabel=U mylive-fedora Final Thoughts The time necessary for creating the Live CD .iso varies depending on factors such as computer speed, packages, available RAM, and package sources. For example, when creating a basic KDE-based Fedora Live CD on a Sempron 2400+ PC with Figure 2: See the Fedora wiki for additional information on working with livecd-creator. 768MB RAM and downloading files with a high-speed cable modem, the com- Adding and Removing but the password will not be written to mand takes a bit more than an hour. In Programs the CD. Also, you may want to add addi- the end, you’ll have an .iso file you can The next step is to add and/ or remove tional security measures, such as virtual burn to CD or DVD. programs from the core configuration to private network services. Creating a Live CD using livecd-cre- customize your CD. Add or remove indi- You can also write configuration files ator presents some challenges, but far vidual programs with commands like: to the Live CD for changing default web- fewer than when creating a Live CD browser bookmarks and other settings. without such a tool. anaconda The following lines create the file that Livecd-creator lets you skip much of anaconda-runtime tells the CD the default desktop is KDE. the grunt work associated with creating -samba-client a Live CD, and it turns the process into cat > U something reliable that's also easy to re- Any program that starts with a minus /etc/sysconfig/desktop <

# Add our user and apply a U password useradd -c "Hari Seldon" hseldon echo "newpass" | passwd --stdin U hseldon > /dev/null

The preceding code will place the plain- Figure 3: The Kiwi image creator, which is now integrated into YaST, is SUSE‘s answer to text password in the , Revisor and livecd-creator.

50 ISSUE 85 DECEMBER 2007