一般虚拟机的常见场景是在WINDOWS下安装Linux虚拟机,但是有一些情况需要倒过来,比如在Linux下安装VMware虚拟机来反过来安装WINDOWS.
一.RHEL版本的VMWare的安装
可以从官网下载安装程序,VMWare Server是免费的,你可以从看到相关说明
http://info.vmware.com/content/GLP_VMwareServer
我使用提 VMware-server-1.0.10-203137.i386.rpm这个安装包.
在命令行下执行如下命令安装
rpm -ivh VMware-server-1.0.10-203137.i386.rpm
Preparing...######################### [100%]
1:VMware-server ################### [100%]
成功后,直接执行vmware,第一次运行提醒需要运行vmware-config.pl 进行配置.
[root@hxy tools]# vmware
vmware is installed, but it has not been (correctly) configured
for this system. To (re-)configure it, invoke the following command:
/usr/bin/vmware-config.pl.
配置过程,主要都采用缺省值
[root@hxy tools]# /usr/bin/vmware-config.pl
Making sure services for VMware Server are stopped.
Stopping VMware services:
Virtual machine monitor [ OK ]
You must read and accept the End User License Agreement to continue.
Press enter to display it.
Do you accept? (yes/no) yes
Thank you.
Configuring fallback GTK+ 2.4 libraries.
In which directory do you want to install the mime type icons?
[/usr/share/icons]
What directory contains your desktop menu entry files? These files have a
.desktop file extension. [/usr/share/applications]
In which directory do you want to install the application's icon?
[/usr/share/pixmaps]
接下来编译了VMMon模块
Trying to find a suitable vmmon module for your running kernel.
None of the pre-built vmmon modules for VMware Server is suitable for your
running kernel. Do you want this program to try to build the vmmon module for
your system (you need to have a C compiler installed on your system)? [yes]
Trying to find a suitable vmmon module for your running kernel.
None of the pre-built vmmon modules for VMware Server is suitable for your
running kernel. Do you want this program to try to build the vmmon module for
your system (you need to have a C compiler installed on your system)? [yes] yes
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-194.el5/build/include]
Extracting the sources of the vmmon module.
tar: vmmon-only/linux/driver.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/linux/driver.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/linux/hostif.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/linux/vmmonInt.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/linux/vmhost.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/linux: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/memtrack.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/memtrack.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/task.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/task.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/vmx86.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/vmx86.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/hostif.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/hostKernel.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/phystrack.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/phystrack.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/cpuid.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/cpuid.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common/hash.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/common: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/vmcore/driver_vmcore.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/vmcore/moduleloop.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/vmcore: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/initblock.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/machine.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/modulecall.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vm_asm.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vm_asm_x86.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vm_asm_x86_64.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vm_time.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vcpuset.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/x86.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/x86types.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/x86desc.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/x86apic.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/x86vt.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vmm_constants.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/contextinfo.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/uccostTable.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/x86cpuid.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/speaker_reg.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vmware.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vm_assert.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vm_atomic.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vm_basic_asm.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vm_basic_asm_x86.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vm_basic_asm_x86_64.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vm_basic_defs.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vm_basic_types.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vcpuid.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/iocontrols.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/pshare_ext.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/cpuid_info.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vmware_pack_init.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vmware_pack_begin.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/vmware_pack_end.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/driver-config.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_highmem.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_pgtable.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_spinlock.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_uaccess.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_mm.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_file.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_wait.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_page.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_version.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_timer.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_semaphore.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_sched.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_kernel.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/compat_completion.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/pgtbl.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/hash.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include/includeCheck.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/include: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/autoconf/geninclude.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/autoconf/nopage1.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/autoconf/skas1.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/autoconf/epoll.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/autoconf/setnice.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/autoconf: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/Makefile.normal: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/Makefile.kernel: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/README: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only/Makefile: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
tar: vmmon-only: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
Building the vmmon module.
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmmon-only'
make: Warning: File `Makefile.kernel' has modification time 1.8e+08 s in the future
make -C /lib/modules/2.6.18-194.el5/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-194.el5-i686'
make[1]: Warning: File `/usr/src/kernels/2.6.18-194.el5-i686/arch/i386/Makefile.cpu' has modification time 2e+08 s in the future
make[2]: Warning: File `scripts/Makefile.lib' has modification time 8.6e+07 s in the future
CC [M] /tmp/vmware-config0/vmmon-only/linux/driver.o
CC [M] /tmp/vmware-config0/vmmon-only/linux/hostif.o
CC [M] /tmp/vmware-config0/vmmon-only/common/cpuid.o
CC [M] /tmp/vmware-config0/vmmon-only/common/hash.o
CC [M] /tmp/vmware-config0/vmmon-only/common/memtrack.o
CC [M] /tmp/vmware-config0/vmmon-only/common/phystrack.o
CC [M] /tmp/vmware-config0/vmmon-only/common/task.o
CC [M] /tmp/vmware-config0/vmmon-only/common/vmx86.o
CC [M] /tmp/vmware-config0/vmmon-only/vmcore/moduleloop.o
LD [M] /tmp/vmware-config0/vmmon-only/vmmon.o
make[2]: warning: Clock skew detected. Your build may be incomplete.
Building modules, stage 2.
make[2]: Warning: File `scripts/Makefile.lib' has modification time 8.6e+07 s in the future
MODPOST
CC /tmp/vmware-config0/vmmon-only/vmmon.mod.o
LD [M] /tmp/vmware-config0/vmmon-only/vmmon.ko
make[2]: warning: Clock skew detected. Your build may be incomplete.
make[1]: warning: Clock skew detected. Your build may be incomplete.
make[1]: Leaving directory `/usr/src/kernels/2.6.18-194.el5-i686'
cp -f vmmon.ko ./../vmmon.o
make: warning: Clock skew detected. Your build may be incomplete.
make: Leaving directory `/tmp/vmware-config0/vmmon-only'
The module loads perfectly in the running kernel.
配置网络,这里强烈建议选择一个桥接,一个HOST Only,这是做嵌入式开发必须的配置双网卡配置.
Do you want networking for your virtual machines? (yes/no/help) [yes]
Configuring a bridged network for vmnet0.
Your computer has multiple ethernet network interfaces available: eth0, eth1.
Which one do you want to bridge to vmnet0? [eth0] eth0
The following bridged networks have been defined:
. vmnet0 is bridged to eth0
Do you wish to configure another bridged network? (yes/no) [no]
Do you want to be able to use NAT networking in your virtual machines? (yes/no)
[yes] no
Do you want to be able to use host-only networking in your virtual machines?
[no] yes
Configuring a host-only network for vmnet1.
Do you want this program to probe for an unused private subnet? (yes/no/help)
[yes]
Probing for an unused private subnet (this can take some time)...
接下来编译的是VMNet.ko模块
AUsing 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmnet-only'
make: Warning: File `Makefile.kernel' has modification time 1.8e+08 s in the future
make -C /lib/modules/2.6.18-194.el5/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-194.el5-i686'
make[1]: Warning: File `/usr/src/kernels/2.6.18-194.el5-i686/arch/i386/Makefile.cpu' has modification time 2e+08 s in the future
make[2]: Warning: File `scripts/Makefile.lib' has modification time 8.6e+07 s in the future
CC [M] /tmp/vmware-config0/vmnet-only/driver.o
CC [M] /tmp/vmware-config0/vmnet-only/hub.o
CC [M] /tmp/vmware-config0/vmnet-only/userif.o
CC [M] /tmp/vmware-config0/vmnet-only/netif.o
CC [M] /tmp/vmware-config0/vmnet-only/bridge.o
CC [M] /tmp/vmware-config0/vmnet-only/procfs.o
CC [M] /tmp/vmware-config0/vmnet-only/smac_compat.o
SHIPPED /tmp/vmware-config0/vmnet-only/smac_linux.x386.o
LD [M] /tmp/vmware-config0/vmnet-only/vmnet.o
make[2]: warning: Clock skew detected. Your build may be incomplete.
Building modules, stage 2.
make[2]: Warning: File `scripts/Makefile.lib' has modification time 8.6e+07 s in the future
MODPOST
WARNING: could not find /tmp/vmware-config0/vmnet-only/.smac_linux.x386.o.cmd for /tmp/vmware-config0/vmnet-only/smac_linux.x386.o
CC /tmp/vmware-config0/vmnet-only/vmnet.mod.o
LD [M] /tmp/vmware-config0/vmnet-only/vmnet.ko
make[2]: warning: Clock skew detected. Your build may be incomplete.
make[1]: warning: Clock skew detected. Your build may be incomplete.
make[1]: Leaving directory `/usr/src/kernels/2.6.18-194.el5-i686'
cp -f vmnet.ko ./../vmnet.o
make: warning: Clock skew detected. Your build may be incomplete.
make: Leaving directory `/tmp/vmware-config0/vmnet-only'
The module loads perfectly in the running kernel.
最后的过程
Hit enter to continue.
Generating SSL Server Certificate
In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines]
In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines]
The path "/var/lib/vmware/Virtual Machines" does not exist currently. This
program is going to create it, including needed parent directories. Is this
what you want? [yes]
Please enter your 20-character serial number.
Type XXXXX-XXXXX-XXXXX-XXXXX or 'Enter' to cancel: 90N0W-YF48G-2007J-48KAR
Starting VMware services:
Virtual machine monitor [ OK ]
Virtual ethernet [ OK ]
Bridged networking on /dev/vmnet0 [ OK ]
Host-only networking on /dev/vmnet1 (background) [ OK ]
The configuration of VMware Server 1.0.10 build-203137 for Linux for this
running kernel completed successfully.
二.配置安装虚拟机
完成配置后在图形界面,菜单里会多了一项VMWare Server Console启动,运行开始虚拟机,首先要创建一个虚拟机,按图形的提示进行配置就好,很简单。
三.关于缺省的bridge网卡的修改
在虚拟机运行后,用ifconfig 查看会看到
vmnet0 ,vmnet1 这个网络节点.这就几个虚拟网卡描述
缺省网桥是绑定的第一个以太网卡了,但是很多时候需要将其重新切换到无线网卡,或者其它网卡,比如USB网卡的网卡. 但是很奇怪,LINUX版的VMWare没有提供Windows版中的虚拟网络切换.
经过检索实验发现,可以通过修改配置文件.VMWare的配置文件是在
/etc/vmware/locations
在这个文件里有很多句
answer VNET_0_INTERFACE eth0
remove_answer VNET_0_INTERFACE
answer VNET_0_INTERFACE eth0
remove_file /dev/vmnet0
将eth0全部置换成你需要绑定的网卡名字,如wlan0,usb0等.(注意这个文章里有很多重复,要全部修改!)
修改完毕后,重启VMWare
/etc/init.d/vmware restart
或
service vmware restart