VMware ESXi 仮想マシン(CentOS7.1)作成 VMware toolsインストール

#概要
VMware ESXi 6.0 を使用して仮想マシンを作成します。
ゲストOSはCentOS 7.1 を使用します。
また、作成後にVMware toolsをインストールします。

#手順
##仮想マシン作成+CentOSインストール

ESXiをvSphere Clientで開き、「新規仮想マシンの作成」をクリックします。

![SnapCrab_2015-12-13_No-002.png](https://qiita-image-store.s3.amazonaws.com/0/104247/4b688e7a-4a57-e67f-8d57-100e726e6104.png)

カスタムを選びます。
![SnapCrab_2015-12-13_No-003.png](https://qiita-image-store.s3.amazonaws.com/0/104247/f4bfcc59-fedb-08e2-3ca2-186fdd9ac90d.png)

適当に名前を入力します。
![SnapCrab_2015-12-13_No-004.png](https://qiita-image-store.s3.amazonaws.com/0/104247/b365d575-b798-361d-f4a8-6900d8a35c0f.png)


![SnapCrab_2015-12-13_No-005.png](https://qiita-image-store.s3.amazonaws.com/0/104247/3632be97-f74b-41dc-39f9-6bb12d4922b4.png)

![SnapCrab_2015-12-13_No-006.png](https://qiita-image-store.s3.amazonaws.com/0/104247/31955259-32b1-12c7-a819-03ff61b721d8.png)

CentOS7を選択します。ここで選択した種類に応じてVMware toolsのインストールする処理が変更されるので、
間違ったものを選択するとインストールできません。ここの種類は後で変更可能です。
![SnapCrab_2015-12-13_No-007.png](https://qiita-image-store.s3.amazonaws.com/0/104247/77340c39-a9b9-2130-5c55-e9ef8eec07b5.png)

![SnapCrab_2015-12-13_No-008.png](https://qiita-image-store.s3.amazonaws.com/0/104247/004edd80-4946-9ae4-61ad-6394c267d2d3.png)

![SnapCrab_2015-12-13_No-009.png](https://qiita-image-store.s3.amazonaws.com/0/104247/b99d8cd7-c9b5-5d5e-8a17-05ede9b326bc.png)

![SnapCrab_2015-12-13_No-010.png](https://qiita-image-store.s3.amazonaws.com/0/104247/c234bfc9-5226-0fe6-87e4-2b0de5e67b0f.png)

![SnapCrab_2015-12-13_No-011.png](https://qiita-image-store.s3.amazonaws.com/0/104247/9434da36-ee79-a6fc-1686-a7445871977f.png)

![SnapCrab_2015-12-13_No-012.png](https://qiita-image-store.s3.amazonaws.com/0/104247/041beed7-fc93-e1e4-6f3e-df844473e088.png)

![SnapCrab_2015-12-13_No-013.png](https://qiita-image-store.s3.amazonaws.com/0/104247/2ef1b3da-e0d3-c1ae-b662-2e1d56cf5a77.png)

![SnapCrab_2015-12-13_No-014.png](https://qiita-image-store.s3.amazonaws.com/0/104247/4f31903d-d2ff-e42d-2138-d955b79ecca5.png)

「終了」を選択すると仮想マシンが作成されます。
![SnapCrab_2015-12-13_No-015.png](https://qiita-image-store.s3.amazonaws.com/0/104247/8a04b3ad-f301-a52c-eccd-8737761a41db.png)

作成完了したので、仮想マシンをパワーオンします。
![SnapCrab_2015-12-13_No-016.png](https://qiita-image-store.s3.amazonaws.com/0/104247/fc05dc0b-78d9-c71e-52e1-16753df96c35.png)

操作端末にあるCentOS7のISOを接続します。なお、ISOをデータストアに事前に格納してインストールする方法もあります。
![SnapCrab_2015-12-13_No-017.png](https://qiita-image-store.s3.amazonaws.com/0/104247/26d5d9ba-7de6-8205-ad08-c9ffcff64186.png)

CentOS7のISOを選択します。
![SnapCrab_2015-12-13_No-018.png](https://qiita-image-store.s3.amazonaws.com/0/104247/e305f21e-7179-e19a-af7e-53391449787e.png)

ゲストOS側に Ctrl Alt Del を送信し、リブートを実行します。
![SnapCrab_2015-12-13_No-019.png](https://qiita-image-store.s3.amazonaws.com/0/104247/8b53ad41-3b82-48ed-9f0c-8118ecf693c6.png)

ISOが読み込まれました。
![SnapCrab_2015-12-13_No-020.png](https://qiita-image-store.s3.amazonaws.com/0/104247/d62f7142-afd6-f39f-f6e7-3d95558e3eae.png)

諸々選択していきます。
![SnapCrab_2015-12-13_No-021.png](https://qiita-image-store.s3.amazonaws.com/0/104247/5997ad99-f400-2755-5148-a505358b958b.png)

![SnapCrab_2015-12-13_No-022.png](https://qiita-image-store.s3.amazonaws.com/0/104247/3e3d6ab6-527e-55a6-b53d-f4f3964e9d1d.png)

![SnapCrab_2015-12-13_No-023.png](https://qiita-image-store.s3.amazonaws.com/0/104247/3176f25c-0e3f-cf18-dfc1-100d6b03f653.png)

![SnapCrab_2015-12-13_No-024.png](https://qiita-image-store.s3.amazonaws.com/0/104247/9d2c1bdb-e61f-b13b-0fe4-c9baf7b752ca.png)

![SnapCrab_2015-12-13_No-025.png](https://qiita-image-store.s3.amazonaws.com/0/104247/325dbd5e-9b3e-d85f-0347-0b7a7373f05e.png)

![SnapCrab_2015-12-13_No-026.png](https://qiita-image-store.s3.amazonaws.com/0/104247/1c30802b-c661-dfaf-05af-496bec130b68.png)

![SnapCrab_2015-12-13_No-027.png](https://qiita-image-store.s3.amazonaws.com/0/104247/1dc00246-30aa-00fb-a777-0353da4b46a6.png)

![SnapCrab_2015-12-13_No-028.png](https://qiita-image-store.s3.amazonaws.com/0/104247/5d437f52-d456-af35-6720-a91f3b545611.png)

![SnapCrab_2015-12-13_No-029.png](https://qiita-image-store.s3.amazonaws.com/0/104247/35779514-5662-de54-b21d-2d4aaa5c1451.png)

インストール完了後、リブートを実行するとログインが可能です。
![SnapCrab_2015-12-13_No-030.png](https://qiita-image-store.s3.amazonaws.com/0/104247/75eb21c5-ec9e-b291-fe1c-d478a8efc556.png)

##VMware Toolsをインストール

ESXi上でインストールしたい仮想マシンを選択し、右クリック→ゲスト→VMware Toolsのインストールを選択します。
これを選択すると、ゲストOS上のcdromにインストーラが認識されます。
![SnapCrab_2015-12-14_No-004.png](https://qiita-image-store.s3.amazonaws.com/0/104247/57b1ea53-152f-ef17-5460-2ed52532c9cc.png)


VMware Toolsのインストールにperlやnet-toolsが必要です。
open-vm-toolsの方がインストールを推奨されてますが、不安なので公式のものをインストールします。

```
[root@mng-server ~]# yum -y install perl net-tools
```

以下コマンドでインストールしていきます。

```
[root@mng-server ~]# mkdir /mnt/cdrom
[root@mng-server ~]# mount /dev/cdrom /mnt/cdrom/
mount: /dev/sr0 is write-protected, mounting read-only
[root@mng-server ~]# cd /mnt/cdrom/
[root@mng-server cdrom]#
[root@mng-server cdrom]# ls -la
合計 68478
dr-xr-xr-x. 2 root root     2048  8月 13 19:21 .
drwxr-xr-x. 3 root root       18 12月 14 00:12 ..
-r--r--r--. 1 root root 68644875  8月 13 18:55 VMwareTools-9.10.5-2981885.tar.gz
-r-xr-xr-x. 1 root root     2011  8月 13 18:55 manifest.txt
-r--r--r--. 1 root root     1850  8月 13 18:52 run_upgrader.sh
-r-xr-xr-x. 1 root root   699332  8月 13 18:54 vmware-tools-upgrader-32
-r-xr-xr-x. 1 root root   769784  8月 13 18:54 vmware-tools-upgrader-64
[root@mng-server cdrom]#
[root@mng-server cdrom]# cp /mnt/cdrom/VMwareTools-9.10.5-2981885.tar.gz /tmp/
[root@mng-server cdrom]#
[root@mng-server cdrom]# cd /tmp/
[root@mng-server cdrom]# umount /mnt/cdrom
[root@mng-server tmp]# tar xzf VMwareTools-9.10.5-2981885.tar.gz
[root@mng-server tmp]# cd vmware-tools-distrib/
[root@mng-server vmware-tools-distrib]# ./vmware-install.pl
open-vm-tools are available from the OS vendor and VMware recommends using
open-vm-tools. See http://kb.vmware.com/kb/2073803 for more information.
Do you still want to proceed with this legacy installer? [no] yes ← yesを入力します。open-vm-toolsの方が推奨と警告を受けます。

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]

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

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

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

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

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]

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]
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]
The installation of VMware Tools 9.10.5 build-2981885 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]
Initializing...


Making sure services for VMware Tools are stopped.

Stopping vmware-tools (via systemctl):                     [  OK  ]


The module vmci has already been installed on this system by another installer
or package and will not be modified by this installer.

The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.

The module vmxnet3 has already been installed on this system by another
installer or package and will not be modified by this installer.

The module pvscsi has already been installed on this system by another
installer or package and will not be modified by this installer.

The module vmmemctl has already been installed on this system by another
installer or package and will not be modified by this installer.

The VMware Host-Guest Filesystem allows for shared folders between the host OS
and the guest OS in a Fusion or Workstation virtual environment.  Do you wish
to enable this feature? [no]
The vmxnet driver is no longer supported on kernels 3.3 and greater. Please
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)

The vmblock enables dragging or copying files between host and guest in a
Fusion or Workstation virtual environment.  Do you wish to enable this feature?
[no]
VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can
be enabled/disabled by re-running vmware-config-tools.pl.

Would you like to enable VMware automatic kernel modules?
[no]
Do you want to enable Guest Authentication (vgauth)? [yes]

No X install found.

Creating a new initrd boot image for the kernel.
Starting vmware-tools (via systemctl):                     [  OK  ]
The configuration of VMware Tools 9.10.5 build-2981885 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 "/usr/bin/vmware-toolbox-cmd" from the
command line.

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.

Enjoy,

--the VMware team

[root@mng-server vmware-tools-distrib]#
```

Enjoy が表示されればインストール完了です。