labunix's blog

labunixのラボUnix

VMware Workstation上にvSphereHipervisor無償評価版(ネストESXi)を構築

■VCP5-DCVの特典でVMware Workstationのライセンスキーが来た。
 資格もライセンスの有効期限も、2年という残念感が半端ないのですがスルーします。

 VMware Certified Professional 5 - Data Center Virtualization (VCP5-DCV)
 http://mylearn.vmware.com/mgrReg/plan.cfm?plan=12457&ui=www_cert

■vCenter Server無しのvSphere Hypervisor 無償評価版
 ライセンスキーを登録すると、有効期限のステータスが「確認しない」になる。
 これはVMware workstation上に載せるネストESXiに使う。

 VMware vSphere Hypervisor 5.5ダウンロード センター
 https://my.vmware.com/jp/web/vmware/evalcenter?p=free-esxi5

 VMware vCenter Converter Standaloneで変換も出来るけど、
 今回はスルーする。

■vmplayerでもネストESXiは可能。
 その場合はロックファイルを消す処理付きのスクリプトを書く。
 ワンライナーなら以下。

$ VMXDIR="~/sample"; \
  VMXFILE="sample.vmx"; \
  CHECK=1; \
  while [ $CHECK -eq "0" ];do
    vmrun -T player list | grep "$VMXDIR/$VMXFILE" > /dev/null 2>&1 || CHECK=0
    vmrun -T player stop "$VMXDIR/$VMXFILE" nogui
  done
  find -type d "$VMXDIR/" -name "*.lck" -exec rm -f {} \; 
  vmrun -T player start "$VMXDIR/$VMXFILE" nogui

■vSphere Clientをwineで動かすという手もあるらしいが、つまづくネタなのでスルー。
 VMware WorkstationでもvShereにアクセス出来る。そして、Linux版がある。
 Windows7で設定をしたら、その後はVMware Workstationで動かそう。

  VMware vSphere Client 5.1 
 https://appdb.winehq.org/objectManager.php?sClass=version&iId=26916

■余談。xrdp+VNC(vino)、RDPクライアントのremminaの導入、vmplayerの削除
 そもそもvmrunでGUIを出していない。そして、Workstationを導入する際は、
 vmplayerは共存出来ない。vmware-playerの設定ファイルをどうするかはお好みで。

$ sudo apt-get install -y vino xrdp
$ cd /etc/xrdp && \
  wget -O - http://w.vmeta.jp/temp/km-0411.ini | sudo tee km-0411.ini && \
  sudo ln -s km-0411.ini km-e0200411.ini && \
  sudo ln -s km-0411.ini km-e0010411.ini && \
  sudo /etc/init.d/xrdp restart

$ sudo apt-get install -y remmina

$ whereis vmware-installer
vmware-installer: /usr/bin/vmware-installer /etc/vmware-installer 
/usr/lib/vmware-installer /usr/bin/X11/vmware-installer
$ vmware-installer -l
Product Name         Product Version     
==================== ====================
vmware-player        6.0.1.1379776       
vmware-vix           1.13.1.1379776
$ sudo vmware-installer -u vmware-vix
Uninstalling VMware VIX Core for Linux 1.13.1
    Deconfiguring...
[######################################################################] 100%
Uninstallation was successful.
$ sudo vmware-installer -u vmware-player
All configuration information is about to be removed. Do you wish to
keep your configuration files? [yes]: no

Uninstalling VMware Installer 2.1.0
    Deconfiguring...
[######################################################################] 100%
Uninstallation was successful.

■さて、Workstation(64bit版)のインストールに戻る。
 コンソールからも出来るようだ。
 apache2が443を使用中であるとのメッセージのため、8443とした。
 ライセンスキーは初回起動時にも入れられる。
 また、メールアドレスとパスワードの入力で30日間の評価版として使える。

$ ls -l VMware-Workstation-Full-10.0.2-1744117.x86_64.bundle 
-rw-r--r-- 1 labunix labunix 424263068  624 21:42 VMware-Workstation-Full-10.0.2-1744117.x86_64.bundle
$ chmod +x VMware-Workstation-Full-10.0.2-1744117.x86_64.bundle 
$ ./VMware-Workstation-Full-10.0.2-1744117.x86_64.bundle --help | grep console
    --console           Use the console UI
$ sudo ./VMware-Workstation-Full-10.0.2-1744117.x86_64.bundle --console
Extracting VMware Installer...done.
You must accept the VMware Workstation End User License Agreement to
continue.  Press Enter to proceed.
...
Do you agree? [yes/no]: yes
You must accept the VMware OVF Tool component for Linux End User
License Agreement to continue.  Press Enter to proceed.
...
Do you agree? [yes/no]: yes
Would you like to check for product updates on startup? [yes]: yes

Would you like to help make VMware software better by sending
anonymous system data and usage statistics to VMware? [yes]: no

Please enter the user that will initially connect to Workstation
Server. Without setting this correctly, you will not be able to share
VMs with other users. Additional users and administrators can be
configured later in Workstation by selecting "Shared VMs" and clicking
"Permissions".  [labunix]: 
Please choose a directory for your shared virtual machines.
[/var/lib/vmware/Shared VMs]: 

Please enter the port to use for https access to Workstation Server.
(HTTPS port:) [443]: 

The VMware Installer has detected that port 443 is in use by apache2. The instal
ling product will not run properly if its port is in use.
Please enter the port to use for https access to Workstation Server.
(HTTPS port:) [443]: 8443

Enter license key. (optional) You can enter this information later.: 
The product is ready to be installed.  Press Enter to begin
installation or Ctrl-C to cancel.    
...
Installation was successful.

■ネストESXiのインストール
 [Create new Virtual machine]では無い点に注意。
 ゲストOSの作成。NAT構成ネットワークを指定。後は普通のESXi。
 HW構成はお好みで。ウイザードはファンクションキーを使った簡単なCUIウイザード。

[VMware Workstation] -> [File] -> [New Virtual machine] -> [Custom(Advanced)] -> \
  [Next] -> [Use ISO image] -> [VMware-VMvisor-Installer-5.5.0.update01-1623387.x86_64.iso] -> \
  [5.VMware ESX] -> [(Version)VMware ESXi 5] -> [Next] -> ... -> [Finish] -> [Close]

■ネストESXiインストール中にまた余談。
 ホストのwheezyはNFSサーバにしてネストESXiのストレージに見せる。
 無償評価版ではvCenterServerがないので、ライブマイグレーションは出来ない。
 単に構成として。

 NFS+Xenのライブマイグレーションを試す
 http://labunix.hateblo.jp/entry/20130715/1373888357

$ sudo apt-get install -y nfs-kernel-server
$ test -d /media/nfs || sudo mkdir /media/nfs
$ ip addr | grep vmnet8 | grep inet | awk '{print $2}'
192.168.33.1/24
$ echo '/media/nfs 192.168.33.0/24(rw,sync,fsid=0,crossmnt,no_root_squash,no_subtree_check)' | \
  sudo tee -a /etc/exports && \
  sudo /etc/init.d/nfs-kernel-server restart

■Windows7にvShereClientを導入
 workstationからConnect Serverで簡単にネストESXiに接続出来る。ステータスやゲストOSの管理も出来る。
 後はvSphere Remote Command LineのLinux版を覚えましょう。。。