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
客戶端訪問截圖:
3、安裝步驟
第一步:下載安裝包
VMWare官網需要註冊。
將安裝包拷貝到Centos的自定義路徑下,如我的路徑:/home/yang/vmware12
第二步:通過 VNC-Viewer-5.3.2-Windows-64bit,連線到Centos。
第三步:執行VMware-Workstation-Full-12.1.1-3770994.x86_64.bundle
第四步:執行VMWare指令。
[root@laoyang vmware12]# vmware
DISPLAY is not set, unable to open the VMware Workstation user interface.
注意,單純的在命令列SSH後臺,會有上面的錯誤,而通過VNC-Viewer則不會。
執行成功標誌,進入如Windows下安裝VMWare一樣的介面,如下圖:
第五步:新增*.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個小時,最終重啟解決。
2016年8月30日 22:20 思於家中床前