From Fedora Project Wiki

Stateless Linux - Creating An Image Using Yum's Groupinstall Mode

See Stateless Linux HOWTO

This method is quite simple - you create a yum configuration file, do a groupinstall and clean up yum's cache:

$> mkdir -p yum-tmproot/var/log
$> cat > tmp-yum.conf << EOF
[main] 
gpgcheck=0
reposdir=

[repository] 
name=foo
baseurl=http://172.31.0.4/rawhide-latest/x86_64
EOF
$> yum -c tmp-yum.conf --installroot $(pwd)/yum-tmproot groupinstall core base
$> yum -c tmp-yum.conf --installroot $(pwd)/yum-tmproot clean all

Finally, create an ext3 filesystem image and copy the contents of the chroot into the image, as described in Stateless Linux Create Image With Anaconda Rootpath .

Notes:

  • If you don't create var/log in the chroot before running the groupinstall, yum-2.9.3-2 would fail with:
File "/usr/lib/python2.4/site-packages/yum/logginglevels.py", line 132, in doLoggingSetup
logging.getLogger("yum").critical(_('Cannot open logfile %s'), logfile)
NameError: global name '_' is not defined

This is fixed in yum-2.9.4