11.4.使用 debootstrap(8)open in new window 构建 Debian / Ubuntu 基本系统

另一种提供 Linux 共享库的方法是使用 sysutils/debootstrapopen in new window。这样做的好处是可以提供一个完整的 Debian 或 Ubuntu 发行版。要使用它,请按照 FreeBSD Wiki 上的说明:FreeBSD Wiki - Linux Jailsopen in new window

在 deboostrap 之后,chroot(8)open in new window 进入新创建的目录,以里面的 Linux 发行版的典型方式安装软件,比如说:

# chroot /compat/ubuntu /bin/bash
[email protected]:/# apt update

可以 debootstrap 到 /compat/linux,但不建议这样做,以避免与从 FreeBSD ports 和软件包安装的文件发生冲突。应该从发行版或版本名称中导出目录名称,例如,/compat/ubuntu。如果引导的实例旨在提供 Linux 共享库而不需要明确地使用 chroot 或 jail,可以通过更新 sysctl 变量 compat.linux.emul_path 并在 /etc/sysctl.conf 中加入这样一行来将内核指向它:

compat.linux.emul_path="/compat/ubuntu"

这个 sysctl 控制内核的路径转换机制详情见 linux(4)open in new window。请注意,改变它可能会给从 FreeBSD 软件包中安装的 Linux 应用程序带来麻烦;原因之一是其中许多应用程序仍然是 32 位的,而 Ubuntu 似乎正在取消对 32 位库的支持。

Loading...