Skip to content

Instantly share code, notes, and snippets.

@themalkolm
Forked from ldx/gist:9116170
Created April 27, 2016 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themalkolm/05447ca1238b22a98fd217a77b02c5f4 to your computer and use it in GitHub Desktop.
Save themalkolm/05447ca1238b22a98fd217a77b02c5f4 to your computer and use it in GitHub Desktop.
Build a chroot with a CentOS 6.5 base install.
#!/bin/sh
#
# Build a chroot with a CentOS 6.5 base install.
#
CHROOT=/tmp/chroot
mkdir -p $CHROOT
mkdir -p $CHROOT/var/lib/rpm
rpm --rebuilddb --root=$CHROOT
wget http://fr2.rpmfind.net/linux/centos/6.5/updates/x86_64/Packages/centos-release-6-5.el6.centos.11.2.x86_64.rpm
rpm -i --root=$CHROOT --nodeps centos-release-6-5.*.rpm
yum --installroot=$CHROOT install -y rpm-build yum
mkdir -p $CHROOT/proc
mount --bind /proc $CHROOT/proc
mkdir -p $CHROOT/dev
mount --bind /dev $CHROOT/dev
mkdir -p $CHROOT/etc
cp /etc/resolv.conf $CHROOT/etc/resolv.conf
mkdir -p $CHROOT/root
cp $CHROOT/etc/skel/.??* $CHROOT/root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment