歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> Linux文化 >> 在Fedora Core裡啟動VMware Workstation

在Fedora Core裡啟動VMware Workstation

日期:2017/2/27 12:02:19   编辑: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 your virtual machines and host. Virtual machines connected to a host-only network 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 Internet Engineering 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 the host when accessing the network. These virtual machines on the NAT network will not be accessible from outside the host machine. This means that it is OK to use the same number on different systems so 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 access the host's filesystem? (yes/no/help)

這是詢問是否需要配置程序自動配置系統,使得虛擬機可以訪問宿主機的文件系統。按“help”查看幫助信息:

To configure your system for host filesystem access, 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 access the host's filesystem. Would you like to add a username and password for accessing 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-6030 for 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網絡組件。

Copyright © Linux教程網 All Rights Reserved