The Linux chroot environments are often used to run pieces of software that are not compatable with the running distribution. For example, people running 64 bit Linux distributions will often create a 32 bit chroot environment based on that same distribution to run 32 bit software that might have better support. Adobe’s flash is a good example from the past: before 64 bit linux really gained popularity, only the 32 bit version of Adobe flash was available natively. But what if you need to install something that isn’t supported natively by your distribution at all, but is under a different distribution, and you’d like to keep package management the same?
That’s right, chroot can help.
I recently needed to run PHP 5.2.1, but at the time RHEL5 only had 5.1.6 in the official repositories. There were no options unless I wanted to go with a third party package, negating the advantages on having a package management system like RPM handle installations and upgrades. Debian Lenny had support for 5.2.x out of the box, but it was too late to switch for various reasons.
As long as the kernels are mostly compatable with the running software, chroot can be used to setup a chroot environment based on a totally different distribution. This lets you run software from that distribution’s official repositories, offering similar advantages to your main system’s package management system.
Installing Debian on RHEL5 was as easy as installing the debootstrap from a tarball somewhere temporary, then letting debootstrap do it’s work in it’s own directory away from the main system. Once chrooted to that directory, you can continue with the debian install as if you’d just installed the base system.
More information on chroot and debootstrap here: http://wiki.debian.org/Debootstrap






Enjoyed every bit of your article. Keep writing.