From Fedora Project Wiki

Stateless Linux - Creating An Image Using Anaconda's Rootpath Mode

See Stateless Linux HOWTO

First, install into a directory using anaconda's "rootpath" mode:

$> mkdir tmproot/
$> ANACONDA_PRODUCTPATH="Fedora" anaconda -G \
-m http://172.31.0.4/rawhide-latest/x86_64 \
--rootpath tmproot/

Next, create an ext3 filesystem image large enough to hold the install:

$> dd if=/dev/zero of=terminal.img oflag=direct bs=1M count=0 seek=4096
$> losetup /dev/loop0 terminal.img
$> mke2fs -j /dev/loop0
$> mkdir tmproot_new/
$> mount /dev/loop0 tmproot_new/

Now copy the install onto the ext3 filesystem image:

$> cd tmproot_new/
$> (cd ../tmproot; find . | cpio --quiet -o) | cpio -ivd --preserve-modification-time

And finally, clean up:

$> umount tmproot_new/
$> losetup -d /dev/loop0

Optionally, you can use this little utility to make a sparse copy (i.e. a copy which takes up less space) of the image:

$> e2cp ./terminal.img ./terminal-sparse.img

Notes:

  • $ANACONDA_PRODUCTPATH should contain the name of the directory in the install tree where you find the RPMS directory.
  • You need anaconda-runtime installed for this.
  • You need gnome-python2-gtkhtml2 installed for a graphical install. Anaconda doesn't Requires: it because you don't need it for a text mode install.
  • Specifying a relative path with --rootpath only works with anaconda >= 11.1.0.55-1.