在Fedora Core里启动VMware Workstation

来源:岁月联盟 编辑:zhuzhu 时间:2006-05-23
在Fedora Core里启动VMware Workstation内容简介:VMware是著名的虚拟机工具,目前的最新版本是VMware Workstation 4.0.5(Build 6030)。借助VMware虚拟机,我们可以同时启动Linux和Windows,甚至可以在一台计算机上搭建Windows/Linux虚拟混和网络。 想要学 VMware是著名的虚拟机工具,目前的最新版本是VMware Workstation 4.0.5(Build 6030)。借助VMware虚拟机,我们可以同时启动Linux和Windows,甚至可以在一台计算机上搭建Windows/Linux虚拟混和网络。

想要学习、备考RHCE的朋友,如果没有网络环境,完全可以利用VMware在单机上搭建虚拟网络,进行各种Linux网络测试,当然前提条件是机器的性能必须好(至少512MB内存)。

本文以Red Hat公司的最新桌面版本Fedora Core 1.0为例,介绍如何安装VMware Workstation 4.0.5(Build 6030)。

概述

Fedora项目是由Red Hat公司资助的开放资源社区计划,我们可以将Fedora Core 1.0看成是Red Hat Linux 9.0的后续版本。Red Hat公司的Fedora项目有点类似于Sun公司的OpenOffice项目,采用两条路并举的方法:

开放资源的Fedora项目吸引大量的程序员参加,并将源代码无偿返回给社区,符合GPL许可证;同时在Fedora项目的基础上进行优化,针对企业或个人出售商品化的操作产品。

VMware Workstation的Linux版本有两种发布方式:一种是RPM安装包,还有一种是tar安装包。这里我们选择tar安装包,可以到VMware的http://www.vmware.com去下载,所得的tar.gz安装包文件名是VMware-Workstation-4.05-6030-tar.gz。请注意,下载之前必须先进行注册,以获得30天的免费试用临时许可证,正式版本需要花费299美元。

安装的过程可以分为以下三个步骤:

(1)解压缩tar安装包文件,得到一个vmware-distrib文件夹。

(2)在文本模式下(或者桌面环境下打开终端命令窗口),然后在命令提示符下运行vmware-install.pl安装脚本,开始安装。在这个过程中,需要回答一些安装程序提出的问题。

(3)安装完成后还必须运行vmware-config.pl配置脚本,对VMware Workstation的网络组件进行配置,该阶段是整个安装过程的关键部分。
解压缩tar安装包

首先要以根用户(root)的身份登录Fedora Core 1.0,如图1所示。当然也可以在其它用户环境下运行“su-”切换到root用户环境。



进入桌面以后,先要解压缩tar.gz安装包,可以用图形化方式进行解压缩。方法很简单,进入tar.gz安装包所在的目录,然后用鼠标右键单击该tar.gz压缩包的图标,在弹出选单上单击“解压到这里”选单项,如图2所示。



即可弹出一个“解压缩”对话框,在其上的“解压缩到”框里定位到/tmp目录,然后单击“确定”按钮,即可开始解压缩。

安装VMware

解压缩的结果是在/tmp目录增加一个vmware-distrib文件夹,现在就可以开始正式安装了。单击“主选单”→“工具”→“终端”选单项,打开终端命令窗口(它类似于Windows XP下的DOS命令提示符窗口)。然后,依次输入以下命令,并回车:

[root@peter root] # cd /tmp                    [root@peter tmp] # cd vmware-distrib           [root@peter vmware-distrib] # ./ vmware-install.pl

上面命令表示切换到/tmp目录和解压缩后的vmware-distrib目录,运行该目录下的vmware-install.pl脚本。

接下来开始安装,安装程序会提问一些问题,并同时给出缺省的答案,直接回车即可接受这些缺省的答案,如图3所示。

我们可以修改一些安装问题的缺省答案,下面介绍一些安装时所必须回答的问题:

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

询问二进制可执行文件的安装路径,缺省是/usr/bin目录,此参数无需自定义。

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

询问库文件的安装路径,缺省是/usr/lib/vmware目录,此参数无需自定义。

3.In which directory do you want to install the manual files? [/usr/share/man]

询问VMware帮助手册的安装路径,缺省是/usr/share/man目录,可以指定其它目录。

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

询问VMware文档的安装路径,缺省是/usr/share/doc/vmware目录,可以指定其它目录。

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

询问里哪个目录包含初始化目录,缺省是rc0.d/~rc6.d/,除非Linux是别的目录,否则无需修改。

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

询问里哪个目录包含初始化脚本文件,缺省是/etc/rc.d/init.d,除非Linux是别的目录,否则无需修改。

回答完上面这些问题,将会出现以下信息,提示VMware Workstation已经成功安装,可以用“/usr/bin/vmware-uninstall.pl”命令卸载VMware Workstation。

The installation of VMware Workstation 4.0.5 build-6030 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.pl".

请注意,如果采用RPM格式封装的安装发布包,则安装过程十分简单,只需要在命令提示符下运行以下命令即可:

[root@peter root] # rpm -Uhv VMware-<xxx>.rpm

其中,VMware-.rpm用实际的软件包名称代替。

尽管RPM格式安装起来更加方便,但是还是推荐使用tar.gz封装的源代码安装包,因为这样有更多可自定义的安装选项。

为了能够正确地安装VMware Workstation,强烈推荐完全安装Fedora Core 1.0,以免安装程序提示缺少什么组件,同时不要升级Linux内核。

VMware的网络配置

安装好VMware Workstation,只能算是万里长征走完了第一步。在第一次运行VMware Workstation之前,还需要对其进行网络配置,安装必须的网络组件。这一步可以说是关键中的关键。

安装好tar安装包,会提示是否需要自动运行vmware-config.pl配置脚本,选择“yes”,然后接受最终用户许可协议(EULA:End User License Agreement)。

接下来会提示需要把vmmon模块编译进内核。由于Fedora Core 1.0所使用的usr/bin/gcc版本(3.2.3)和所需的GCC版本(3.2.2)不符合,配置程序警告说可能导致VMware Workstation崩溃,不要理会VMware的警告,键入“yes”,并回车开始强行编译。

接下来会出现以下提问:

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

这是询问匹配当前内核的C头文件的存放路径,按回车键接受默认路径/lib/modules/2.4.22-1.2115.nptl/build/include。

然后开始编译。如果最后出现以下提示信息,则说明编译成功,模块已经加载到内核:

The module loads perfectly in the running kernel.

接下来会询问一些配置过程所必须回答的问题,这是一个关键。很多朋友抱怨他们的VMware Workstation老是不听使唤,无法使用其网络功能,究其原因是因为没有正确地回答这些问题。下面就详细解释这些重要问题。

1.Do you want networking for your virtual machines? (yes/no/help)

这是询问是否需要进行虚拟机的网络配置,回答“yes”。如果回答“no”,则中止配置过程。键入“help”即可查看详细帮助信息:

Networking will allow your virtual machines to use a virtual network.There are primarily two types of networking available: bridged and host-only. A bridged network is a virtual network that is connected to an existing ethernet device. With a bridged network, your virtual machines will be able to communicate with other machines on the network to which the ethernet card is attached.  A host-only network is a private network between yourvirtual machines and host. Virtual machines connected to a host-onlynetwork may only communicate directly with other virtual machines or the host. A virtual machine may be configured with more than one bridged or host-only network.

配置程序允许虚拟机使用虚拟网络,有两种类型的网络配置:Bridge(网桥)模式和Host-only(仅宿主机模式)。网桥网络是连接到物理网卡上的虚拟网络,虚拟机可以通过网桥网络连接外部网络──通过物理网卡连接的外部网络。

仅宿主机网络是仅供宿主机、虚拟机通信的虚拟网络,Host-only网络上的虚拟机只能和宿主机、或其它虚拟机直接通信。一个虚拟机可以同时配置多个Bridged网络或Host-only网络。

回答“yes”后,将会出现以下提示信息,表示正在配置桥接网络组件(vmnet0)和NAT网络组件(vmnet8):

Configuring a bridged network for vmnet0.Configuring a NAT network for vmnet8.

2.Do you want this program to probe for an unused private subnet? (yes/no/help)

这是询问是否需要配置程序搜索未使用的专用子网地址,这里可以回答“yes”。如果不明白这个问题的具体含义,只要键入“help”即可查看详细帮助信息:

Virtual machines configured to use NAT networking are placed on a virtual network that is confined to this host. Virtual machines on this network can communicate with the network through the NAT process,with each other, and with the host.

虚拟专用网络上的虚拟机是通过NAT来和宿主机、其它虚拟机进行通信。

To setup NAT networking you need to select a network number that is normally unreachable from the host. We can automatically select this number for you, or you can specify a network number that you want.

要正确设置NAT网络,必须选择一个从宿主机无法访问的网络地址。配置程序可以为我们自动选择一个合适的网络地址,或者也可以自己指定一个网络地址。

The automatic selection process works by testing a series of Class C subnet numbers to see if they are reachable from the host. The first one that is unreachable is used. The subnet numbers are chosen from the private network numbers specified by the InternetEngineering Task Force (IETF) in RFC 1918 (http://www.isi.edu/in-notes/rfc1918.txt).

配置程序可以自动测试一组C类网络地址来查看是否可以从宿主机访问,配置程序会自动选择第一个无法访问的网络地址。

Virtual machines residing on the NAT network will appear as thehost when ing the network. These virtual machines on the NAT network will not be ible from outside the host machine. This means that it is OK to use the same number on different systemsso long as you do not enable IP forwarding on the host.

NAT网络上的虚拟机可以像宿主机一样访问外部网络,但是外部网络的计算机无法访问NAT网络上的虚拟机。这意味着只要不启用宿主机的IP转发功能,不同的虚拟机就可以采用同一个IP地址。

回答“yes”之后,将出现以下提示信息,表示已经搜索到一个合适的网络地址(192.168.120.0,子网掩码255.255.255.0)。

Probing for an unused private subnet (this can take some time)...The subnet 192.168.120.0/255.255.255.0 appears to be unused.……

3.Do you want this program to automatically configure your system to allow your virtual machines to the host's filesystem? (yes/no/help)

这是询问是否需要配置程序自动配置,使得虚拟机可以访问宿主机的文件。按“help”查看帮助信息:

To configure your system for host filesystem ,the program will install VMware's networking software to allow your virtual machines to use the network. It will also install a private Samba server to export your host's filesystem on a virtual network that is private to the physical machine and your virtual machines. If you already have a Samba server running on your host, it is highly recommended to answer "no" to this option.

要配置允许宿主机访问,配置程序将会安装VMware的网络软件,来允许虚拟机使用虚拟网络。同时也会安装一个专用的Samba服务器,该Samba服务器仅向虚拟网络提供宿主机文件的访问。如果宿主机里已经安装了Samba服务器,建议回答“no”,以防两者产生冲突。

这里我们假设宿主机里没有Samba服务器,所以回答“yes”。

4.You have successfully configured VMware Workstation to allow your virtual machines to the host's filesystem. Would you like to add a username and password for ing your host's filesystem via network interface vmnet1 at this time? (yes/no/help)

这个问题的主要意思是现在已经成功配置宿主机访问功能,询问是否添加通过网络接口vmnet1访问宿主机网络的用户名、密码。这里可以回答“yes”,然后输入合适的账号、密码即可。接下来会提示以下信息,表示配置工作已经成功完成,今后可以使用“/usr/bin/vmware”命令来运行VMware Workstation:

The configuration of VMware Workstation 4.0.5 build-6030for Linux for this running kernel completed successfully.You can now run VMware Workstation by invoking the following command: "/usr/bin/vmware".Enjoy,--the VMware team

请注意,如果采用RPM安装包安装VMware Workstation,则不会提示是否运行vmware-config.pl配置脚本,必须手动运行该脚本文件。如果升级了Linux内核版本,则必须重新运行vmware-config.pl配置脚本。

我们还可以使用vmware-config.pl配置脚本重新配置VMware Workstation的网络组件,例如添加或删除Host-only网络组件。