晚风吹

2008年4月30日星期三

如何在VMware Fusion下虚拟的Ubuntu Hardy 8.04中安装VMware Tools

Ubuntu 8.04(代号Hardy Heron)发布了,无奈我用的是MacBook,又不想Triple Boot,所以只好在VMware Fusion里安装Ubuntu,基本的安装很简单,我这里就不说了,那么我们进入正题,如何在安装好的Ubuntu里安装VMware Tools。

本文参考了Peter Cooper的Blog上的How to Install VMware Tools on Ubuntu Hardy 8.04 under VMware Fusion 以及ubuntuforum上的PabloCardoso的文章,在这里感谢他们的工作。

首先升级你的系统,安装build-essential以及内核头文件(这个好像默认已经安装),以及一些其他编译需要的文件,这些内容通过Google或者其他途径都能很容易找到,这里不再赘述。

点击VMware Fusion上面Virtual Machine->Install VMware Tools,然后将VMwareTools-version-tar.gz复制到桌面。

如果这个时候解压,安装的话,一般到运行vmware-config-tools.pl时,会出现类似如下的错误:

In file included from /tmp/vmware-config8/vmblock-only/linux/os.h:35,
from /tmp/vmware-config8/vmblock-only/linux/block.c:26:
/tmp/vmware-config8/vmblock-only/./include/compat_wait.h:78: error: conflicting types for ‘poll_initwait’
include/linux/poll.h:65: error: previous declaration of ‘poll_initwait’ was here
In file included from /tmp/vmware-config8/vmblock-only/linux/vmblockInt.h:40,
from /tmp/vmware-config8/vmblock-only/linux/block.c:29:
/tmp/vmware-config8/vmblock-only/./include/vm_basic_types.h:184: error: conflicting types for ‘uintptr_t’
include/linux/types.h:40: error: previous declaration of ‘uintptr_t’ was here
make[2]: *** [/tmp/vmware-config8/vmblock-only/linux/block.o] Error 1
make[1]: *** [_module_/tmp/vmware-config8/vmblock-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-16-generic’
make: *** [vmblock.ko] Error 2
make: Leaving directory `/tmp/vmware-config8/vmblock-only’
Unable to build the vmblock module.


总之是不能根据内核生成相应的模块,那么我们采取如下措施:

sudo apt-get install build-essential libgtk2.0-dev
sudo apt-get install libproc-dev libdumbnet-dev xorg-dev
cd Desktop/

wget http://mesh.dl.sourceforge.net/sourceforge/open-vm-tools/open-vm-tools-2008.04.14-87182.tar.gz


上面这步是安装一些编译需要的文件,同时下载最新的open-vm-tools。
接下来,解压:


tar xzvf VMware*.gz #如果你已经解压了之前的VMwareTools-version.tar.gz,那么这步可以不做
#但是建议将之前的删掉,重新执行这步
tar xzvf open-vm-tools*.gz


然后编译生成相应的模块:


cd open-vm-tools-2008.04.14-87182/
./configure && make
cd modules/linux/


在modules/linux/文件夹里,我们有vmblock, vmhgfs, vmmemctl, vmsync 和 vmxnet 模块,我们把它们打包,替换掉VMwareTools原来的模块:

for i in *; do mv ${i} ${i}-only; tar -cf ${i}.tar ${i}-only; done
cd ../../..

mv -f open-vm-tools-2008.04.14-87182/modules/linux/*.tar vmware-tools-distrib/lib/modules/source/


然后我们运行VMwareTools的安装程序,一路回车下去(除非你知道你在做什么):


cd vmware-tools-distrib/
sudo ./vmware-install.pl


当这个完成之后,重启Ubuntu,包括网络,显卡,hgfs(共享文件),主机向客户机拖拽文件等功能都可以使用了。

现在还剩下一个问题,就是Mac上,两个手指在触摸板上滑动是滚动页面,在Ubuntu客户机里却不行,那么,我们在重启Ubuntu之前,修改/etc/X11/xorg.conf文件,把其中相应的部分改成如下的样子:

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "Protocol" "IMPS/2"
Option "CorePointer"
Option "Device" "/dev/input/mice"
EndSection


然后保存,这时重启,那么所有的功能都没有问题了。

本文由Ender在2008年5月1日凌晨完成,禁止用作商业用途,有问题请联系thelastender@gmail.com

没有评论:

发表评论