原创 虚拟机vmware tool安装与hgfs共享目录

2010-6-27 12:36 10197 10 10 分类: MCU/ 嵌入式

嵌入式linux开发环境的建立之


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

                                                        虚拟机vmware tool安装与hgfs共享目录


 


下载最新的虚拟机vmware6 ,安装比较简单,这里要提出的是安装vmware-tool。完整版的虚拟机安装包中是带有vmware toollinux下)的安装包的,其在vmware的安装目录下的linux.iso中,而windows下的vmware toolwindows.iso中。


本人在开发过程中主要想用到安装vmware tool带来的两大服务:


 


1.  提供了更多的显示器分辨率选择,是鼠标不漂移。


2.  利用hgfs服务,实现虚拟机linux pc windows文件共享


 


安装vmware tool 步骤如下(redhat9.0中实践)


VMWARE->VM->INSTALL VMWARE TOOL


此时Linux自动挂载了虚拟机中的linux.iso


进入挂载的目录后执行以下操作:



[root@rd01 ~]#
cp VMwareTools-<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />5.5.1-19175.tar.gz /tmp
[root@rd01 ~]#
cd /tmp

[root@rd01 ~]#
tar zxpf VMwareTools-5.5.1-19175.tar.gz

[root@rd01 ~]#
cd vmware-tools-distrib

[root@rd01 vmware-tools-distrib]#
./vmware-install.pl

Creating a new installer database using the tar3 format.

Installing the content of the package.

#
安装过程的画面,全部使用默认值,一直按 Enter 就对了

In which directory do you want to install the binary files?
[/usr/bin]

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]


What is the directory that contains the init scripts?
[/etc/rc.d/init.d]


In which directory do you want to install the daemon files?
[/usr/sbin]


In which directory do you want to install the library files?
[/usr/lib/vmware-tools]


Thepath "/usr/lib/vmware-tools" does not exist currently. This programisgoingto create it, including needed parent directories. Is thiswhatyou want?
[yes]

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]


Thepath "/usr/share/doc/vmware-tools" does not exist currently.Thisprogram isgoing to create it, including needed parent directories.Isthis what you want?
[yes]


The installation of VMware Tools 5.5.1 build-19175 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now?
[yes]



Stopping VMware Tools services in the virtual machine:

Guest operating system daemon:
[ 确定 ]

Trying to find a suitable vmhgfs module for your running kernel.

The module bld-2.6.9-5.EL-i686-RHEL4 loads perfectly in the running kernel.

pcnet32 30153 0
Unloading pcnet32 module

Trying to find a suitable vmxnet module for your running kernel.

The module bld-2.6.9-5.EL-i686-RHEL4 loads perfectly in the running kernel.



Detected X.org version 6.8.

关闭控制台鼠标服务: [ 确定 ]
启动控制台鼠标服务: [ 确定
]

Please choose one of the following display sizes (1 - 13):

#
显示分辨率,这里是以 1024x768 为例


# VMware Tools
安装的时候,会自动修改 X server 的配置文件


[1] "640x480"
[2]< "800x600"
[3] "1024x768"
[4] "1152x864"
[5] "1280x800"
[6] "1152x900"
[7] "1280x1024"
[8] "1376x1032"
[9] "1400x1050"
[10] "1680x1050"
[11] "1600x1200"
[12] "1920x1200"
[13] "2364x1773"
Please enter a number between 1 and 13:

[2] 3



X Window System Version 6.8.2
Release Date: 9 February 2005
X Protocol Version 11, Revision 0, Release 6.8.2
Build Operating System: Linux 2.6.9-34.EL i686 [ELF]
Current Operating System: Linux rd01.domain 2.6.9-34.EL #1 Wed Mar 8 00:07:35 CST 2006 i686
Build Date: 04 May 2006
Build Host: x8664-build.centos.org

Before reporting problems, check <?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
http://wiki.X.Org
to make sure that you have the latest version.
Module Loader present
OSKernel: Linux version 2.6.9-34.EL (buildcentos@build-i386) (gccversion3.4.5 20051201 (Red Hat 3.4.5-2)) #1 Wed Mar 8 00:07:35 CST 2006P
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(++) Log file: "/tmp/vmware-config0/XF86ConfigLog.3131", Time: Mon Jun 12 20:57:34 2006
(++) Using config file: "/tmp/vmware-config0/XF86Config.3131"
(WW) VMWARE(0): Failed to set up write-combining range (0xf0000000,0x1000000)

X is running fine with the new config file.

Starting VMware Tools services in the virtual machine:
Switching to guest configuration: [
确定 ]
Guest filesystem driver: [
确定
]
DMA setup: [
确定
]
Guest operating system daemon: [
确定
]

The configuration of VMware Tools 5.5.1 build-19175 for Linux for this running
kernel completed successfully.

You must restart your X session before any mouse or graphics changes take
effect.

You can now run VMware Tools by invoking the following command:
"/usr/bin/vmware-toolbox" during an XFree86 session.

To use the vmxnet driver, restart networking using the following commands:
/etc/init.d/network stop
rmmod pcnet32
rmmod vmxnet
depmod -a
modprobe vmxnet
/etc/init.d/network start

Enjoy,

--the VMware team

[root@rd01 vmware-tools-distrib]#
shutdown -r now

#
修改完成之后,重新启动计算机,让 VMware Tools 生效


 


以上步骤经过验证在redhat9.0中完全正确。但是在高版本的linux内核(如fedora12)中安装vmware tool 却会遇到很多问题,使其一些服务都不能用,尤其是hgfs共享目录不能用,在安装时提示了一些内核相关的错误。


 


网上有人建议 open-vm-tools来实现共享,以下是转的(具体没有去试)


 


以下是安装的open-vm-tools的方法:
1. #apt-get install libdumbnet-dev libgtk2.0-dev libicu-dev libpam0g-dev libproc-dev liburiparser-dev libxtst-dev
2. #apt-get install open-vm-tools
    #apt-get -b source open-vm-tools
3.http://sourceforge.net/project/showfiles.php?group_id=204462
下载最新的open-vm-tools,  我用的是2009.03.18.
  #tar zxvf open-vm-tools-2009.03.18-154848
  #cd open-vm-tools-2009.03.18-154848
  #./configure --without-x
  #make
  #make install
4. #gedit /etc/init.d/open-vm-tools
   
. /lib/lsb/init-functions下添加如下内容:
mount -t vmhgfs .host:/ /mnt/hgfs/
5.
点击"虚拟机"--"设置"--"选项"里设置共享文件夹.
6.
重启虚拟机。


 


这里再转一篇遇到问题后又解决了共享问题的帖子:


 


 


原来我都是用windowslinux双系统的,但是听朋友说用虚拟机很方便,于是我就在windows系统上安装了虚拟机,然后在虚拟机上安装了Fedora 6版本linux。接着麻烦事就来了,vm tools怎么也安装不上,虽然显示效果方面我不在乎,可是没有vm toolswindowslinux的文件共享上还是有些麻烦的。

我按照安装步骤一步步进行,可是总是提示我版本不一致的问题。我到网上查了些资料说升级就可以了

所以我就用命令
yun install gcc

yun install kernel
devel

升级成功。用uname r看到的版本信息和rpm q kerneldevel看到的版本信息是一致的了!但是等到安装vm tools的时候和原来一样的错误信息还是出现,安装还是不成功。经过了不知道多少次的失败尝试后我终于......换了一个新版本的vmwarevmware6。这下终于安装成功了。

什么点击安装菜单,解压等就不说了,下面是我的安装过程的全记录。

注意:网上好地方说所有选项都选择【是】或是直接回车就可以了,其实不是这样的,其中有一项要特别

注意。就是询问是否要安装主机和vm的通信通道......这一项的默认是【no】,如果直接回车就会造成主

机和vm无法直接通信。

[root@bogon tmp]# ls
gconfd-root scim-panel-socket:0-root
keyring-JEC5MC scim-socket-frontend-root
mapping-root ssh-wkfPkG2186
orbit-root virtual-root.UjDoTy
scim-bridge-0.3.0.lockfile-0@localhost:0.0 VMwareTools-6.0.2-59824.tar.gz
scim-bridge-0.3.0.socket-0@localhost:0.0 vmware-tools-distrib
scim-helper-manager-socket-root
[root@bogon tmp]# cd vmware-tools-distrib/
[root@bogon vmware-tools-distrib]# ls
bin doc etc FILES INSTALL installer lib vmware-install.pl
[root@bogon vmware-tools-distrib]# ./vmware-install.pl
A previous installation of VMware Tools has been detected.

The previous installation was made by the tar installer (version 3).

Keeping the tar3 installer database format.

Uninstalling the tar installation of VMware Tools.

Stopping VMware Tools services in the virtual machine:
Guest operating system daemon: [
确定]

The removal of VMware Tools 5.0.0 build-13124 for Linux completed successfully.
Thank you for having tried this software.

Converting the tar3 installer database format to the tar4 installer database
format.

Installing VMware Tools.

In which directory do you want to install the binary files?
[/usr/bin]

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]

What is the directory that contains the init scripts?
[/etc/rc.d/init.d]

In which directory do you want to install the daemon files?
[/usr/sbin]

In which directory do you want to install the library files?
[/usr/lib/vmware-tools]

The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes] y

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]

The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes] y

The installation of VMware Tools 6.0.2 build-59824 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes] y


Stopping VMware Tools services in the virtual machine:
Guest operating system daemon: [
确定]
Trying to find a suitable vmmemctl module for your running kernel.

None of the pre-built vmmemctl modules for VMware Tools is suitable for your
running kernel. Do you want this program to try to build the vmmemctl module
for your system (you need to have a C compiler installed on your system)?
[yes] y

Using compiler "/usr/bin/gcc". Use environment variable CC to override.

What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.18-1.2798.fc6/build/include]

Extracting the sources of the vmmemctl module.

Building the vmmemctl module.

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmmemctl-only'
make -C /lib/modules/2.6.18-1.2798.fc6/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
CC [M] /tmp/vmware-config0/vmmemctl-only/os.o
SHIPPED /tmp/vmware-config0/vmmemctl-only/vmmemctl1.o
LD [M] /tmp/vmware-config0/vmmemctl-only/vmmemctl.o
Building modules, stage 2.
MODPOST
WARNING: could not find /tmp/vmware-config0/vmmemctl-only/.vmmemctl1.o.cmd for /tmp/vmware-

config0/vmmemctl-only/vmmemctl1.o
CC /tmp/vmware-config0/vmmemctl-only/vmmemctl.mod.o
LD [M] /tmp/vmware-config0/vmmemctl-only/vmmemctl.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
cp -f vmmemctl.ko ./../vmmemctl.o
make: Leaving directory `/tmp/vmware-config0/vmmemctl-only'
The module loads perfectly in the running kernel.

Trying to find a suitable vmhgfs module for your running kernel.

None of the pre-built vmhgfs modules for VMware Tools is suitable for your
running kernel. Do you want this program to try to build the vmhgfs module for
your system (you need to have a C compiler installed on your system)? [yes] y

Extracting the sources of the vmhgfs module.

Building the vmhgfs module.

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmhgfs-only'
make -C /lib/modules/2.6.18-1.2798.fc6/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
CC [M] /tmp/vmware-config0/vmhgfs-only/backdoor.o
CC [M] /tmp/vmware-config0/vmhgfs-only/backdoorGcc32.o
CC [M] /tmp/vmware-config0/vmhgfs-only/bdhandler.o
CC [M] /tmp/vmware-config0/vmhgfs-only/cpName.o
CC [M] /tmp/vmware-config0/vmhgfs-only/cpNameLinux.o
CC [M] /tmp/vmware-config0/vmhgfs-only/cpNameLite.o
CC [M] /tmp/vmware-config0/vmhgfs-only/dbllnklst.o
CC [M] /tmp/vmware-config0/vmhgfs-only/dentry.o
CC [M] /tmp/vmware-config0/vmhgfs-only/dir.o
CC [M] /tmp/vmware-config0/vmhgfs-only/eventManager.o
CC [M] /tmp/vmware-config0/vmhgfs-only/file.o
CC [M] /tmp/vmware-config0/vmhgfs-only/filesystem.o
CC [M] /tmp/vmware-config0/vmhgfs-only/fsutil.o
CC [M] /tmp/vmware-config0/vmhgfs-only/hgfsBd.o
CC [M] /tmp/vmware-config0/vmhgfs-only/hgfsUtil.o
CC [M] /tmp/vmware-config0/vmhgfs-only/inode.o
CC [M] /tmp/vmware-config0/vmhgfs-only/kernelStubsLinux.o
CC [M] /tmp/vmware-config0/vmhgfs-only/link.o
CC [M] /tmp/vmware-config0/vmhgfs-only/message.o
CC [M] /tmp/vmware-config0/vmhgfs-only/module.o
CC [M] /tmp/vmware-config0/vmhgfs-only/page.o
CC [M] /tmp/vmware-config0/vmhgfs-only/request.o
CC [M] /tmp/vmware-config0/vmhgfs-only/rpcin.o
CC [M] /tmp/vmware-config0/vmhgfs-only/rpcout.o
CC [M] /tmp/vmware-config0/vmhgfs-only/staticEscape.o
CC [M] /tmp/vmware-config0/vmhgfs-only/stubs.o
CC [M] /tmp/vmware-config0/vmhgfs-only/super.o
LD [M] /tmp/vmware-config0/vmhgfs-only/vmhgfs.o
Building modules, stage 2.
MODPOST
CC /tmp/vmware-config0/vmhgfs-only/vmhgfs.mod.o
LD [M] /tmp/vmware-config0/vmhgfs-only/vmhgfs.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
cp -f vmhgfs.ko ./../vmhgfs.o
make: Leaving directory `/tmp/vmware-config0/vmhgfs-only'
The module loads perfectly in the running kernel.

pcnet32 38213 0
Unloading pcnet32 module

Trying to find a suitable vmxnet module for your running kernel.

None of the pre-built vmxnet modules for VMware Tools is suitable for your
running kernel. Do you want this program to try to build the vmxnet module for
your system (you need to have a C compiler installed on your system)? [yes] y

Extracting the sources of the vmxnet module.

Building the vmxnet module.

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmxnet-only'
make -C /lib/modules/2.6.18-1.2798.fc6/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
CC [M] /tmp/vmware-config0/vmxnet-only/vmxnet.o
Building modules, stage 2.
MODPOST
CC /tmp/vmware-config0/vmxnet-only/vmxnet.mod.o
LD [M] /tmp/vmware-config0/vmxnet-only/vmxnet.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
cp -f vmxnet.ko ./../vmxnet.o
make: Leaving directory `/tmp/vmware-config0/vmxnet-only'
The module loads perfectly in the running kernel.

Trying to find a suitable vmblock module for your running kernel.

None of the pre-built vmblock modules for VMware Tools is suitable for your
running kernel. Do you want this program to try to build the vmblock module
for your system (you need to have a C compiler installed on your system)?
[yes] y

Extracting the sources of the vmblock module.

Building the vmblock module.

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmblock-only'
make -C /lib/modules/2.6.18-1.2798.fc6/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
CC [M] /tmp/vmware-config0/vmblock-only/linux/block.o
CC [M] /tmp/vmware-config0/vmblock-only/linux/control.o
CC [M] /tmp/vmware-config0/vmblock-only/linux/dbllnklst.o
CC [M] /tmp/vmware-config0/vmblock-only/linux/dentry.o
CC [M] /tmp/vmware-config0/vmblock-only/linux/file.o
CC [M] /tmp/vmware-config0/vmblock-only/linux/filesystem.o
CC [M] /tmp/vmware-config0/vmblock-only/linux/inode.o
CC [M] /tmp/vmware-config0/vmblock-only/linux/module.o
CC [M] /tmp/vmware-config0/vmblock-only/linux/stubs.o
CC [M] /tmp/vmware-config0/vmblock-only/linux/super.o
LD [M] /tmp/vmware-config0/vmblock-only/vmblock.o
Building modules, stage 2.
MODPOST
CC /tmp/vmware-config0/vmblock-only/vmblock.mod.o
LD [M] /tmp/vmware-config0/vmblock-only/vmblock.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
cp -f vmblock.ko ./../vmblock.o
make: Leaving directory `/tmp/vmware-config0/vmblock-only'
The module loads perfectly in the running kernel.

[EXPERIMENTAL] The Virtual Machine Communication Interface (VMCI) service
provides a new communication capability with the Host, primarily for
development at the moment. Would you like to enable this feature? [no] y

Trying to find a suitable vmci module for your running kernel.

None of the pre-built vmci modules for VMware Tools is suitable for your
running kernel. Do you want this program to try to build the vmci module for
your system (you need to have a C compiler installed on your system)? [yes] y

Extracting the sources of the vmci module.

Building the vmci module.

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmci-only'
make -C /lib/modules/2.6.18-1.2798.fc6/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
CC [M] /tmp/vmware-config0/vmci-only/dbllnklst.o
CC [M] /tmp/vmware-config0/vmci-only/kernelStubsLinux.o
CC [M] /tmp/vmware-config0/vmci-only/vmciDatagram.o
CC [M] /tmp/vmware-config0/vmci-only/vmci_drv.o
CC [M] /tmp/vmware-config0/vmci-only/vmciProcess.o
CC [M] /tmp/vmware-config0/vmci-only/vmciResource.o
CC [M] /tmp/vmware-config0/vmci-only/vmciSharedMemory.o
CC [M] /tmp/vmware-config0/vmci-only/vmciTest.o
CC [M] /tmp/vmware-config0/vmci-only/vmciUtil.o
LD [M] /tmp/vmware-config0/vmci-only/vmci.o
Building modules, stage 2.
MODPOST
CC /tmp/vmware-config0/vmci-only/vmci.mod.o
LD [M] /tmp/vmware-config0/vmci-only/vmci.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
cp -f vmci.ko ./../vmci.o
make: Leaving directory `/tmp/vmware-config0/vmci-only'
The module loads perfectly in the running kernel.


Detected X.org version 7.1.


Please choose one of the following display sizes that X will start with (1 -
15):

[1] "640x480"
[2]< "800x600"
[3] "1024x768"
[4] "1152x864"
[5] "1280x800"
[6] "1152x900"
[7] "1280x1024"
[8] "1376x1032"
[9] "1400x900"
[10] "1400x1050"
[11] "1440x900"
[12] "1680x1050"
[13] "1600x1200"
[14] "1920x1200"
[15] "2364x1773"
Please enter a number between 1 and 15:

[2] 3


X Window System Version 7.1.1
Release Date: 12 May 2006
X Protocol Version 11, Revision 0, Release 7.1.1
Build Operating System: Linux 2.6.9-34.ELsmp i686 Red Hat, Inc.
Current Operating System: Linux bogon 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:37:32 EDT 2006

i686
Build Date: 04 October 2006
Build ID: xorg-x11-server 1.1.1-47.fc6
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(++) Log file: "/tmp/vmware-config0/XF86ConfigLog.2583", Time: Wed Jan 9 14:28:51 2008
(++) Using config file: "/tmp/vmware-config0/XF86Config.2583"

X is running fine with the new config file.

(EE) AIGLX: Screen 0 is not DRI capable
FreeFontPath: FPE "unix/:7100" refcount is 2, should be 1; fixing.
Starting VMware Tools services in the virtual machine:
Switching to guest configuration: [
确定]
Guest filesystem driver: [
确定]
Mounting HGFS shares: [
失败]
Guest memory manager: [
确定]
Guest vmxnet fast network device: [
确定]
New Host-Guest communications path: [
确定]
Blocking file system: [
确定]
DMA setup: [
确定]
Guest operating system daemon: [
确定]

The configuration of VMware Tools 6.0.2 build-59824 for Linux for this running
kernel completed successfully.

You must restart your X session before any mouse or graphics changes take
effect.

You can now run VMware Tools by invoking the following command:
"/usr/bin/vmware-toolbox" during an X server session.

To use the vmxnet driver, restart networking using the following commands:
/etc/init.d/network stop
rmmod pcnet32
rmmod vmxnet
modprobe vmxnet
/etc/init.d/network start

To make use of the virtual printer, you will need to restart the CUPS service

Enjoy,

--the VMware team

[root@bogon vmware-tools-distrib]#

安装好后建一个共享文件夹,在vm的菜单中vmsettingoptionshared folders ,添好相应的设置就可以了。注意,还没完呢。还要禁止虚拟机的防火墙,包括禁用Selinux

至此,终于能在虚拟机的file:/mnt/hgfs目录下看到共享的windows文件夹了。通过这个文件夹主机和vm就可以传递文件了。


 


 

文章评论0条评论)

登录后参与讨论
我要评论
0
10
关闭 站长推荐上一条 /2 下一条