兩邊的前次修訂版 前次修改
下次修改 | 前次修改
|
tech:vmware_tips [2009/07/30 01:47] – jonathan | tech:vmware_tips [2010/05/12 02:12] (目前版本) – jonathan |
---|
| ====== VMWare Server 使用技巧 ====== |
| ===== - 無 X-Win 的 linux 安裝 vmware-tools 後, 使用命令列設定方式 ===== |
| * 使用命令 : /usr/sbin/vmware-guestd |
| * 參數語法 : <daemon> --cmd "vmx.set_option synctime <old_val> <new_val>" |
| * Exp : 設定 vm 的時間與 host 同步 <code sh> |
| vmware-guestd --cmd "vmx.set_option synctime 0 1" |
| </code> |
| * 當設定完成後, 到 host 內看 vm 定義檔 *.vmx 可以發現多出一行: <code> |
| tools.syncTime = "TRUE" |
| </code> |
| * 參考線上手冊 : Using the VMware Tools Command-Line Interface |
| |
| ===== - VMWare-Server 2.0 背景啟動與關閉 VM 方式 ===== |
| * 使用命令 : /usr/bin/vmrun |
| * 參數語法 : -T server -h 'https://localhost:8333/sdk' -u root -p 'secret' <cmd> |
| * Exp :<code sh> |
| vmrun -T server -h 'https://localhost:8333/sdk' -u root -p 'secret' list |
| vmrun -T server -h 'https://localhost:8333/sdk' -u root -p 'secret' start "[] /vmfs/server_centos5/CentOS5.vmx" |
| vmrun -T server -h 'https://localhost:8333/sdk' -u root -p 'secret' stop "[] /vmfs/server_centos5/CentOS5.vmx" |
| </code> |
| ===== - 在 CentOS 上 mount VMWare 的 vmdk 方式 ===== |
| * 使用命令 : /usr/bin/vmware-mount |
| * 參數語法 : vmware-mount [pathfile.vmdk] 1 [mount_point] |
| * Exp : <code sh> |
| vmware-mount -p maildata.vmdk 1 /tmp/t |
| </code> |
| <note> |
| 執行如果出現以下的錯誤訊息<code> |
| vmware-mount: error while loading shared libraries: libfuse.so.2: cannot open shared object file: No such file or directory |
| </code> |
| 表示需要額外安裝 FUSE, 安裝程序如下:<code sh> |
| wget http://superb-west.dl.sourceforge.net/sourceforge/fuse/fuse-2.6.5.tar.gz |
| tar -zxvf fuse-2.6.5.tar.gz |
| cd fuse-2.6.5 |
| ./configure |
| make |
| make install |
| vi /etc/ld.so.conf.d/fuse.conf |
| ---- |
| /usr/local/lib |
| ---- |
| ldconfig |
| </code> |
| </note> |
| |
| ===== - VMWare-Server 2.0 修改參數檔去設定自動啟動順序或關閉自動啟動 VM 方式 ===== |
| * 參數檔案 : |
| - /etc/vmware/hostd/vmInventory.xml |
| - /etc/vmware/hostd/vmAutoStart.xml |
| * 修改方式 : |
| - 先透過 vmInventory.xml 瞭解目前各個 vm 的 objID Exp.<file> |
| <ConfigRoot> |
| <ConfigEntry id="0000"> |
| <objID>16</objID> |
| <vmxCfgPath>/vmfs/WebSrv/WebSrv.vmx</vmxCfgPath> |
| </ConfigEntry> |
| <ConfigEntry id="0001"> |
| <objID>32</objID> |
| <vmxCfgPath>/vmfs/firewall/WebSrv.vmx</vmxCfgPath> |
| </ConfigEntry> |
| </file> |
| - 再來修改 vmAutoStart.xml 來調整順序或是移除不想自動啟動的 vm 設定 Exp.<file> |
| <ConfigRoot> |
| <ConfigEntry id="0000"> |
| <objID>16</objID> |
| <vmxCfgPath>/vmfs/WebSrv/WebSrv.vmx</vmxCfgPath> |
| </ConfigEntry> |
| <ConfigEntry id="0001"> |
| <objID>32</objID> |
| <vmxCfgPath>/vmfs/firewall/WebSrv.vmx</vmxCfgPath> |
| </ConfigEntry> |
| </ConfigRoot>[root@ag320-mail hostd]# cat vmAutoStart.xml |
| <ConfigRoot> |
| <AutoStartOrder> |
| <_length>2</_length> |
| <_type>vim.host.AutoStartManager.AutoPowerInfo[]</_type> |
| <e id="0"> |
| <_type>vim.host.AutoStartManager.AutoPowerInfo</_type> |
| <key> |
| <_type>vim.VirtualMachine</_type> |
| <moid>32</moid> |
| </key> |
| <startAction>PowerOn</startAction> |
| <startDelay>-1</startDelay> |
| <startOrder>1</startOrder> |
| <stopAction>SystemDefault</stopAction> |
| <stopDelay>-1</stopDelay> |
| <waitForHeartbeat>systemDefault</waitForHeartbeat> |
| </e> |
| <e id="1"> |
| <_type>vim.host.AutoStartManager.AutoPowerInfo</_type> |
| <key> |
| <_type>vim.VirtualMachine</_type> |
| <moid>16</moid> |
| </key> |
| <startAction>PowerOn</startAction> |
| <startDelay>-1</startDelay> |
| <startOrder>-1</startOrder> |
| <stopAction>SystemDefault</stopAction> |
| <stopDelay>-1</stopDelay> |
| <waitForHeartbeat>systemDefault</waitForHeartbeat> |
| </e> |
| </AutoStartOrder> |
| <SystemDefaults> |
| <_type>vim.host.AutoStartManager.SystemDefaults</_type> |
| <enabled>true</enabled> |
| <startDelay>120</startDelay> |
| <stopAction>PowerOff</stopAction> |
| <stopDelay>120</stopDelay> |
| <waitForHeartbeat>false</waitForHeartbeat> |
| </SystemDefaults> |
| </file> |
| * 關閉 objID:16 (/vmfs/WebSrv/WebSrv.vmx) 不要自動啟動 \\ **主要是 startAction 由 PowerOn -> None**<file> |
| : |
| <e id="1"> |
| <_type>vim.host.AutoStartManager.AutoPowerInfo</_type> |
| <key> |
| <_type>vim.VirtualMachine</_type> |
| <moid>16</moid> |
| </key> |
| <startAction>None</startAction> |
| <startDelay>-1</startDelay> |
| <startOrder>-1</startOrder> |
| <stopAction>SystemDefault</stopAction> |
| <stopDelay>-1</stopDelay> |
| <waitForHeartbeat>systemDefault</waitForHeartbeat> |
| </e> |
| : |
| </file> |
| {{tag>vmware draft}} |
| |