よろづやアンテナ

ITから生活の参考になる情報を備忘録代わりに残していきます

What is the location of the gcc program on your machine CentOS7 VMwareTools

会社でESXi6.X上で稼働するLinuxCentOSにVMwareToolsをインストールすることはあるんですが、意外と注意点があったので、自宅のVMwarePlayerにCentOS7.2の仮想マシンを構築し、VMwareToolsをインストールしたら、会社以上にハマったので、備忘録。


はまった理由は、VMware Playerのバージョンが古い事も関係しているかもしれません。今回は、CentOS7.2へVMware Toolsをインストールする手順です。逆に色々ハマったので、勉強になりました。


まず、CentOS7.2はMinimal版です。Minimal版はPerlが入っていなかったり、色々と事前にやっておいたほうがいいことがあります。


CentOS7.2はMinimal版にVMware Toolsをインストールする手順は以下を参照してください。

>>VMwarePlayer、CentOS7.2環境でVMware Toolsをインストールする手順


そして、今回は、上記手順に含まなかったトラブルについての手順です。ポイントは、ifconfigが使えるようにしておく事と、Perlをインストールしておくことです。この二つを事前に準備しておけば、ESXi6Xの環境であれば問題なくVMware Toolsをインストールすることができると思います。


今回は、それ以外ではまったんですが、VMware Toolsインストール時に以下のようなエラーが出てインストールが先に進みません。

Searching for GCC...
The path "" is not valid path to the gcc binary.
Would you like to change it? [yes] 
 
What is the location of the gcc program on your machine? 



参考にしたのは以下のKBです。

>>The VMware Workstation Shared Folders option is missing in Fedora virtual machines (2016514)


以下は抜粋です。

To resolve this issue, you must update the GCC and kernel headers and then reinstall VMware Tools.
 
To update the GCC and kernel headers and to reinstall VMware Tools:
Open a terminal and run this command to log in as a super user:

su - 

Run this command to install the GCC binary packages:

yum install gcc gcc-c++ make binutils

Run this command to update the Linux kernel:

yum update kernel

Run this command to reboot the virtual machine:

reboot

Open a terminal again and login as the super user.
Run this command to install the kernel's development packages to update the kernel headers:

yum install kernel-headers kernel-PAE-devel

Run this command and verify if the update is complete:

uname -rs

You see an output similar to:

Linux 3.1.0-7.fc16.i686

Where 3.1.0-7.fc16.i686 is the kernel version 

Click VM > Install/Reinstall VMware Tools to start the VMware Tools installation.
After the VMware Tools ISO is mounted in the virtual machine, extract the contents.
Change directory from the terminal Window and run the installer using this command:

./vmware-install.pl

そして、実際の手順です。

[root@localhost vmware-tools-distrib]# yum install gcc gcc-c++ make binutils
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.tsukuba.wide.ad.jp
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: ftp.tsukuba.wide.ad.jp
パッケージ 1:make-3.82-21.el7.x86_64 はインストール済みか最新バージョンです
パッケージ binutils-2.23.52.0.1-55.el7.x86_64 はインストール済みか最新バージョンです
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ gcc.x86_64 0:4.8.5-4.el7 を インストール
--> 依存性の処理をしています: cpp = 4.8.5-4.el7 のパッケージ: gcc-4.8.5-4.el7.x86_64
--> 依存性の処理をしています: glibc-devel >= 2.2.90-12 のパッケージ: gcc-4.8.5-4.el7.x86_64
--> 依存性の処理をしています: libmpfr.so.4()(64bit) のパッケージ: gcc-4.8.5-4.el7.x86_64
--> 依存性の処理をしています: libmpc.so.3()(64bit) のパッケージ: gcc-4.8.5-4.el7.x86_64
---> パッケージ gcc-c++.x86_64 0:4.8.5-4.el7 を インストール
--> 依存性の処理をしています: libstdc++-devel = 4.8.5-4.el7 のパッケージ: gcc-c++-4.8.5-

~  

依存性関連をインストールしました:
  cpp.x86_64 0:4.8.5-4.el7                                                      
  glibc-devel.x86_64 0:2.17-106.el7_2.8                                         
  glibc-headers.x86_64 0:2.17-106.el7_2.8                                       
  kernel-headers.x86_64 0:3.10.0-327.28.3.el7                                   
  libmpc.x86_64 0:1.0.1-3.el7                                                   
  libstdc++-devel.x86_64 0:4.8.5-4.el7                                          
  mpfr.x86_64 0:3.1.1-4.el7                                                     

依存性を更新しました:
  glibc.x86_64 0:2.17-106.el7_2.8     glibc-common.x86_64 0:2.17-106.el7_2.8    

完了しました!
 
[root@localhost ~]# yum update kernel
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.tsukuba.wide.ad.jp
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: ftp.tsukuba.wide.ad.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ kernel.x86_64 0:3.10.0-327.28.3.el7 を インストール
--> 依存性解決を終了しました。


 
Last login: Fri Sep  2 07:09:41 2016
 
[root@localhost ~]# cd tmp/vmware-ptools-distrib/
[root@localhost vmware-tools-distrib]# ls
FILES  INSTALL  bin  doc  etc  installer  lib  vmware-install.pl
[root@localhost vmware-tools-distrib]# ./vmware-install.pl 
A previous installation of VMware Tools has been detected.

The previous installation was made by the tar installer (version 4).

Keeping the tar4 installer database format.

You have a version of VMware Tools installed.  Continuing this install will 
first uninstall the currently installed version.  Do you wish to continue? 
(yes/no) [yes] 

Uninstalling the tar installation of VMware Tools.

Stopping services for VMware Tools

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

Stopping Thinprint services in the virtual machine:
   Stopping Virtual Printing daemon: done

The removal of VMware Tools 9.6.2 build-1688356 for Linux completed 
successfully.

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.6.2 build-1688356 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 Thinprint services in the virtual machine:
   Stopping Virtual Printing daemon: done
Stopping vmware-tools (via systemctl):  Warning: vmware-tools.service changed on disk. Run 'systemctl daemon-reload' to reload units.
[  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? [yes] 


Before you can compile modules, you need to have the following installed... 

make
kernel headers of the running kernel


Searching for GCC...
Detected GCC binary at "/bin/gcc".
The path "/bin/gcc" appears to be a valid path to the gcc binary.
Would you like to change it? [no] 

Detected GCC binary at "/bin/gcc".
The path "/bin/gcc" appears to be a valid path to the gcc binary.
Would you like to change it? [no] 

Searching for a valid kernel header path...
The path "" is not a valid path to the 3.10.0-327.28.3.el7.x86_64 kernel 
headers.
Would you like to change it? [yes] 


Enter the path to the kernel header files for the 3.10.0-327.28.3.el7.x86_64 
kernel? 

手順通り進めて、、、以下の手順で先に勧めました。


The path "" is not a valid path to the 3.10.0-327.28.3.el7.x86_64 kernel 
headers.
Would you like to change it? [yes] no
※私と同じトラブルの場合は、ここでnoを選ぶと先に進めます。

WARNING: This program cannot compile any modules for the following reason(s)...

- This program could not find a valid path to the kernel headers of the running
kernel.  Please ensure that the header files for the running kernel are 
installed on this sytem.

[ Press Enter key to continue ] 


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 ] 

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?
[yes] 

NOTICE:  It appears your system does not have the required fuse packages 
installed.  The VMware blocking filesystem requires the fuse packages and its 
libraries to function properly.  Please install the fuse or fuse-utils package 
using your systems package management utility and re-run this script in order 
to enable the VMware blocking filesystem. 

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] 

No X install found.


Creating a new initrd boot image for the kernel.

   Starting Virtual Printing daemon: done
Starting vmware-tools (via systemctl):  [  OK  ]
The configuration of VMware Tools 9.6.2 build-1688356 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

Found VMware Tools CDROM mounted at /mnt/cdrom. Ejecting device /dev/sr0 ...
/sbin/restorecon:  Warning no default label for /tmp/vmware-block-restore0/tmp_file

[root@localhost vmware-tools-distrib]# reboot

[root@localhost ~]# service vmware-tooslls status

vmtoolsd is running
VMware Toolsのサービスがきちんと起動しています。
[root@localhost ~]# 


で、ようやく完了です。ポイントは、ifconfigが使えるようにしておく事と、Perlをインストールしておくことです。この二つを事前に準備しておけば、ESXi6Xの環境であれば問題なくVMware Toolsをインストールすることができると思います。