Hi Peter, On Tue, Sep 04, 2007 at 10:20:53AM +1000, Peter Chubb wrote: > I'm trying to write some howtos. For Debian lots of things > are easy (because that's what I use everyday). For > RedHat/CentOS/Fedora, I want to create an environment I can play in -- > a chroot environment using yum, and so on. > > How can I install the bare minimum --- something like the > result of debootstrap --- just enough to run yum? As it'll be in a > chroot I don't need any network utilities, etc, > > Here's what I tried: > > Boot qemu on an empty disc using the first installation > cdrom. Install with everything possible turned off. The result was > over 1G, and stuff like X libraries, spelling checkers in x86 and > x86_64 versions, etc., were still installed. In fact there were quite > a few x86 versions of things installed unnecessarily. I did a yum > remove *.i386 and removed 60 packages straight away. > > I could then shutdown qemu, loopback mount the filesystem and > copy the files into a directory ready for chroot. > > But I'm sure there's other unnecessary stuff in > there. Removing all the autosetup of networking gets rid of > another 21 packages; and then I had to add gcc, binutils and > rpmutils; leaving me a chroot of 1.2G. By comparison, a > minimal debian install is 93M -- enough to run apt-get. > > Any ideas?
I did this by hand a few months ago to create a 32-bit chroot on a 64-bit machine - it's not that complicated (though rpmstrap is probably easier, of course), here are my notes: # based on owlriver caos chroot script, and planet-lab fedora build script: # - ftp://ftp.owlriver.com/pub/local/ORC/ORCrebuild/ORCyum-chroot-caos # - http://build.planet-lab.org/build/nightly/2006.03.27/mkfedora export CHROOT=/export/chroot/centos4-i386 mkdir -p $CHROOT mkdir -p $CHROOT/{dev,proc,tmp} mkdir -p $CHROOT/etc/{rpm,sysconfig} echo "NETWORKING=yes" > $vroot/etc/sysconfig/network mkdir -p $CHROOT/var/lib/rpm mkdir -p $CHROOT/var/{log,tmp} touch $CHROOT/proc/mounts touch $CHROOT/etc/mtab touch $CHROOT/etc/redhat-release rpm --root $CHROOT --initdb for i in null ptmx zero random urandom tty full; do /dev/MAKEDEV -d $CHROOT/dev $i done # Setup yum.conf cat <<EOD >$CHROOT/etc/yum.conf [main] cachedir=/var/cache/yum debuglevel=2 logfile=/var/log/yum.log pkgpolicy=newest distroverpkg=centos-release tolerant=1 exactarch=0 obsoletes=1 reposdir=/dev/null [bootstrap] name=CentOS-\$releasever - Base baseurl=http://web/mrepo/centos\$releasever-i386/RPMS.os/ EOD # Prevent all locales from being installed in reference image mkdir -p $CHROOT/etc/rpm cat >$CHROOT/etc/rpm/macros <<EOF %_install_langs en_US:en %_excludedocs 1 %__file_context_path /dev/null EOF # Install bootstrap packages (mainly centos-release and dependencies) # Note: for some reason, scriptlets (both pre- and post-) always fail via rpm --root and yum --installroot cd /var/www/mrepo/centos4-i386/RPMS.os /bin/ls centos-release-* bash-* glibc-2*i686* glibc-common-* basesystem-* mktemp-* libgcc-* setup-* filesystem-* libtermcap-2* tzdata-* termcap-* setarch-* | xargs linux32 rpm --root $CHROOT -ivh linux32 yum --installroot=$CHROOT -y --disablerepo=* --enablerepo=bootstrap -c $CHROOT/etc/yum.conf install yum Cheers, Gavin -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
