Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1675732
  • 博文数量: 311
  • 博客积分: 7778
  • 博客等级: 少将
  • 技术积分: 4186
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-09 19:59
个人简介

蓝点工坊(http://www.bluedrum.cn) 创始人,App和嵌入式产品开发。同时也做相应培训和外包工作。 详细介绍 http://pan.baidu.com/s/1y2g88

文章存档

2012年(3)

2011年(115)

2010年(170)

2009年(23)

分类: 虚拟化

2011-10-27 16:23:20

 Andrew Huang 引用自(http://bluedrum.cublog.cn) 转载注明出处及联络方式

  一般虚拟机的常见场景是在WINDOWS下安装Linux虚拟机,但是有一些情况需要倒过来,比如在Linux下安装VMware虚拟机来反过来安装WINDOWS.

  一.RHEL版本的VMWare的安装

    可以从官网下载安装程序,VMWare Server是免费的,你可以从看到相关说明
    

    我使用提 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 进行配置.

  1. [root@hxy tools]# vmware
  2. vmware is installed, but it has not been (correctly) configured
  3. for this system. To (re-)configure it, invoke the following command:
  4. /usr/bin/vmware-config.pl.
      
   配置过程,主要都采用缺省值
     
  1. [root@hxy tools]# /usr/bin/vmware-config.pl
  2. Making sure services for VMware Server are stopped.
  3. Stopping VMware services:
  4. Virtual machine monitor [ OK ]
  5. You must read and accept the End User License Agreement to continue.
  6. Press enter to display it.
  7. Do you accept? (yes/no) yes
  8. Thank you.
  9. Configuring fallback GTK+ 2.4 libraries.
  10. In which directory do you want to install the mime type icons?
  11. [/usr/share/icons]
  12. What directory contains your desktop menu entry files? These files have a
  13. .desktop file extension. [/usr/share/applications]
  14. In which directory do you want to install the application's icon?
  15. [/usr/share/pixmaps]
   
接下来编译了VMMon模块
  1. Trying to find a suitable vmmon module for your running kernel.
  2. None of the pre-built vmmon modules for VMware Server is suitable for your
  3. running kernel. Do you want this program to try to build the vmmon module for
  4. your system (you need to have a C compiler installed on your system)? [yes]
  5. Trying to find a suitable vmmon module for your running kernel.
  6. None of the pre-built vmmon modules for VMware Server is suitable for your
  7. running kernel. Do you want this program to try to build the vmmon module for
  8. your system (you need to have a C compiler installed on your system)? [yes] yes
  9. Using compiler "/usr/bin/gcc". Use environment variable CC to override.
  10. What is the location of the directory of C header files that match your running
  11. kernel? [/lib/modules/2.6.18-194.el5/build/include]
  12. Extracting the sources of the vmmon module.
  13. tar: vmmon-only/linux/driver.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  14. tar: vmmon-only/linux/driver.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  15. tar: vmmon-only/linux/hostif.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  16. tar: vmmon-only/linux/vmmonInt.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  17. tar: vmmon-only/linux/vmhost.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  18. tar: vmmon-only/linux: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  19. tar: vmmon-only/common/memtrack.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  20. tar: vmmon-only/common/memtrack.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  21. tar: vmmon-only/common/task.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  22. tar: vmmon-only/common/task.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  23. tar: vmmon-only/common/vmx86.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  24. tar: vmmon-only/common/vmx86.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  25. tar: vmmon-only/common/hostif.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  26. tar: vmmon-only/common/hostKernel.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  27. tar: vmmon-only/common/phystrack.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  28. tar: vmmon-only/common/phystrack.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  29. tar: vmmon-only/common/cpuid.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  30. tar: vmmon-only/common/cpuid.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  31. tar: vmmon-only/common/hash.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  32. tar: vmmon-only/common: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  33. tar: vmmon-only/vmcore/driver_vmcore.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  34. tar: vmmon-only/vmcore/moduleloop.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  35. tar: vmmon-only/vmcore: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  36. tar: vmmon-only/include/initblock.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  37. tar: vmmon-only/include/machine.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  38. tar: vmmon-only/include/modulecall.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  39. tar: vmmon-only/include/vm_asm.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  40. tar: vmmon-only/include/vm_asm_x86.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  41. tar: vmmon-only/include/vm_asm_x86_64.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  42. tar: vmmon-only/include/vm_time.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  43. tar: vmmon-only/include/vcpuset.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  44. tar: vmmon-only/include/x86.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  45. tar: vmmon-only/include/x86types.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  46. tar: vmmon-only/include/x86desc.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  47. tar: vmmon-only/include/x86apic.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  48. tar: vmmon-only/include/x86vt.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  49. tar: vmmon-only/include/vmm_constants.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  50. tar: vmmon-only/include/contextinfo.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  51. tar: vmmon-only/include/uccostTable.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  52. tar: vmmon-only/include/x86cpuid.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  53. tar: vmmon-only/include/speaker_reg.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  54. tar: vmmon-only/include/vmware.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  55. tar: vmmon-only/include/vm_assert.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  56. tar: vmmon-only/include/vm_atomic.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  57. tar: vmmon-only/include/vm_basic_asm.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  58. tar: vmmon-only/include/vm_basic_asm_x86.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  59. tar: vmmon-only/include/vm_basic_asm_x86_64.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  60. tar: vmmon-only/include/vm_basic_defs.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  61. tar: vmmon-only/include/vm_basic_types.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  62. tar: vmmon-only/include/vcpuid.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  63. tar: vmmon-only/include/iocontrols.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  64. tar: vmmon-only/include/pshare_ext.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  65. tar: vmmon-only/include/cpuid_info.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  66. tar: vmmon-only/include/vmware_pack_init.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  67. tar: vmmon-only/include/vmware_pack_begin.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  68. tar: vmmon-only/include/vmware_pack_end.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  69. tar: vmmon-only/include/driver-config.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  70. tar: vmmon-only/include/compat_highmem.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  71. tar: vmmon-only/include/compat_pgtable.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  72. tar: vmmon-only/include/compat_spinlock.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  73. tar: vmmon-only/include/compat_uaccess.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  74. tar: vmmon-only/include/compat_mm.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  75. tar: vmmon-only/include/compat_file.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  76. tar: vmmon-only/include/compat_wait.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  77. tar: vmmon-only/include/compat_page.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  78. tar: vmmon-only/include/compat_version.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  79. tar: vmmon-only/include/compat_timer.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  80. tar: vmmon-only/include/compat_semaphore.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  81. tar: vmmon-only/include/compat_sched.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  82. tar: vmmon-only/include/compat_kernel.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  83. tar: vmmon-only/include/compat_completion.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  84. tar: vmmon-only/include/pgtbl.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  85. tar: vmmon-only/include/hash.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  86. tar: vmmon-only/include/includeCheck.h: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  87. tar: vmmon-only/include: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  88. tar: vmmon-only/autoconf/geninclude.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  89. tar: vmmon-only/autoconf/nopage1.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  90. tar: vmmon-only/autoconf/skas1.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  91. tar: vmmon-only/autoconf/epoll.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  92. tar: vmmon-only/autoconf/setnice.c: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  93. tar: vmmon-only/autoconf: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  94. tar: vmmon-only/Makefile.normal: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  95. tar: vmmon-only/Makefile.kernel: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  96. tar: vmmon-only/README: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  97. tar: vmmon-only/Makefile: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  98. tar: vmmon-only: time stamp 2009-10-21 05:06:44 is 183125436 s in the future
  99. Building the vmmon module.
  100. Using 2.6.x kernel build system.
  101. make: Entering directory `/tmp/vmware-config0/vmmon-only'
  102. make: Warning: File `Makefile.kernel' has modification time 1.8e+08 s in the future
  103. make -C /lib/modules/2.6.18-194.el5/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
  104. make[1]: Entering directory `/usr/src/kernels/2.6.18-194.el5-i686'
  105. 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
  106. make[2]: Warning: File `scripts/Makefile.lib' has modification time 8.6e+07 s in the future
  107. CC [M] /tmp/vmware-config0/vmmon-only/linux/driver.o
  108. CC [M] /tmp/vmware-config0/vmmon-only/linux/hostif.o
  109. CC [M] /tmp/vmware-config0/vmmon-only/common/cpuid.o
  110. CC [M] /tmp/vmware-config0/vmmon-only/common/hash.o
  111. CC [M] /tmp/vmware-config0/vmmon-only/common/memtrack.o
  112. CC [M] /tmp/vmware-config0/vmmon-only/common/phystrack.o
  113. CC [M] /tmp/vmware-config0/vmmon-only/common/task.o
  114. CC [M] /tmp/vmware-config0/vmmon-only/common/vmx86.o
  115. CC [M] /tmp/vmware-config0/vmmon-only/vmcore/moduleloop.o
  116. LD [M] /tmp/vmware-config0/vmmon-only/vmmon.o
  117. make[2]: warning: Clock skew detected. Your build may be incomplete.
  118. Building modules, stage 2.
  119. make[2]: Warning: File `scripts/Makefile.lib' has modification time 8.6e+07 s in the future
  120. MODPOST
  121. CC /tmp/vmware-config0/vmmon-only/vmmon.mod.o
  122. LD [M] /tmp/vmware-config0/vmmon-only/vmmon.ko
  123. make[2]: warning: Clock skew detected. Your build may be incomplete.
  124. make[1]: warning: Clock skew detected. Your build may be incomplete.
  125. make[1]: Leaving directory `/usr/src/kernels/2.6.18-194.el5-i686'
  126. cp -f vmmon.ko ./../vmmon.o
  127. make: warning: Clock skew detected. Your build may be incomplete.
  128. make: Leaving directory `/tmp/vmware-config0/vmmon-only'
  129. The module loads perfectly in the running kernel.

 配置网络,这里强烈建议选择一个桥接,一个HOST Only,这是做嵌入式开发必须的配置双网卡配置.

  1. Do you want networking for your virtual machines? (yes/no/help) [yes]
  2. Configuring a bridged network for vmnet0.
  3. Your computer has multiple ethernet network interfaces available: eth0, eth1.
  4. Which one do you want to bridge to vmnet0? [eth0] eth0
  5. The following bridged networks have been defined:
  6. . vmnet0 is bridged to eth0
  7. Do you wish to configure another bridged network? (yes/no) [no]
  8. Do you want to be able to use NAT networking in your virtual machines? (yes/no)
  9. [yes] no
  10. Do you want to be able to use host-only networking in your virtual machines?
  11. [no] yes
  12. Configuring a host-only network for vmnet1.
  13. Do you want this program to probe for an unused private subnet? (yes/no/help)
  14. [yes]
  15. Probing for an unused private subnet (this can take some time)...

接下来编译的是VMNet.ko模块

  1. AUsing 2.6.x kernel build system.
  2. make: Entering directory `/tmp/vmware-config0/vmnet-only'
  3. make: Warning: File `Makefile.kernel' has modification time 1.8e+08 s in the future
  4. make -C /lib/modules/2.6.18-194.el5/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
  5. make[1]: Entering directory `/usr/src/kernels/2.6.18-194.el5-i686'
  6. 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
  7. make[2]: Warning: File `scripts/Makefile.lib' has modification time 8.6e+07 s in the future
  8. CC [M] /tmp/vmware-config0/vmnet-only/driver.o
  9. CC [M] /tmp/vmware-config0/vmnet-only/hub.o
  10. CC [M] /tmp/vmware-config0/vmnet-only/userif.o
  11. CC [M] /tmp/vmware-config0/vmnet-only/netif.o
  12. CC [M] /tmp/vmware-config0/vmnet-only/bridge.o
  13. CC [M] /tmp/vmware-config0/vmnet-only/procfs.o
  14. CC [M] /tmp/vmware-config0/vmnet-only/smac_compat.o
  15. SHIPPED /tmp/vmware-config0/vmnet-only/smac_linux.x386.o
  16. LD [M] /tmp/vmware-config0/vmnet-only/vmnet.o
  17. make[2]: warning: Clock skew detected. Your build may be incomplete.
  18. Building modules, stage 2.
  19. make[2]: Warning: File `scripts/Makefile.lib' has modification time 8.6e+07 s in the future
  20. MODPOST
  21. WARNING: could not find /tmp/vmware-config0/vmnet-only/.smac_linux.x386.o.cmd for /tmp/vmware-config0/vmnet-only/smac_linux.x386.o
  22. CC /tmp/vmware-config0/vmnet-only/vmnet.mod.o
  23. LD [M] /tmp/vmware-config0/vmnet-only/vmnet.ko
  24. make[2]: warning: Clock skew detected. Your build may be incomplete.
  25. make[1]: warning: Clock skew detected. Your build may be incomplete.
  26. make[1]: Leaving directory `/usr/src/kernels/2.6.18-194.el5-i686'
  27. cp -f vmnet.ko ./../vmnet.o
  28. make: warning: Clock skew detected. Your build may be incomplete.
  29. make: Leaving directory `/tmp/vmware-config0/vmnet-only'
  30. The module loads perfectly in the running kernel.

最后的过程
  
  1. Hit enter to continue.
  2. Generating SSL Server Certificate
  3. In which directory do you want to keep your virtual machine files?
  4. [/var/lib/vmware/Virtual Machines]
  5. In which directory do you want to keep your virtual machine files?
  6. [/var/lib/vmware/Virtual Machines]
  7. The path "/var/lib/vmware/Virtual Machines" does not exist currently. This
  8. program is going to create it, including needed parent directories. Is this
  9. what you want? [yes]
  10. Please enter your 20-character serial number.
  11. Type XXXXX-XXXXX-XXXXX-XXXXX or 'Enter' to cancel: 90N0W-YF48G-2007J-48KAR
  12. Starting VMware services:
  13. Virtual machine monitor [ OK ]
  14. Virtual ethernet [ OK ]
  15. Bridged networking on /dev/vmnet0 [ OK ]
  16. Host-only networking on /dev/vmnet1 (background) [ OK ]
  17. The configuration of VMware Server 1.0.10 build-203137 for Linux for this
  18. running kernel completed successfully.
 
   

二.配置安装虚拟机
   
 完成配置后在图形界面,菜单里会多了一项VMWare Server Console启动,运行开始虚拟机,首先要创建一个虚拟机,
   
    
选择创建一个虚拟机


这里因为是安装WINDOWS.选择对应类型


第一个网卡选择桥接模式


在创建好后,马上加入一个HostOnly 网卡



这里选择一个GHost版安装,接下就是WINDOWS安装了.

安装GHOST版要注意,要先运行7将C盘格式化,再执行功能(1),否则在安装计会提示"无法打开GHOST A:\GHOSTERR.TXT 434"

三.关于缺省的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

   
阅读(4077) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~