24.4.使用 VirtualBox™ 安装 FreeBSD

FreeBSD 作为客户机操作系统在 VirtualBox™ 中表现良好。该虚拟化软件可用于大多数常见的操作系统,包括 FreeBSD。

VirtualBox™ 客户机额外提供如下支持:

  • 同步剪切板。

  • 整合鼠标指针。

  • 同步宿主机时间。

  • 窗口缩放。

  • 无缝模式。

注意

请在 FreeBSD 客户机中执行下文命令。

首先,在 FreeBSD 客户机中安装 virtualbox-ose-additions。可以通过软件包或者 port 安装。以 port 为例:

# cd /usr/ports/emulators/virtualbox-ose-additions && make install clean

然后在 /etc/rc.conf 中添加如下内容:

vboxguest_enable="YES"
vboxservice_enable="YES"

如果使用了 ntpd(8) 或者 ntpdate(8),可禁用宿主机时间同步:

vboxservice_flags="--disable-timesync"

Xorg 会自动识别 vboxvideo 驱动。也可以在 /etc/X11/xorg.conf 中手动指定:

Section "Device"
	Identifier "Card0"
	Driver "vboxvideo"
	VendorName "InnoTek Systemberatung GmbH"
	BoardName "VirtualBox Graphics Adapter"
EndSection

若要使用 vboxmouse 驱动,请在 /etc/X11/xorg.conf 中修改鼠标部分配置:

Section "InputDevice"
	Identifier "Mouse0"
	Driver "vboxmouse"
EndSection

使用 mount_vboxvfs 来挂在用于在宿主和虚拟机之间传输文件的共享文件夹。共享文件夹可以在宿主机上通过 VirtualBox 的图形界面或者 vboxmanage 工具创建。例如,要为虚拟机 BSDBox 创建一个名为 myshare 的共享文件夹,其位于 /mnt/bsdboxshare,请执行:

# vboxmanage sharedfolder add 'BSDBox' --name myshare --hostpath /mnt/bsdboxshare

请注意共享文件夹名称中不能包含空格。要在客户机中挂载这个共享文件夹,请执行:

# mount_vboxvfs -w myshare /mnt

最后更新于

FreeBSD 中文社区