在Ubuntu系统中配置chroot环境的教程

2020-02-03 12:58:54刘景俊

复制 /etc/hosts 文件到 chroot 环境,这样 chroot 环境就可以使用网络了:

   
复制代码$ sudo cp /etc/hosts /linoxide/etc/hosts

最后使用 schroot -l 命令列出系统上所有的 chroot 环境:

   
复制代码$ schroot -l

使用下面的命令进入 chroot 环境:

   
复制代码$ sudo chroot /linoxide/ /bin/bash

测试安装的版本:

   
复制代码# lsb_release -a
# uname -a

为了在 chroot 环境中使用图形界面,你需要设置 DISPLAY 环境变量:

   
复制代码$ DISPLAY=:0.0 ./apps

目前为止,我已经成功地在 Ubuntu 14.04 LTS 上安装了 Ubuntu 13.10。

退出 chroot 环境:

   
复制代码# exit

清理一下,卸载文件系统:

   
复制代码$ sudo umount /test/proc
$ sudo umount /test/sys