Skip to content

Instantly share code, notes, and snippets.

@ldx
Created February 20, 2014 15:23
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save ldx/9116170 to your computer and use it in GitHub Desktop.
Save ldx/9116170 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
@fdanielson
Copy link

LIne 8 is redundant.

@PhilRi
Copy link

PhilRi commented Nov 14, 2016

You need to add the key for CentOS 6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment