Lately, I've been trying many possibilities with chroot virtual systems. I found many uses with chroot: to create a live CD, to create a chrooted Web server, and to create a VNC desktop server. Now I want to create a temporary, disposable chroot for the purpose of compiling software.
This time I am going to create the chroot under /srv/develop, so I make the directory first.
I install a minimal Debian system into /srv/develop.
apt-get install cdebootstrap-static cdebootstrap-static --allow-unauthenticated --arch=i386 --flavour=minimal stable /srv/develop http://http.us.debian.org/debian
I mount proc, devtmpfs and devpts for chroot.
mount -t proc -o nodev,noexec,nosuid proc /srv/develop/proc mount -t devtmpfs -o size=8192k,nr_inodes=64k none /srv/develop/dev mount --bind /dev/pts /srv/develop/dev/pts
I chroot into /srv/develop.
I type some commands to fix minor issues.
ln -s /proc/mounts /etc/mtab dpkg --purge cdebootstrap-helper-rc.d
I check /etc/apt/sources.list and update the apt-get database.
Then, I run the following comand to install the basic compiler suite.
apt-get --no-install-recommends install binutils bison bzip2 dpkg-dev flex gcc g++ gettext less libc6-dev libtool make patch perl pkg-config python texinfo vim-tiny wget whiptail xz-utils
Now I am ready for some basic coding and compiling. If I am really serious, I may install a full-blown GUI IDE. However, for now I just want to compile something quickly without messing up the main system, and then destroy the chroot.