Ubuntu – Install program from source to chroot env

bazaarchrootdebinstall-from-sourceinstallation

I have an program source (Remmina) and want to install it to chroot environment. Remmina uses cmake system.

I can install it to chroot using:

sudo make install DESTDIR=mychroot

but this is not nice method because I need to make sure the chrooted system meets all requirements (dependencies). I think the best idea is to create deb package and then install it under chroot. But how?

Oh I forgot to tell that I am using bazaar (with git plugin) and saw there is buildpackage plugin to build debs. Maybe this way would be better?

Any idea?

Best Answer

If you're not short of a bit of space, you could use debootstrap to install a minimal complete OS in your chroot. This then makes apt available in your chroot.

To start with:

sudo apt-get install debootstrap

To setup a new chroot:

sudo debootstrap oneiric /path/to/chroot
sudo chroot /path/to/chroot /bin/bash

Voila, you're in a new minimal Ubuntu installation. apt-get will work from here. So now you could even install gcc/make et al, and do your entire make install in the chroot, which should pretty much guarantee the end result will work properly (all the libs will be present and so forth).

There's a few other steps you should do like setting up /proc in the fstab in the chroot, see the debootstrap manpage (under EXAMPLES).

Related Question