7

I am currently in need of using apt-get on a chroot directory. The setup is the following.

I have a chroot setup with schroot. This chroot environment needs to be stripped down as much as possible. Therefore I am planning to remove apt-get and commin from the chroot environment.

I know that Gentoo has the possibility to use portage on a different root directory. Is this possible to set a different root directory for apt.get to install software into my chroot directory?

Thanks in advance

0
6

You need debootstrap chroot.

  1. Install packages on the host computer.

    sudo apt-get install debootstrap
    sudo apt-get install schroot
    
  2. Create a configuration file for schroot.

  3. Run debootstrap.

  4. Check the chroot.

  5. Now you can use whatever you want, including installation using

    apt-get

The detailed instructions and more information can be found in the above link

Another useful link can be found here.


A simpler instructions:

Create a chroot environment into which you will install your packages:

debootstrap precise fakeInstallation

Replace "precise" with your Ubuntu version name, and "fakeInstallation" with directory you want to chroot.

Now you have created a fake installation in the fakeInstallation directory

chroot fakeInstallation

Now you can use apt-get install within the fakeInstallation directory

2
  • 4
    I dont want to use apt-get within the chroot environtment, but instead from my own and use the "global" apt-get to install stuff into the chroot without having apt-get installed inside the chroot
    – raddirad
    Jun 8 '15 at 7:32
  • @raddirad Any chance you found out how to do this? I want to do something similar. Feb 25 at 22:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.