Ubuntu: Use apt-get in chroot directory [duplicate]



Question:

This question already has an answer here:

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


Solution:1

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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »