首页>教程>FreeBSD 教程> 虚拟机配置 >FreeBSD 在 VMware 虚拟机内需要的配置

FreeBSD 在 VMware 虚拟机内需要的配置

如果你是在 VMware 虚拟机中使用 FreeBSD 系统,还需要做一些额外的配置,才能正常使用,需要安装 VMware 显卡驱动,增强工具,同时还需要做一些 Xorg 的额外配置。

安装 VMWare 显卡驱动

VMWare 虚拟环境中安装显卡驱动需要使用专用的显卡驱动软件包 xf86-video-vmware

1)安装显卡驱动软件包:

pkg install xf86-video-vmware

2)模块不用显式加载,系统内核会根据需要自动加载。

如果是在 VMWare Workstation 中安装使用 FreeBSD,那么就需要一些额外的配置。

安装增强工具

要丝滑的在 VMWare 中使用 FreeBSD 需要安装增强工具,才能实现在主机和客户机之间复制文件和文本等增强功能。

使用如下命令安装增强工具:

sudo pkg install open-vm-tools

安装鼠标驱动

在 VMWare 中使用系统默认的鼠标驱动,会出现鼠标移动问题。

因此需要安装专用的鼠标驱动:

sudo pkg install xf86-input-vmmouse

启用服务

在 VMWare 中需要启用硬件访问服务和鼠标服务(很有可能你系统中已经启用了相应的服务):

sudo sysrc hald_enable="YES" #Hardware Access Layer 服务进程
sudo sysrc moused_enable="YES" #mouse 服务进程

生成配置文件

1)运行 Xorg 提供的专用命令生成配置文件:

sudo Xorg -configure

生成的配置文件为 /root/xorg.conf.new

2)把配置文件复制到配置目录:

sudo cp /root/xorg.conf.new /usr/local/etc/X11/xorg.conf

修改配置

在配置文件 /usr/local/etc/X11/xorg.conf 内修改内容,使其适合在 VMWare 中使用。

禁用自动添加设备

禁用自动添加设备防止自动添加一些系统默认的设备,与修改后的设备发生冲突,致使设备无法使用。

Section "ServerLayout"
        Identifier      "X.org Configured"
        Screen      0   "Screen0" 0 0
        InputDevice     "Mouse0" "CorePointer"
        InputDevice     "Keyboard0" "CoreKeyboard"
EndSection  

在类似如上的内容 Section 部分的内部添加 Option "AutoAddDevices" "Off" 修改为类似如下的内容:

Section "ServerLayout"
        Identifier      "X.org Configured"
        Screen      0   "Screen0" 0 0
        InputDevice     "Mouse0" "CorePointer"
        InputDevice     "Keyboard0" "CoreKeyboard"
        Option          "AutoAddDevices" "Off"
EndSection  

修改鼠标设备

把系统使用的默认鼠标设备修改为 VMWare 专用的鼠标设备,这样才能够在虚拟机中丝滑、流畅的使用鼠标。

Section "InputDevice"
        Indentifier  "Mouse0"
        Driver       "mouse"
        Option       "Protocol" "auto"
        Option       "Device" "/dev/sysmouse"
        Option       "ZAxisMapping" "4 5 6 7"
EndSection

把类似如上的内容 Section 部分的内部添加 mouse 修改为 vmmouse

Section "InputDevice"
        Indentifier  "Mouse0"
        Driver       "vmmouse"
        Option       "Protocol" "auto"
        Option       "Device" "/dev/sysmouse"
        Option       "ZAxisMapping" "4 5 6 7"
EndSection