centos6.8下安装VMWare12深入详解

1、题记

由于硬件服务器资源紧张,正常公司里面会有专门的服务器安装VMSphere,然后大家在上面装自己的windows/Linux虚拟机环境进行开发或测试。但是,现在我手头只有1台物理服务器,单纯的用作ES环境的开发,内存资源没有得到充分利用。
而当前正需要几台Windows7-64bit环境,所以,在Centos物理服务器上安装VMWare,然后再搭建Win764bit虚拟机成为当务之急。
之前一直没有在Linux环境下安装过VMware,第一次安装,发现很多坑。当然Google也发现好多解决方案,但都不全。索性,我将此详细整理下,以备后用。

2、准备知识

思考问题:

问题1、单纯的命令行界面能完成VMWare12的安装吗?

答案:不可以。

问题2、如何不直接到机房连接后台,也能进入图形化界面配置、操作?

答案:方法有很多,可以Google下。本文推荐使用:VNC-Viewer作为Centos图形化显示、操作工具。
Centos服务端安装:
下载地址:https://www.realvnc.com/download/vnc/linux/
安装命令:

rpm -ivh VNC-Server-5.2.1-Linux-x64.rpm –nodeps –force 
[root@laoyang vmware12]# vnclicense -add WHJRK-UXY7V-Q34M9-CZU8L-8KGFA 
License key has been successfully applied.

[root@laoyang vmware12]# vncserver
VNC(R) Server 5.3.2 (r19179) x64 (Jun 6 2016 19:59:17)
Copyright (C) 2002-2016 RealVNC Ltd.
RealVNC and VNC are trademarks of RealVNC Ltd and are protected by trademark
registrations and/or pending trademark applications in the European Union,
United States of America and other jurisdictions.
Protected by UK patent 2481870; US patent 8760366.
See http://www.realvnc.com for information on VNC.
For third party acknowledgements see:
http://www.realvnc.com/products/vnc/documentation/5.3/acknowledgements.txt

xauth: file /root/.Xauthority does not exist
If a desktop environment fails to load for this virtual desktop, please see:
 http://www.realvnc.com/doclink/kb-345?version=5.3.2.19179
Running applications in /etc/vnc/xstartup

VNC Server catchphrase: "Lunar pasta season. Kyoto wolf crown."
  signature: f2-51-a2-f1-1a-98-04-1e

Log file is /root/.vnc/laoyang:1.log
New desktop is laoyang:1 (10.0.1.30:1)

好用的Lincense key: WHJRK-UXY7V-Q34M9-CZU8L-8KGFA。
客户端PC安装: VNC-Viewer-5.3.2-Windows-64bit.exe

客户端访问截图:

centos6.8下安装VMWare12深入详解

3、安装步骤

第一步:下载安装包
安装包地址:https://my.vmware.com/web/vmware/info?slug=desktop_end_user_computing/vmware_workstation_pro/12_0

VMWare官网需要注册。
将安装包拷贝到Centos的自定义路径下,如我的路径:/home/yang/vmware12

第二步:通过 VNC-Viewer-5.3.2-Windows-64bit,连接到Centos。

第三步:执行VMware-Workstation-Full-12.1.1-3770994.x86_64.bundle
图像化展示效果可参考:http://www.tecmint.com/install-vmware-workstation-in-linux/

第四步:运行VMWare指令。

[root@laoyang vmware12]# vmware 
DISPLAY is not set, unable to open the VMware Workstation user interface. 

注意,单纯的在命令行SSH后台,会有上面的错误,而通过VNC-Viewer则不会。

执行成功标志,进入如Windows下安装VMWare一样的界面,如下图:

centos6.8下安装VMWare12深入详解

第五步:添加*.ISO如:win7-64.ISO进行安装即可,不再赘述。

4、常见错误及解决方案:

错误1:DISPLAY is not set, unable to open the VMware Workstation user interface.
解决方案:通过命令行则会出现,改正VNC-Viewer客户端连接centos访问执行即可。

错误2:Kernel header for ** version was not found.
解决方案:我最终发现根本原因,界面显示的内核版本是系统版本,但是系统内核升级了没有重启,reboot -f强制重启后该问题便不存在。

错误3: Failed to build vmnet. Failed to execute the build command.

解决方案:

第1步:为缺少的头文件建立软链接。

ln -s /lib/modules/2.6.32-642.el6.centos.plus.x86_64/build/include/linux /lib/modules/2.6.32-642.el6.centos.plus.x86_64/build/include/generated

第2步:对 /usr/lib/vmware/modules/source/vmnet.tar执行解包。

第3步:注释提取文件 netif.c的第152,153,154和第156行,如下:

//#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(NET_NAME_USER)
// dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_USER, VNetNetIfSetup);
//#else
dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup);
//#endif

第4步:保存修改文件 netif.c。

第5步:重新打包上述所有文件。
tar -cvf ./vmnet.tar ./vmonly/*

第6步:启动VMWare或者VMWare-Player进行验证。

5、VMWare卸载方法:

vmware-installer -u vmware-workstation

小结

我了解、我知道到我实践,再到我最快实践,中间有不小的跨度。我那个内核升级排查了大于3个小时,最终重启解决。


作者:铭毅天下
转载请标明出处,原文地址:
http://blog.csdn.net/laoyang360/article/details/52373656

上一篇:从求生存到修体系,我在阿里找到了技术人的成长模式


下一篇:精选26个Python实用技巧,想秀技能先Get这份技术列表!