使用工具上传补丁到datastore, 然后使用ssh登陆进行更新.
首先需要切换到维护模式, 使用vSphere点击切换维护模式, 或者使用一下命令进入维护模式.
# vim-cmd /hostsvc/maintenance_mode_enter
输入一下命令进行更新补丁, 双引号内容为绝对目录路径.
# esxcli software vib install -d "/vmfs/volumes/Datastore/DirectoryName/PatchName.zip"
Where PatchName.zip is the name of the patch file you uploaded to the datastore.
后者如果虚拟机可在线http
# esxcli software vib install -v viburl Where viburl is the URL to the http depot where VIB packages reside. For example: # esxcli software vib install -v https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/esx/vmw/vib20/tools-light/VMware_locker_tools-light_5.0.0-0.7.515841.vib
更新完毕后, 会显示一下参考结果.
Update Result Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective. Reboot Required: true
然后输入reboot重启服务器.
重启完毕, 重新进去SSH管理, 以下命令离开维护模式.
# vim-cmd hostsvc/maintenance_mode_exit
如果发现虚拟机没有启动, 可以进去vSphere管理启动, 或者使用如下命令行查看和启动所需的虚拟机.
# vim-cmd vmsvc/getallvms
会列出如下例子所有的虚拟机和编号.
~ # vim-cmd vmsvc/getallvms Vmid Name File Guest OS Version Annotation 1 FTP [datastore1] FTP/FTP.vmx windows7Server64Guest vmx-08 3 PPTP [datastore1] PPTP/PPTP.vmx otherLinuxGuest vmx-08 9 Ubuntu [datastore1] Ubuntu/Ubuntu.vmx ubuntu64Guest vmx-08
启动所需的编号为9的Ubuntu虚拟机.
~ # vim-cmd vmsvc/power.on 9
至此一般操作已经完成.
参考资料如下.