From Fedora Project Wiki

(Remove h1, and emphasize subject matter for clarity)
m (Added QEMU screenshot)
(24 intermediate revisions by 11 users not shown)
Line 1: Line 1:
This page explains '''how to generate live CDs or DVDs''' 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
{{autolang|base=yes}}


See the [[FedoraLiveCD | project wiki]] for more details. Discussion of this project takes places at the fedora-livecd@redhat.com mailing list at http://www.redhat.com/mailman/listinfo/fedora-livecd-list.
<noinclude>
[[Category:Spins]]
[[Category:LiveMedia]]
</noinclude>


This project and its source files are licensed under the GPLv2 license. See the file COPYING for details.
This page explains how to make a custom-content Live CD or DVD on Fedora-based systems including derived distributions such as RHEL, CentOS and others.  


== Live CD Design Goals ==
If you simply want to burn a pre-made ISO to a disc, visit http://fedoraproject.org/en/get-fedora to download a LiveCD or LiveDVD, then see the [http://docs.fedoraproject.org/install-guide/ install guide] or [http://docs.fedoraproject.org/readme-burning-isos/ burning how-to] for further instructions.


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.
See the [[FedoraLiveCD | project wiki]] for more details. Discussion of this project takes places at http://admin.fedoraproject.org/mailman/listinfo/livecd.


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.


{{Admon/tip | The "install to hard drive" feature has now been implemented. See below for details.}}
This project and its source files are licensed under the GPLv2 license. See the file COPYING for details.
 
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 ==
== Creating a Live image ==


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.
To create a live image, 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 <code>livecd-tools</code> package.  If it is not installed on your system, add it with:
The '''livecd-creator''' tool is part of the <code>livecd-tools</code> package.  If it is not installed on your system, add it with:
Line 25: Line 25:
</pre>
</pre>


=== How the Live CD Creator Works ===
If you are interested in localized live cd files, install also '''l10n-kickstarts'''.
 
=== How the livecd-creator Works ===


In a nutshell, the '''livecd-creator''' program
In a nutshell, the '''livecd-creator''' program
Line 33: Line 35:
* Bind mounts certain kernel file systems (/dev, /dev/pts, /proc, /sys, /selinux) inside the 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''.
* 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
* Installs, using ''yum'', the requested packages into the installation using the given repositories in the kickstart file
* Optionally runs scripts as specified by the live CD configuration file.
* Optionally runs scripts as specified by the live CD configuration file.
* Relabels the entire installation root (for SELinux)
* Relabels the entire installation root (for SELinux)
Line 39: Line 41:
* Unmounts the kernel file systems mounted inside the installation root
* Unmounts the kernel file systems mounted inside the installation root
* Unmounts the installation root
* Unmounts the installation root
* Creates a ''squashfs'' file system containing only the ''ext3'' file (compression)
* Creates a ''squashfs'' file system containing only the default ''ext3/4'' file (compression)
* Configures the boot loader
* Configures the boot loader
* Creates an iso9660 bootable CD
* Creates an iso9660 bootable CD/DVD


=== Live CD Configuration Files ===
=== Live image 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.
The configuration of the live image 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, the two most important live CD configurations files are
For the Fedora project, the two most important live image configurations files are
{|
|-
| livecd-fedora-minimal.ks || The base live CD system (included in the 'livecd-tools' package)
|-
| livecd-fedora-desktop.ks || Complete desktop with applications and input/output support for all supported locales in Fedora (this one is part of the 'spin-kickstarts' package)
|}


kickstart files for other spins (e.g. Fedora Electronics Lab) can be found in /usr/share/spin-kickstarts/ after installing the 'spin-kickstarts' package
* '''[https://fedorahosted.org/spin-kickstarts/browser/fedora-live-minimization.ks fedora-live-minimization.ks]''' : The base live image system (included in the 'livecd-tools' package)
* '''[https://fedorahosted.org/spin-kickstarts/browser/fedora-live-desktop.ks fedora-live-desktop.ks]''' : Complete desktop with applications and input/output support for all supported locales in Fedora (this one is part of the 'spin-kickstarts' package)


kickstart files for other spins (e.g. Fedora Electronics Lab) can be found in ''/usr/share/spin-kickstarts/'' after installing the 'spin-kickstarts' package


=== Set SELinux to permissive mode ===
=== Set SELinux to permissive mode ===
Line 62: Line 60:
SELinux should be in permissive mode for livecd-creator to work. Run the following as root user first before attempting to create a live cd or dvd.
SELinux should be in permissive mode for livecd-creator to work. Run the following as root user first before attempting to create a live cd or dvd.


<pre>
setenforce 0
 
=== Making a 32-bit spin ISO on a 64-bit machine ===


setenforce 0
If you have an x86_64 machine you're building on but you want a 32-bit happy iso image, add the following before your livecd-creator command:


</pre>
setarch i686 livecd-creator [...]


=== Example: Spinning the Fedora Desktop Live CD ===
=== Example: Spinning the Fedora Desktop Live CD ===


Note that because of the way {{command|livecd-creator}} works, it is not possible to choose a different set of packages or a different filesystem during installation. Assuming that you use the '''fedora-live-desktop.ks''' configuration file, then the following command:


Assuming that you use the '''livecd-fedora-desktop.ks''' configuration file, then the following command
<pre>
 
livecd-creator --verbose \
 
<pre>livecd-creator \
--config=/usr/share/doc/livecd-tools-<version>/livecd-fedora-desktop.ks \
--fslabel=Fedora-LiveCD --cache=/var/cache/live
 
or
 
livecd-creator \
--config=/usr/share/spin-kickstarts/fedora-livecd-desktop.ks \
--config=/usr/share/spin-kickstarts/fedora-livecd-desktop.ks \
--fslabel=Fedora-LiveCD --cache=/var/cache/live
--fslabel=Fedora-LiveCD \
--cache=/var/cache/live
</pre>
</pre>


Line 90: Line 84:


* as a file system label on the ext3 and iso9660 file systems (As such, it's visible on the desktop as the CD name)
* 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.
* in the ''isolinux'' boot loader.


Line 96: Line 89:


{{Admon/tip | You can use setarch command to create a x86 live cd/dvd on a x86_64 system. Ex: setarch i386 livecd-creator <..> .}}
{{Admon/tip | You can use setarch command to create a x86 live cd/dvd on a x86_64 system. Ex: setarch i386 livecd-creator <..> .}}


=== Example: A Barebones Live CD ===
=== Example: A Barebones Live CD ===
Line 102: Line 94:
The command
The command


<pre>livecd-creator \
<pre>livecd-creator --verbose \
--config=/usr/share/doc/livecd-tools-<version>/livecd-fedora-minimal.ks --cache=/var/cache/live </pre>
--config=/usr/share/doc/livecd-tools-`rpm -q livecd-tools --qf "%{VERSION}"`/livecd-fedora-minimal.ks \
--cache=/var/cache/live
</pre>


will create a live CD that will boot to a login prompt.
will create a live CD that will boot to a login prompt.
Line 109: Line 103:
{{Admon/tip | Barebones Live CD does not support login capability. | Since no configuration is done, the user will not be able to login to the system as the root password is not set/cleared.}}
{{Admon/tip | Barebones Live CD does not support login capability. | Since no configuration is done, the user will not be able to login to the system as the root password is not set/cleared.}}


=== Testing your Live CD using KVM or qemu ===


=== Testing your Live CD using KVM or eqmu ===
[[Image:Screenshot_qemu_gtk3.png|thumb|QEMU running Fedora 17]]


As root:
As root:
<code>qemu-kvm -m 512 -cdrom filename.iso</code>
 
qemu-kvm -m 512 -cdrom filename.iso


If you do not have KVM support, you can use qemu instead
If you do not have KVM support, you can use qemu instead


<code>qemu -m 512 --cdrom filename.iso></code>
qemu -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 for releases before Fedora 11. Fedora 11 has merged kvm and qemu into a single package. Just installing qemu package is enough.
Replace '''filename.iso''' with the name of your created Live CD image.


== Live CD Installs ==
{{Admon/tip || Be sure to '''"yum install kvm qemu"''' as root for releases before Fedora 11. Fedora 11 has merged kvm and qemu into a single package. Just installing qemu package is enough.}}


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
== Live image Installs ==
 
As of Fedora 7, anaconda has support for doing an installation from a live image.  To use this, double click on the ''Install to Hard Drive'' item on the desktop or run


<pre>
<pre>
Line 131: Line 129:
if you don't have such an icon.
if you don't have such an icon.


== Live CD Media Verification ==
== Live Image 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.
The live image 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 ==
== 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:
USB sticks are becoming increasingly prevalent and are a nice way to use live images.  You can take a live CD or DVD 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:


<pre>
<pre>
Line 145: Line 143:
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.
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_create_and_use_Live_USB | How to Install Live Image to USB Flash Drive]].
Additional information available at [[How to create and use Live USB]].


== Other Resources ==
== Other Resources ==
* A [[Classroom | Fedora Classroom]] class covering [[Classroom/Creating_Fedora_Remix | creating Fedora remixes]].
* A [[Classroom | Fedora Classroom]] class covering [[Classroom/Creating_Fedora_Remix | creating Fedora remixes]].
* If you are distributing your spin you need to be concerned about [[JeroenVanMeeuwen/Revisor/FedoraRebrandRemixGuidelines | trademark usage and GPL responsibilities]].
* If you are distributing your spin you need to be concerned about [[JeroenVanMeeuwen/Revisor/FedoraRebrandRemixGuidelines | trademark usage and GPL responsibilities]].
[[Category:Spins]]

Revision as of 03:04, 29 November 2012


This page explains how to make a custom-content Live CD or DVD on Fedora-based systems including derived distributions such as RHEL, CentOS and others.

If you simply want to burn a pre-made ISO to a disc, visit http://fedoraproject.org/en/get-fedora to download a LiveCD or LiveDVD, then see the install guide or burning how-to for further instructions.

See the project wiki for more details. Discussion of this project takes places at http://admin.fedoraproject.org/mailman/listinfo/livecd.


This project and its source files are licensed under the GPLv2 license. See the file COPYING for details.

Creating a Live image

To create a live image, 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 spin-kickstarts'

If you are interested in localized live cd files, install also l10n-kickstarts.

How the livecd-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 in the kickstart file
  • 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 default ext3/4 file (compression)
  • Configures the boot loader
  • Creates an iso9660 bootable CD/DVD

Live image Configuration Files

The configuration of the live image 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, the two most important live image configurations files are

  • fedora-live-minimization.ks : The base live image system (included in the 'livecd-tools' package)
  • fedora-live-desktop.ks : Complete desktop with applications and input/output support for all supported locales in Fedora (this one is part of the 'spin-kickstarts' package)

kickstart files for other spins (e.g. Fedora Electronics Lab) can be found in /usr/share/spin-kickstarts/ after installing the 'spin-kickstarts' package

Set SELinux to permissive mode

SELinux should be in permissive mode for livecd-creator to work. Run the following as root user first before attempting to create a live cd or dvd.

setenforce 0

Making a 32-bit spin ISO on a 64-bit machine

If you have an x86_64 machine you're building on but you want a 32-bit happy iso image, add the following before your livecd-creator command:

setarch i686 livecd-creator [...]

Example: Spinning the Fedora Desktop Live CD

Note that because of the way livecd-creator works, it is not possible to choose a different set of packages or a different filesystem during installation. Assuming that you use the fedora-live-desktop.ks configuration file, then the following command:

livecd-creator --verbose \
--config=/usr/share/spin-kickstarts/fedora-livecd-desktop.ks \
--fslabel=Fedora-LiveCD \
--cache=/var/cache/live

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.

Idea.png
You can use setarch command to create a x86 live cd/dvd on a x86_64 system. Ex: setarch i386 livecd-creator <..> .

Example: A Barebones Live CD

The command

livecd-creator --verbose \
--config=/usr/share/doc/livecd-tools-`rpm -q livecd-tools --qf "%{VERSION}"`/livecd-fedora-minimal.ks \
--cache=/var/cache/live

will create a live CD that will boot to a login prompt.

Idea.png
Barebones Live CD does not support login capability.
Since no configuration is done, the user will not be able to login to the system as the root password is not set/cleared.

Testing your Live CD using KVM or qemu

QEMU running Fedora 17

As root:

qemu-kvm -m 512 -cdrom filename.iso

If you do not have KVM support, you can use qemu instead

qemu -m 512 --cdrom filename.iso

Replace filename.iso with the name of your created Live CD image.

Idea.png
Be sure to "yum install kvm qemu" as root for releases before Fedora 11. Fedora 11 has merged kvm and qemu into a single package. Just installing qemu package is enough.

Live image Installs

As of Fedora 7, anaconda has support for doing an installation from a live image. To use this, double click on the Install to Hard Drive item on the desktop or run

/usr/bin/liveinst

if you don't have such an icon.

Live Image Media Verification

The live image 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 or DVD 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 create and use Live USB.

Other Resources