Developing a new server product requires me to test all sorts of things, including multiple distributions. As an Ubuntu developer, my main platform is, of course, Ubuntu.
It's a PITA to run multiple distributions from one system (and not very productive doing it from multiple machines), so I decided to setup chroots for each one. My production system has three environments outside of the main Ubuntu install: RHEL5, RHEL6 and SLES11.
Fortunately, Ubuntu has a nice tool called
schroot. I like it because it's based off the original tool called
dchroot, which I wrote back in 1999 (wow). It was mainly to allow people to use the UltraSPARC developer systems with more than one release of Debian without me having to setup multiple machines.
Fast forward 13 years, and now we have
schroot. This tool has come a long way, and even includes support for snap shot of file systems so you can always start with a pristine environment. This is useful to me because I want to make sure when I build a package, only the required dependencies are installed, and I don't want to worry about screwing up the original environment. Not to mention, I can start more than one session and they wont bother each other.
In addition to
schroot, we will need the
rinsepackage. For anyone familiar with
debootstrap, it's basically the same thing, but for RPM based systems. It will download and bootstrap all the required RPMs needed for a particular distro, in a manner suitable for a chroot environment.
sudo apt-get install schroot rinse
Now, if you look in
/etc/rinse/rinse.conf, you will see several already configured RPM distributions. If you are wanting to do one for RHEL, you will need to either use CentOS instead, or duplicate the matching CentOS entry and rename, being sure to change the mirror URL to match your location. For my RHEL distros, I have a local RPM repository, so I use this entry:
[rhel-6] mirror = file:///srv/rhel6-ppc/RPMS/media/Packages
You will also need to copy the matching
/etc/rinse/naming it the same as your entry.
Now decide where you want your chroot to be located. I've decided to put mine in
/srv/chroots/rhel6-ppc. Create this directory, and then you can run the
rinsecommand as follows:
sudo rinse --arch ppc --directory /srv/chroots/rhel6-ppc --distribution rhel-6
NOTE: I have my
rinsescript hacked a little to allow
ppcas an arch. You will probably use
amd64. Also, the
--distributionargument is the same as the entry name.
In my next post, we'll move on to configuring