宜蘭縣教育支援平台 會員登入 會員註冊 我的i教書

« 上一篇 | 下一篇 »

如果要備份或回復 VMware ESXi 的設定,可以安裝 VMware vSphere Command Line Interface。
1. 登入 VMware 官方網站下載 VMware vSphere Command Line Interface
     1 - For Windows
     2 - For Linux x86_64
     3 - For Linux x86


參考網頁:
vmware-vsphere-cli-centos7.sh · GitHub
The Pain and Fury of vmware-cli on CentOS 7 | Morgajel.net
Install vCLI 6 on CentOS 7 - vSphere SDK for Perl
[VMware] 在 CentOS7 上安裝 VMware vSphere CLI (vcli) 操作 VM @ 亂打一通的心情日記 :: 痞客邦 PIXNET ::
在 CentOS7 上安裝 VMware vSphere CLI (vcli) - IT閱讀

2. 安裝必備套件
# yum install epel-release
# yum update
# yum install openssl-devel cpan perl-Devel-StackTrace perl-Class-Data-Inheritable perl-Convert-ASN1 perl-Crypt-OpenSSL-RSA perl-Exception-Class perl-Archive-Zip perl-Try-Tiny perl-Crypt-SSLeay perl-XML-SAX perl-XML-NamespaceSupport perl-libxml-perl perl-XML-LibXML perl-Socket6 perl-IO-Socket-INET6 libuuid-devel perl-Crypt-OpenSSL-X509 perl-Path-Class perl-Class-MethodMaker perl-Data-UUID perl-Data-Dump perl-SOAP-Lite perl-Net-INET6Glue

# PERL_MM_USE_DEFAULT=1 cpan install BINGOS/ExtUtils-MakeMaker-6.96.tar.gz LEONT/Module-Build-0.4205.tar.gz GBARR/libnet-1.22.tar.gz GAAS/libwww-perl-5.837.tar.gz PERLER/UUID-Random-0.04.tar.gz

3. 解壓縮
# tar xvzf VMware-vSphere-CLI-6.5.0-4566394.x86_64.tar.gz

4. 切換目錄
# cd vmware-vsphere-cli-distrib

5. 進行安裝
# ./vmware-install.pl --prefix=/opt/vmwarecli EULA_AGREED=yes --default
Creating a new vSphere CLI installer database using the tar4 format.

Installing vSphere CLI 6.5.0 build-4566394 for Linux.

This vSphere CLI installer includes precompiled Perl modules for RHEL.
Answering yes will install the precompiled modules, and answering no will
install from CPAN.
Do you want to install precompiled Perl modules for RHEL?
[yes]

Please wait while copying vSphere CLI files...

The installation of vSphere CLI 6.5.0 build-4566394 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command:
"/opt/vmwarecli/bin/vmware-uninstall-vSphere-CLI.pl".

This installer has successfully installed both vSphere CLI and the vSphere SDK
for Perl.

The following Perl modules were found on the system but may be too old to work
with vSphere CLI:

Devel::StackTrace 1.31 or newer
MIME::Base64 3.14 or newer
Try::Tiny 0.22 or newer
LWP 6.15 or newer
Socket6  0.23 or newer
IO::Socket::INET6 2.71 or newer
Net::HTTP 6.09 or newer

Enjoy,

--the VMware team

6. 程式安裝路徑
# ls -l /opt/vmwarecli/bin/vicfg-*
-r-xr-xr-x. 1 root root  9632  3月 28 19:23 /opt/vmwarecli/bin/vicfg-advcfg
-r-xr-xr-x. 1 root root 11645  3月 28 19:23 /opt/vmwarecli/bin/vicfg-authconfig
-r-xr-xr-x. 1 root root  8920  3月 28 19:23 /opt/vmwarecli/bin/vicfg-cfgbackup
-r-xr-xr-x. 1 root root  9140  3月 28 19:23 /opt/vmwarecli/bin/vicfg-dns
-r-xr-xr-x. 1 root root 12580  3月 28 19:23 /opt/vmwarecli/bin/vicfg-dumppart
-r-xr-xr-x. 1 root root 16564  3月 28 19:23 /opt/vmwarecli/bin/vicfg-hostops
-r-xr-xr-x. 1 root root 24199  3月 28 19:23 /opt/vmwarecli/bin/vicfg-ipsec
-r-xr-xr-x. 1 root root 76696  3月 28 19:23 /opt/vmwarecli/bin/vicfg-iscsi
-r-xr-xr-x. 1 root root  6872  3月 28 19:23 /opt/vmwarecli/bin/vicfg-module
-r-xr-xr-x. 1 root root 20543  3月 28 19:23 /opt/vmwarecli/bin/vicfg-mpath
-r-xr-xr-x. 1 root root 17871  3月 28 19:23 /opt/vmwarecli/bin/vicfg-mpath35
-r-xr-xr-x. 1 root root  8314  3月 28 19:23 /opt/vmwarecli/bin/vicfg-nas
-r-xr-xr-x. 1 root root  9364  3月 28 19:23 /opt/vmwarecli/bin/vicfg-nics
-r-xr-xr-x. 1 root root  7144  3月 28 19:23 /opt/vmwarecli/bin/vicfg-ntp
-r-xr-xr-x. 1 root root  2874  3月 28 19:23 /opt/vmwarecli/bin/vicfg-rescan
-r-xr-xr-x. 1 root root 13481  3月 28 19:23 /opt/vmwarecli/bin/vicfg-route
-r-xr-xr-x. 1 root root 21745  3月 28 19:23 /opt/vmwarecli/bin/vicfg-scsidevs
-r-xr-xr-x. 1 root root 12387  3月 28 19:23 /opt/vmwarecli/bin/vicfg-snmp
-r-xr-xr-x. 1 root root  5643  3月 28 19:23 /opt/vmwarecli/bin/vicfg-syslog
-r-xr-xr-x. 1 root root 22531  3月 28 19:23 /opt/vmwarecli/bin/vicfg-user
-r-xr-xr-x. 1 root root 26398  3月 28 19:23 /opt/vmwarecli/bin/vicfg-vmknic
-r-xr-xr-x. 1 root root 13010  3月 28 19:23 /opt/vmwarecli/bin/vicfg-volume
-r-xr-xr-x. 1 root root 36078  3月 28 19:23 /opt/vmwarecli/bin/vicfg-vswitch

# ls -l /opt/vmwarecli/bin/vm*
-r-xr-xr-x. 1 root root  40411  3月 28 19:23 /opt/vmwarecli/bin/vmkfstools
-r-xr-xr-x. 1 root root  59908  3月 28 19:23 /opt/vmwarecli/bin/vmware-cmd
-r-xr-xr-x. 1 root root 128151  3月 28 19:23 /opt/vmwarecli/bin/vmware-uninstall-vSphere-CLI.pl

7. 進行備份
    --server Server'IP
    -s 備份設定
# /opt/vmwarecli/bin/vicfg-cfgbackup --server 192.168.1.234 -s /root/esx.cfg
Enter username: root
Enter password:
Saving firmware configuration to /root/esx.cfg ...

8. 還原設定值,ESXi Server 會重新啟動
# /opt/vmwarecli/bin/vicfg-cfgbackup --server 192.168.1.234 -l /root/esx.cfg
Enter username: root
Enter password:
The restore operation will reboot the host.
Type 'yes' to continue:
yes
Uploading config bundle to configBundle.tgz ...
Performing restore ...
系統重新開機


9. 指令用法
# /opt/vmwarecli/bin/vicfg-cfgbackup --help
Synopsis: /opt/vmwarecli/bin/vicfg-cfgbackup OPTIONS [<backupfile>]

Command-specific options:
   --force
    -f
        Force the restore of the configuration.
   --load
    -l
        Restore configuration onto the host
   --quiet
    -q
        Do not prompt for user confirmation.
   --reset
    -r
        Resets host, restore to factory settings.
   --save
    -s
        Backup the host configuration.

如果你的網誌不支援引用網址自動搜尋功能,那麼你可以使用下列的直接引用網址來引用本文章:

http://blog.ilc.edu.tw/blog/trackback.php?id=689793