Posts

Showing posts from June, 2011

Five steps to create Fedora chroot jail using yum

Pre-Notes:
- This will work only if your Linux Distro is based on RPM and YUM. I have tested it on Fedora but it may also work on RHEL and Centos... It will NOT work on Ubuntu, Debian, Suse...
- The operating system and its version will be the same inside and outside the chroot jail.
- On the example, the chroot will be placed at: /chroot/devel
- To install different version of Fedora or other RPM based distro, it will be necessary to manage yum package repositories outside the jail.

The five steps:
# 1 - Create the chroot directory
$ sudo mkdir -p /chroot/devel/var/lib/rpm

# 2 - Initiate rpm db on chroot
$ sudo rpm --root /chroot/devel --initdb

# 3 - download Fedora Release package.
# If you do not want Fedora, download the correct *-release package and use it
# on step 4. There are examples on the references.
$ yumdownloader --destdir=/tmp fedora-release

# 4 - Install downloaded Fedora release inside chroot
$ sudo rpm --root /chroot/devel -ivh /tmp/fedora-release*rpm

# If you want m…