2010年11月2日火曜日

VMware ToolsをCentOSへインストール

VMware ESXi 4.1上に構築したCentOS5.5にVMware Toolsをインストールします。

仮想マシンの電源がONになっている必要がありますので、必ず電源をONにします。vSphereでvCenter Serverへ管理者でログインして対象の仮想サーバを選択します。次に上記メニューからインベントリ→仮想マシン→ゲスト→VMware Toolsのインストール/アップグレードの順に指定します。



インストール確認のメッセージが表示されますのでOKを押します。



仮想マシンのコンソールを表示させrootでログインします。
※Nicドライバの入れ替えも発生するのでSSH等リモートでは実行しないようにします。


VMware Toolsのメディア(CDとして)をマウントさせます。
# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only


中身を確認してみます。
# ls /mnt/
VMwareTools-8.3.2-257589.tar.gzが存在すればマウントOKです。
※2010/11/02現在


メディアからLinux上にコピーします。(基本どこでもよいが、/usr/local/srcに入れます)
# cp /mnt/VMwareTools-8.3.2-257589.tar.gz /usr/local/src
# cd /usr/local/src
# tar zxvf VMwareTools-8.3.2-257589.tar.gz


インストーラーを実行します。
ただしXウインドウが組み込まれていない状態を想定しています。

# perl ./vmware-tools-distrib/vmware-install.pl
Creating a new VMware Tools installer database using the tar4 format.
Installing VMware Tools.
In which directory do you want to install the binary files?
[/usr/bin]  ← Enter

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]  ← Enter

What is the directory that contains the init scripts?
[/etc/rc.d/init.d]  ← Enter

In which directory do you want to install the daemon files?
[/usr/sbin]  ← Enter

In which directory do you want to install the library files?
[/usr/lib/vmware-tools]  ← Enter

The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes] ← Enter

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]  ← Enter

The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you want?
[yes]  ← Enter

The installation of VMware Tools 8.3.2 build-257589 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now?
[yes] ← Enter

Initializing...

Stopping VMware Tools services in the virtual machine:
   Guest operating system daemon:                          [  OK  ]
   Virtual Printing daemon:                                [  OK  ]
   Unmounting HGFS shares:                                 [  OK  ]
   Guest filesystem driver:                                [  OK  ]

Found a compatible pre-built module for vmmemctl.  Installing it...

Could not create the '/mnt/hgfs' directory.
The filesystem driver (vmhgfs module) is used only for the shared folder
feature. The rest of the software provided by VMware Tools is designed to work
independently of this feature.
If you wish to have the shared folders feature, you can install the driver by
running vmware-config-tools.pl again after making sure that gcc, binutils, make
and the kernel sources for your running kernel are installed on your machine.
These packages are available on your distribution's installation CD.
[ Press Enter key to continue ]  ← Enter

Found a compatible pre-built module for vmxnet.  Installing it...

Found a compatible pre-built module for vmblock.  Installing it...

Found a compatible pre-built module for vmci.  Installing it...

Found a compatible pre-built module for vsock.  Installing it...

Found a compatible pre-built module for vmxnet3.  Installing it...

Found a compatible pre-built module for pvscsi.  Installing it...

No X install found.
Creating a new initrd boot image for the kernel.
   Checking acpi hot plug                                  [  OK  ]
Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:                       [  OK  ]
   Paravirtual SCSI module:                                [  OK  ]
   Guest memory manager:                                   [  OK  ]
   Guest vmxnet fast network device:                       [  OK  ]
   VM communication interface:                             [  OK  ]
   VM communication interface socket family:               [  OK  ]
   Guest operating system daemon:                          [  OK  ]
   Virtual Printing daemon:                                [  OK  ]
The configuration of VMware Tools 8.3.2 build-257589 for Linux for this running
kernel completed successfully.
You must restart your X session before any mouse or graphics changes take
effect.
You can now run VMware Tools by invoking the following command:
"/usr/bin/vmware-toolbox" during an X server session.
To enable advanced X features (e.g., guest resolution fit, drag and drop, and
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.
To use the vmxnet driver, restart networking using the following commands:
/etc/init.d/network stop
rmmod pcnet32
rmmod vmxnet
modprobe vmxnet
/etc/init.d/network start

Enjoy,

--the VMware team

Found VMware Tools CDROM mounted at /mnt. Ejecting device /dev/cdrorom

ネットワーク止めて・・・rmmod pcnet32~なんて書かれていますが、面倒なので仮想マシンを再起動しちゃいました。

# reboot

再起動後にサマリを確認して「VMware Tools: OK」になっていれば完了です。


2010年11月1日月曜日

VMware vSphere Hypervisor(VMware ESXi 4.1)にCentOSをインストール

先日構築したVMware vSphere Hypervisor/VMware ESXi 4.1 (詳しくはこちら)にCentOSをインストールしてみたいと思います(とりあえず「動かす」をメインに考え細かい設定はしていません)。
事前にこちらを参考に新規仮想マシンを作成しておきます。

CentOS5のインストールはネットワーク経由でインストールしたいと思います。ネットワーク用ISOファイルを予めダウンロードしておきます。http://ftp.riken.jp/Linux/centos/5/os/i386/images/boot.iso

VMware vSphere ClientでvSphereにログインして先ほどダウンロードしたISOファイルをvSphere上にそのままアップロードしておき、これをboot指定したいと思います。
構成タブ>datastore1を右クリックしてデータストアの参照を選択します。

 データストア ブラウザが起動しエクスプローラー風の画面が表示されます。そのままアップしてもよいが、ここには作成した仮想マシンがあるためできればファイル用に別ディレクトリを作成します。出来上がったディレクトリに移動してファイルをアップロードしておきます。


 仮想マシンの設定プロパティ-を開きCD/DVDドライブでデータストアISOファイルからアップロードしたISOファイルを指定します。(仮想マシンの電源はまだ入れない)
必ず「パワーオン時に接続 」にチェックを入れておきます。

仮想マシンを開きコンソールタブを選択しておきます。

仮想マシンの電源をオンにしてインストール画面が表示されるか確認します。

実際のインストールは、こちらで紹介したので参照いただければと思います。(5.3ですが基本は同じです。)

VMware vSphere Clientで新規仮想マシンの作成

先日インストールしたVMware vSphere Hypervisor に VMware vSphere Clientを使い仮想マシンを作成してみたいと思います。

●VMware vSphere ClientでvCenter Serverにログインし「新規仮想マシンの作成」を実行します。上記メニューの「インベントリ」→「ホスト」→「新規仮想マ シン」からでもOKです。また仮想マシンタブで仮想マシン一覧を表示してその画面上で右クリックしても新規作成できます。どれも内容は同じです。



●ウィザードが実行されますので画面に沿って設定していきます。構成は標準でも問題はないですが内容を理解するためにもできる限り「カスタム」を選択しましょう。

●任意の名前を設定します。このシステム内で重複しないよう指定します。

●ファイルの保存場所を指定します。ここでは1か所しかないため必然的にdatastore1になります。

●仮想マシンのバージョンを指定します。ここでは旧バージョンは意識しないためバージョン7を指定します。

●インストールするOS(ゲストOS)を指定します。CentOSをインストールするのでLinuxを指定し適切なバージョンを選択します。

●プロセッサの数を指定します。vCenter Serverのコア数やインストールするOSでサポートされているプロセッサ数により選択幅は異なりますが、テスト用としてここでは1CPUとします。※後で変更も可能だが減らすと不具合が出る可能性があります。

●メモリサイズを指定します。 vCenter Serverに搭載されているメモリを超えない範囲で指定します。

●ネットワークカードを指定します。デフォルトでよいでしょう。(アダプタの種類についてはこちらを参照)

●SCSIコントローラを指定します。デフォルトでよいでしょう。

●仮想ディスクを指定します。ここでは新規に作成します。

●ディスクサイズを指定します。テストであれば10GBもあれば十分でしょう。これも後で増やすことが可能です。


<参考>
領域をオンデマンドで割り当ておよびコミット(シンプロビジョニング)

仮にディスクサイズを50GBに設定すると50GBフルに確保しますが、これでは使われていない領域も確保されてしまうため多くのOSをインストールしていくと無駄が増えます。これを回避する方法として実際に使われた領域のみを確保する設定ができます。(仮想マシンでは設定サイズで表示されます)ただしハードがサポートしている必要がある。



●仮想ディスクの詳細オプション指定。デフォルトでよいでしょう。


●作成完了です。


Google検索