魅力博客

魅力Linux|魅力空间|魅力博客|学习Linux|ubuntu日记|电脑教程|手机软件

虚拟机与Linux二:安装Linux,VMWare Tools,建立“共享文件夹”



Linux安装文件:Ubuntu v7.10(无法下载,或想下载其他版本,可登录Ubuntu 中国官方站点 http://www.ubuntu.org.cn

1.VMWare菜单项 虚拟机 -> 设置,弹出如下界面

这里我采用的是硬盘安装的方式,直接引用了从官网上下载的.iso文件。设置方式是:点击硬件选项卡里的“CD-Rom……”,在右侧将“连接”设置为“使用ISO镜像”,点击“浏览”,指定本地文件,“确定”,完成。

2.设置完毕,点击下图中用铅笔圈起来的按钮,即可启动虚拟机(Linux安装详细过程略,安装Ubuntu 7.10时,只需要在首次画面显示时,按F2,选择语言,即可实现“傻瓜式安装”)

3.设置共享文件夹

实现“共享文件夹”,需要linux.iso文件。安装绿色版的VMWare时,没有生成该文件,所以需要我们另外去下载该文件,下载地址:http://www.vmware.cn/Soft/UploadSoft8h_4m/200803/linux.rar,解压,参照步骤1,将“使用ISO镜像”引用到本机的linux.iso。

PS:本来,我选择安装的Ubuntu linux是当前最新的版本 v8.04,可是在设置共享文件夹时,始终不能成功,甚至参照网上的文章,改了VMWare Tools linux.iso中,某个tar文件下的源代码文件,依然不行。因为我使用的linux.iso文件里,有关generic设置的C源代码文件中只涉及到了2.6.23,而Ubuntu v8.04的用的是2.6.24-19版本,所以安装不成功,换成7.10就可以正常使用了,它是2.6.22。

在我们“启动虚拟机时”时,VMWare会提示我们安装VMware Tools,就是它才使得我们可以“共享文件夹”,实现windows与linux在无网络连接的情况下,实现文件的互操作(仅限于共享的)。

具体设置:

菜单项 虚拟机 -> 设置,如下图所示

这次,我们选择“选项”选项卡,设置“共享文件夹”,“文件夹共享”选项设置为 总是启用,然后,点击添加,设置“共享文件夹”名称与“主机文件夹” ,名称任意,主机文件夹可以为某个盘符,如C:\

下一步,设置共享文件夹的操作权限 ,默认设置“启用该共享”,不要选择“只读”,不然,虚拟机上安装的linux将无法写入文件,“共享”也就没什么意义了。

“完成”,“确定”。

4.默认的我们会以安装时建立的用户来登录到linux系统,如wuw/xxxxx,但安装VMWare Tools时,必须以root用户登录。Ubuntu的安装过程中,我们也未曾接触到root用户的密码设置,如何登录?参看网文得知,开启一个终端,运行"sudo passwd root",输入密码,输入确认密码,OK,root用户的密码就设置好了。此时,我们仍然不能以root用户的身份登录到系统,还需要进行另一项设置,如下图

选择 System -> 系统管理 -> 登录窗口,此时会让你输入当前linux登录用户的密码,进行权限验证,输入正确密码,出现下图所示设置界面

选择Security选项卡,勾选“Allow local system administrator login”,允许系统管理员登录,关闭窗口(关闭窗口就会保存设置),重启虚拟机(红色的按钮)或在linux里选择关机或重启。

5.系统启动成功后,桌面上会有一个VMWare Tools的光盘图标,双击,将里面的VMwareTools-6.0.3-80004.tar.gz文件,以鼠标操作的方式拷贝到 /tmp 文件系统下,解压。开启终端,进入到该解压目录

cd vmware-tools-distrib/

./vmware-install.pl 执行安装文件

按照提示,即可完成安装。

重启电脑,开启终端
cd /mnt
ls

即会发现在 /mnt下有一个hgfs文件系统,输入ls,会看到以我们设置的共享文件名命名的(share)共享文件夹,cd share,就可以看到C盘下的该文件列表了

wuw@wuw-desktop:~$ cd /
wuw@wuw-desktop:/$ ls
bin    command.txt   etc     initrd.img media proc srv usr
boot   command.txt~ home    lib         mnt    root sys var
cdrom dev           initrd lost+found opt    sbin tmp vmlinuz
wuw@wuw-desktop:/$ cd mnt/
wuw@wuw-desktop:/mnt$ ls
hgfs
wuw@wuw-desktop:/mnt$ cd hgfs/
wuw@wuw-desktop:/mnt/hgfs$ ls
share
wuw@wuw-desktop:/mnt/hgfs$ cd share
wuw@wuw-desktop:/mnt/hgfs/share$ ls
bak          prj             wuwei                   YlmF_XPSP3_Y5.0
cvsroot      RECYCLER        Xunlei                  YlmF_XPSP3_Y5.0.iso
desktop.jpg temp            YlmF_PH_Tools_Y1.1.exe 桌面文件(others)
Downloads    vod_cache_data YlmF_XPSP2_Y3.5
oracle       workspace       YlmF_XPSP2_Y3.5.iso
wuw@wuw-desktop:/mnt/hgfs/share$ cd wuwei
wuw@wuw-desktop:/mnt/hgfs/share/wuwei$ ls
desktop.ini lib programenv programtools softwares works
wuw@wuw-desktop:/mnt/hgfs/share/wuwei$ cd /
wuw@wuw-desktop:/$ ls
bin    command.txt   etc     initrd.img media proc srv usr
boot   command.txt~ home    lib         mnt    root sys var
cdrom dev           initrd lost+found opt    sbin tmp vmlinuz
wuw@wuw-desktop:/$ cp command.txt /mnt/hgfs/share/wuwei
wuw@wuw-desktop:/$ ls
bin    command.txt   etc     initrd.img media proc srv usr
boot   command.txt~ home    lib         mnt    root sys var
cdrom dev           initrd lost+found opt    sbin tmp vmlinuz
wuw@wuw-desktop:/$ cd /mnt/hgfs/share/wuwei/
wuw@wuw-desktop:/mnt/hgfs/share/wuwei$ ls
command.txt desktop.ini lib programenv programtools softwares works
wuw@wuw-desktop:/mnt/hgfs/share/wuwei$

*************************************************************************************************************************

安装VMWare Tool

root@wuw-desktop:~# cd /
root@wuw-desktop:/# ls
bin   cdrom etc   initrd      lib         media opt   root srv tmp var
boot dev    home initrd.img lost+found mnt    proc sbin sys usr vmlinuz
root@wuw-desktop:/# cd tmp/
root@wuw-desktop:/tmp# ls
gconfd-root     scim-helper-manager-socket-root Tracker-root.5095
keyring-8sD9r4 scim-panel-socket:0-root         virtual-root.bvIUBF
mapping-root    scim-socket-frontend-root        VMwareTools.tar.gz
orbit-root      ssh-Eurrst4940
root@wuw-desktop:/tmp# tar zxf VMWareTools.tar.gz
tar: VMWareTools.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
root@wuw-desktop:/tmp# ls
gconfd-root     scim-helper-manager-socket-root Tracker-root.5095
keyring-8sD9r4 scim-panel-socket:0-root         virtual-root.bvIUBF
mapping-root    scim-socket-frontend-root        vmware-tools-distrib
orbit-root      ssh-Eurrst4940                   VMwareTools.tar.gz
root@wuw-desktop:/tmp# cd vmware-tools-distrib/
root@wuw-desktop:/tmp/vmware-tools-distrib# ls
bin doc etc FILES INSTALL installer lib vmware-install.pl
root@wuw-desktop:/tmp/vmware-tools-distrib# ./vmware-install.pl
Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools.

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

The path "/home/wuw/ware" does not exist currently. This program is going to
create it, including needed parent directories. Is this what you want?
[yes] yes

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

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

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

The path "/home/wuw/sbin" does not exist currently. This program is going to
create it, including needed parent directories. Is this what you want?
[yes] yes

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

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

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

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

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

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


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

The module bld-2.6.22-14-i386generic-Ubuntu7.10 loads perfectly in the running
kernel.

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

The module bld-2.6.22-14-i386generic-Ubuntu7.10 loads perfectly in the running
kernel.

pcnet32                34308 0
Unloading pcnet32 module

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

The module bld-2.6.22-14-i386generic-Ubuntu7.10 loads perfectly in the running
kernel.

update-initramfs: Generating /boot/initrd.img-2.6.22-14-generic
Trying to find a suitable vmblock module for your running kernel.

The module bld-2.6.22-14-i386generic-Ubuntu7.10 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] yes

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

The module bld-2.6.22-14-i386generic-Ubuntu7.10 loads perfectly in the running
kernel.

Detected X.org version 1.3.


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

Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:                                   done
   Guest filesystem driver:                                            done
   Mounting HGFS shares:                                              failed
   Guest memory manager:                                               done
   Guest vmxnet fast network device:                                   done
   New Host-Guest communications path:                                 done
   Blocking file system:                                               done
   DMA setup:                                                          done
   Guest operating system daemon:                                      done
/etc/init.d/vmware-tools: 1050: vmware-guestd: not found

The configuration of VMware Tools 6.0.3 build-80004 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:
"/home/wuw/ware/vmware-toolbox" during an X server session.

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

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

Enjoy,

--the VMware team

root@wuw-desktop:/tmp/vmware-tools-distrib#

有这样的环境,后续的,我们可以在虚拟机上进行Java开发,以及相关测试,

参考资料:

XP下VMware模拟Ubuntu不能使用共享文件夹问题解决vmhgfs
http://www.enet.com.cn/article/2007/1224/A20071224966525.shtml

虚拟机上Redhat linux9.0的VMware Tools详细图文教程
http://www.phpchina.com/39578/viewspace_14061.html

vmware 6.0.3 绿色版以及 linux.iso等VMware tools大全 下载
http://www.enet.com.cn/article/2007/1224/A20071224966525.shtml

http://yuner.csharp.blog.163.com/blog/static/2671868220086130388947



返回顶部

发表评论:

Powered By Z-BlogPHP 1.7.3


知识共享许可协议
本作品采用知识共享署名 3.0 中国大陆许可协议进行许可。
网站备案号粤ICP备15104741号-1