Install VMWare vSphere SDK for Perl to CentOS 7

Home Blog Categories Links

Install VMWare vSphere SDK for Perl to CentOS 7

Darwick 2018-07-23 Categories: #automation #perl-sdk #vmware

Did you ever tried to install the VMware vSphere SDK for Perl 6.5 or 6.7 to a CentOS (or any RHEL) 7 system? Yes, it will be a pain in your ass. In CentOS 6 systems, the installer has precompiled Perl modules and will install it. But in CentOS (or any RHEL) 7 systems, you will need to get and compile them from CPAN. If you try to make this way, you will have to face many issues, but it could be another entire blog post.

Hopefully, I have find a way how can you install all of the Perl modules via yum and you don’t need to use (or even install) CPAN. Then your application which calls the SDK for Perl scripts will work correctly without issues.

I have tested this in the latest CentOS 7 (64bit) VM with vSphere SDK for Perl 6.5 and 6.7, fresh and clean installs, only the necessary packages was installed, but I’m pretty sure that it will work with the lower 6.x versions as well and also in physical environment. However, I’m sure this guide will not work exactly with SUSE or Debian distributions, because they have quite different package managers and package versions.

First of all, you will need to install EPEL Release if you did not installed it already:

yum install epel-release

Optional – If you plan to install the SDK for Perl to a VM, then you should install open-vm-tools:

yum install open-vm-tools

There are some pre-requirements which are also needed:

yum install perl openssl-devel

All of the preparations are complete, so you can upload the 64bit SDK for Perl to your server and unpack it. Assumed you have uploaded the packed content to your root directory, you can unpack it:

tar -xvzf VMware-vSphere-Perl-SDK-6.x.0-yyyyyyy.x86_64.tar.gz

and enter to the unpacked directory:

cd /root/vmware-vsphere-cli-distrib/bin/

Before you execute the installer, you will need to install the perl modules. This is the complete list, it will install all the dependencies you will need:

yum install perl-Time-Piece perl-Archive-Zip perl-ExtUtils-Install perl-Path-Class perl-Try-Tiny perl-Crypt-SSLeay perl-version perl-Data-Dumper perl-HTML-Parser uuid-perl perl-XML-SAX perl-XML-LibXML perl-LWP-Protocol-https perl-Socket6 perl-Text-Template perl-IO-Socket-INET6 perl-Net-INET6Glue perl-Module-Build

Before you run the installer, first modify this installer script: /root/vmware-vsphere-cli-distrib/bin/

find line 2382 and 2410 (which are exactly the same) and replace this:

{'module' => 'UUID', 'version' => '0.27', 'path' => 'UUID-0.27'},

to that:

{'module' => 'Data::UUID', 'version' => '0.27', 'path' => 'UUID-0.27'},

Now you can execute the installer:

perl /root/vmware-vsphere-cli-distrib/bin/

and follow the steps. If everything goes well, the SDK for Perl will be installed as desired. Only one little modification is required before you execute the (sample) perl scripts. In this file: /usr/share/perl5/VMware/

find the line 27 and replace this:

use UUID;

to that:

use Data::UUID;

That is all, everything is set, you can use the SDK for Perl.