Create a fedora live CD
The first step is to get livecd-tools rpm, which can be obtained from the fedora homepage of zeuthen.
. Get and install livecd-tools-001-1.i386.rpm directly, as shown below:
$ su - <Enter root password> # wget -c http://people.redhat.com/davidz/livecd/i386/livecd-tools-001-1.i386.rpm # rpm -ivh livecd-tools-001-1.i386.rpm |
Use nowlivecd-creator
Command. You can obtain a simple command list by calling this command without any options.
Listing 2. options provided by the livecd-creator command
$ livecd-creator No packages specified.
usage: livecd-creator [--help] [--repo=<name1>,<url1> ...] [--repo=<name2>,<url2>] --package=<p1> [--package=<p2> ...] [--exclude-package=<e1>] --exclude-package=<e2> ...] [--base-on=<path-to-iso-file>] [--fslabel=<label>]
--help : Print usage and exit --repo : Path to yum repository --package : Include this package --exclude-package : Exclude this package --base-on : Add packages to an existing live CD iso9660 image --fslabel : File system label (default: livecd-YYYYMMDD-HHMI) |
Create a local repository for the core package
In addition, you need to be able to access the RPM of the tools required for custom live CD. If you have a quick internet connection, you can use it before creating a live CD.livecd-creator
Command to download the RPM and its dependent packages. Another option is to copy all packages from the ora core 6 installation CD or DVD and create a local "core" repository. To create a local repository, you must use the createrepo tool.
.
Listing 3. Installing the createrepo Tool
# wget -c http://tqmcube.com/files/createrepo-0.4.3-5.1.noarch.rpm # rpm -ivh createrepo-0.4.3-5.1.noarch.rpm |
Now, create a local repository, first copy all the RPM from 5 CDs or 1 DVD of core 6, and then use the createrepo tool.
Listing 4. Create a local repository
# mkdir /var/www/html/repo/core/ # cp <PATH TO RPMs> /var/www/html/repo/core/ # createrepo /var/www/html/repo/core/
|
It takes some time to execute the last command. It will create a repodata directory.livecd-creator
Command to use this directory to access the package.
Create a local repository for the configuration package
To use the zeuthen package as the basis for live CD, you also need to create a local repository for them.
Listing 5. Create a library for the livecd package
# mkdir base_packages # cd base_packages # wget -c http://people.redhat.com/davidz/livecd/i386/fedora-livecd-6-1.i386.rpm # wget -c http://people.redhat.com/davidz/livecd/i386/fedora-livecd-gnome-6-1.i386.rpm # wget -c http://people.redhat.com/davidz/livecd/i386/fedora-livecd-desktop-6-1.i386.rpm # createrepo /root/base_packages |
As before, the last command will generate the repodata directory.livecd-creator
Locate the configuration package.
Make CD
After the repository is set, you can easily create custom live CD.livecd-creator
Command to generate an ISO image, which can be burned into a CD-R. However, I recommend that you use virtualization software to test ISO instead of actually burning them on physical media. There are several types of software available for free, such as VMWare Player, qemu, and virtualbox.
Minimum live CD
Be familiarlivecd-creator
Command usage can begin with creating the smallest live CD:
Listing 6. Creating the smallest live CD
# livecd-creator --repo=c6,file:///var/www/html/repo/core --package=bash --package=kernel --package=grub --fslabel=Fedora-minimal-LiveCD |
Requirements for this commandlivecd-creator
Obtain the three packages bash, grub, and kernel from the local repository and include them in the live CD named fedora-minimal-livecd.livecd-creator
Command to use the yum of fedora to install these packages. Therefore, you must install other applications on which the specified package depends.
It takes some time to execute this command because it will create a workspace, install the specified packages and their dependencies, and re-mark the workspace of SELinux (Fedora security mechanism, compress the entire workspace, configure live CD Bootloader and grub, and finally create an ISO image.
Congratulations! You have successfully created your first live CD. Of course, you still cannot use it to implement many features because of the lack of configuration files.
Live CD with Gnome
Now that you knowlivecd-creator
Command usage, now you can use it to create a live CD containing gnome.
Listing 7. Creating a live CD with Gnome
# livecd-creator --repo=c6,file:///var/www/html/repo/core --repo=lcd6,file:///root/base_packages --package=fedora-livecd-gnome --repo=e6,http://download.fedora.redhat.com/pub/fedora/linux/extras/6/i386 --fslabel=My-Fedora-LiveCD-1 |
Here, you can use the local repository to obtain the basic package and specify the configuration package on which the CD should be based. Also specify fedora-livecd-gnome
All required packages should be obtained from the local core repository. Some packages in fedora-livecd-gnome are not in the core repository, and these packages will use the given URL
Obtain from the attached repository. Finally, it creates an ISO named My-Fedora-LiveCD-1.iso.
Iflivecd-creator
The package cannot be found. For example, if it is not in the specified repository, the command skips the package and continues to create the live CD. Unless the missing package is a key package (such as kernel), you will get an available live CD.
In addition to the packages mentioned in RPM configuration, you can also use--package
Switch to add a custom package.livecd-creator
Command can also be used to build a CD using multiple repositories.
Listing 8. Using multiple repositories to create a live CD
# livecd-creator --repo=c6,file:///var/www/html/repo/core --package=openoffice --repo=lcd6,file:///root/base_packages --package=fedora-livecd-gnome --repo=e6,http://download.fedora.redhat.com/pub/fedora/linux/extras/6/i386 --repo=livna,http://rpm.livna.org/fedora/6/i386 --package=vlc --fslabel=My-LiveCD-2 |
Like in the previous example, this command uses all packages from fedora-livecd-gnome to create a live CD. In addition, it will contain
OpenOffice.org office suite, which can be obtained from the core repository. It will also add VLC Media from the livna Repository
Player. We call it My-LiveCD-2 because it contains packages from third-party repositories and cannot be called fedora live CD.
If you want to add another application (such as the evolution e-mail client) to the custom CD after creating the CD, can you? No problem. If the ISO of the previous CD is available, you only needlivecd-creator
Use this ISO package and append a new package.
Listing 9. Add a new package to the existing live CD ISO
# livecd-creator --repo=c6,file:///var/www/html/repo/core --base-on=My-LiveCD-2.iso --package=evolution --fslabel=My-LiveCD-New |
This creates a new live CD based on the package in the previous ISO and the added evolution package.
Create a custom configuration package
I hope the above example will help you understand that creating a live CD is actually a very simple task. With the packages provided by zeuthen, you can continue to create live CD and add applications from any repository to it.
However, assume that you need to create a live CD that can be used to write documents and code. You want to write the OpenOffice.org, Evolution
E-mail client, Beagle desktop search, GAIM instant messenger, xchat IRC
Client, gimp image manipulator, GCC compiler, gdb debugger, and doxygen are included.
It can be used every time you want to assemble a cd--package
You can also write your own configuration files. The additional advantage of using the configuration file is that you can also specify custom configurations.
Profile profiling
Before creating your own configuration file, check the configuration file "fedora-gnome" used to create live CD. The configuration file can be extracted from RPM by right-clicking on the fedora-livecd-gnome-6-1.i386.rpm and selectingExtract here
. This generates a file named 20-fedora-livecd-gnome.conf in the ETC/livecd/directory.
. Prefix numbers are used to help identify specific packages in the packet tree. Therefore, 20-* packages after 10-* may depend on the latter, while 30-* packages are after 20 -*
And may depend on packages with a shorter prefix of 20.
The first part of the file contains the list of applications to be installed, and the second part contains the configurations required in this special environment.
Listing 10. Contents of the 20-fedora-livecd-gnome.conf File
case $1 in # inquire what packages to install; must print packages to install pkgadd) echo " chkconfig gdm gnome-panel nautilus metacity gnome-themes redhat-artwork gnome-power-manager gnome-volume-manager desktop-printing gnome-terminal gedit . . . .
# run configuration scripts when all packages are installed post) # mount livecd mkdir -p /mnt/livecd mount -o ro -t iso9660 /dev/livecd /mnt/livecd # add fedora user with no passwd useradd -c "Fedora live CD" fedora passwd -d fedora > /dev/null . . . . |
As you can see, most of the work (such as setting users and setting the Network) is done by the fedora-gnome package.
Create a configuration file
The best way to create a configuration file is to use 20-fedora-livecd-gnome.conf and delete the gnome-specific bit. Let's call 40-fedora-livecd-office
-Code. conf file. This should work:
# cp 20-fedora-livecd-gnome.conf 40-fedora-livecd-office-code.conf
After the gnome bit is deleted, you can add a list of required packages. The new file should display the following content (Note: I deleted the license space to save space ):
Listing 11. Newly created 40-fedora-live-office.conf File
#!/bin/bash
# livecd configuration for Base Fedora system
# PLEASE ADD LICENSE RELATED NOTE
case $1 in # inquire what packages to install; prints package list on stdout pkgadd) echo " evolution evolution-connector evolution-webcal gaim xchat beagle gimp
openoffice.org-core openoffice.org-draw openoffice.org-calc openoffice.org-graphicfilter openoffice.org-math openoffice.org-writer openoffice.org-xsltfilter openoffice.org-impress
gcc gdb doxygen " ;;
# run configuration scripts when all packages are installed post) ;;
# run when an livecd install is complete to clean up install-post) ;;
# run when an livecd install is complete; must prints packages to remove install-pkgrem) echo " fedora-livecd-office-code " ;; esac |
Do not forget to include the configuration package name in the list of packages to be deleted before creating ISO.
Create rpm
Before you can actually use this configuration file, you need to use it to create an RPM. The spec file is required to create an RPM. Fedora-livecd.spec with zeuthen available
And edit it to include information about the new configuration file.
Generally, the spec file contains the list of files that will be included in the RPM and the location where the files will be stored when the RPM is installed. I do not intend to go into details about creating spec
File details, but you can use the spec file I created for this article. Download this file from the download section after this article, and read the notes to learn about zeuthen
.
Note: The spec file points to the configuration file of other packages (such as fedora-live-gnome-fedora-livecd-desktop. Make sure that these configuration files are also available.
Use Fedorarpmbuild
Command to use the spec file to create an RPM.rpmbuild
The Command requires that all. conf configuration files be located in the/usr/src/RedHat/sources directory, and all
The source file should also be located in this directory. Also ensure that the fedora-livecd.spec file is located in/usr/src/RedHat/specs
Directory.
Listing 12. Create a New rpm
# cd /usr/src/redhat/SPECS # rpmbuild -bb fedora-livecd.spec # ls /usr/src/redhat/RPMS/i386 fedora-livecd-6-2.i386.rpm fedora-livecd-gnome-6-2.i386.rpm fedora-livecd-desktop-6-2.i386.rpm fedora-livecd-office-6-2.i386.rpm |
To differentiate between custom rpm and original rpm, I have set its version to 6-2 instead of the original 6-1.
Build live CD with custom rpm
Once you can process RPM freely, the process of creating a live CD is similar. Use the new RPM to re-create the local repository of the package.
Listing 13. Use the new RPM to create a local repository for the configuration package
# rm /root/base_packages/* # cp /usr/src/redhat/RPMS/* /root/base_packages/ # createrepo /root/base_packages |
Now passlivecd-creator
To use the latest package.
Listing 14. Use the new fedora-office-code-livecd RPM to create a live CD
# livecd-creator --repo=c6,file:///var/www/html/repo/core --repo=lcd6,file:///root/base_packages --package=fedora-livecd-office-code --repo=e6,http://download.fedora.redhat.com/pub/fedora/linux/extras/6/i386 --fslabel=My-Fedora-Office-Code-LiveCD |
In a twinkling of an eye! You can get a live CD that is completely customized by yourself from the configuration you have customized.