Differences between revisions 3 and 5 (spanning 2 versions)
Revision 3 as of 2007-08-23 14:22:24
Size: 2770
Editor: MiriamRuiz
Revision 5 as of 2007-08-23 14:30:01
Size: 2850
Editor: MiriamRuiz
Deletions are marked like this. Additions are marked like this.
Line 23: Line 23:
 * http://en.wikipedia.org/wiki/Debian
 * http://en.wikipedia.org/wiki/Chroot

Most of us have our system configured with packages from different sources. Some of you might not even be using Debian in your main system, and those who do, might not be using SID. Even though new packages can be developed and compiled in any Debian system or derivative, if you have the intention of getting them into Debian sometime you'll have to develop them under SID. This does not mean you must use SID in your main system, there are other alternatives.

Of course, you might want to install a whole Debian system in a virtual computer. That will probably be the best option for those using a different operative system in their computers than Linux (whether it is BSD, OS X, or any others). If you're already using Debian or Ubuntu, or even if you're using some other Linux distribution, you might consider working inside a chroot environment.

The quickest and easiest way to create a chroot environment if you're using Debian or any derivative in your system is through the commands debootstrap or cdebootstrap. You should type something like “debootstrap (or cdebootstrap) SUITE TARGET [MIRROR]”, where SUITE is any of those in Debian (sid, testing, stable, oldstable), TARGET points to the directory where we want to creathe the chroot environment, and MIRROR is the repository from which we'll obtain the packages. It'll be something like: "mkdir -p /chroot/sid && debootstrap sid /chroot/sid http://ftp.de.debian.org/debian/".

Afterwards, we might consider copying some of the configuration files (such as /etc/passwd, /etc/group, /etc/shadow, /etc/hosts, /etc/fstab y /etc/resolv.conf) from our main system to the chroot environment, so that files have they match. You can enter the chroot just by doing "chroot /chroot/sid" as root. You might as well type "sudo /usr/sbin/chroot /chroot/sid login $USER" or any similar sequence of commands to automatize it.

You can link some of the directories in your main system to some others inside your chroot, with "mount --bind olddir newdir", or adding in your /etc/fstab something like:

  • /home /chroot/sid/home none bind
  • /dev /chroot/sid/dev none bind
  • devpts /chroot/sid/dev/pts devpts defaults 0 0
  • sys /chroot/sid/sys sysfs defaults 0 0
  • proc /chroot/sid/proc proc defaults 0 0
  • usb /chroot/sid/proc/bus/usb usbfs defaults 0 0

You can also do more fancy stuff, like starting a new X server inside the chroot, or add new virtual terminals that start inside the chroot system. If you're using Debian in your main system, you might also be able to easily open X windows from inside the chroot into your main X server, just by sharing the same /tmp directories:

  • /tmp /chroot/sid/tmp none bind