在 chroot 目录中使用 apt-get

rad*_*rad 7 apt chroot

我目前需要apt-get在 chroot 目录上使用。设置如下。

我有一个带有 schroot 的 chroot 设置。这个 chroot 环境需要尽可能地剥离。因此,我计划从 chroot 环境中删除 apt-get 和 commin。

我知道 Gentoo 有可能在不同的根目录上使用 portage。是否可以为 apt.get 设置不同的根目录以将软件安装到我的 chroot 目录中?

提前致谢

May*_*hux 6

你需要debootstrap chroot。

  1. 在主机上安装软件包。

    sudo apt-get install debootstrap
    sudo apt-get install schroot
    
    Run Code Online (Sandbox Code Playgroud)
  2. 为 schroot 创建配置文件。

  3. 运行 debootstrap。

  4. 检查chroot。

  5. 现在你可以使用任何你想要的,包括使用安装

    apt-get

详细说明和更多信息可以在上面的链接中找到

另一个有用的链接可以在这里找到。


一个更简单的指令:

创建一个 chroot 环境,您将在其中安装软件包:

debootstrap precise fakeInstallation
Run Code Online (Sandbox Code Playgroud)

将“precise”替换为您的 Ubuntu 版本名称,并将“fakeInstallation”替换为您想要 chroot 的目录。

现在您已经在fakeInstallation目录中创建了一个假安装

chroot fakeInstallation
Run Code Online (Sandbox Code Playgroud)

现在您可以在 fakeInstallation 目录中使用 apt-get install

  • 我不想在 chroot 环境中使用 apt-get,而是从我自己的环境中使用“全局”apt-get 将东西安装到 chroot 中,而无需在 chroot 中安装 apt-get (4认同)