|Table of contents|
This is what VMware have to say about the vSphere Perl SDK:
The vSphere SDK for Perl provides an easy-to-use Perl scripting interface to the vSphere API. Administrators and developers can work with vSphere API objects using vSphere SDK for Perl subroutines.
The SDK is provided as a tarball which contains an installer script which is good, but for those of us that prefer to have a bit more control over our environments an RPM would be much nicer. The following information provides everything you will need to bundle the VMware provided tarball into an RPM which will allow simpler installation and more importantly cleaner uninstallation.
My personal preference is to install third party software to
/opt so there is a patch applied to the SDK during package build to make this happen. There is also a second patch to switch from the
UUID perl module to
Data::UUID instead since this is supplied natively on Red Hat Enterprise 6 and Fedora systems as far back as release 8. The
Data::UUID Perl module is provided by EPEL on Red Hat Enterprise 5 systems so presumably that would work too. Note that there is an unsatisfied dependency on the
ExtUtils::MakeMaker Perl module on Red Hat Enterprise 5. This module is not available through the EPEL repository either, though it can be found in other third party repositories.
The VMware site offers separate downloads for
VMware-vSphere-CLI installers however despite the different names these packages are in fact identical. As such the patches and RPM spec file will work for either installer provided all references to
VMware-vSphere-Perl-SDK in the spec file are altered in the case of
If you are new to RPM packaging the have a read through this overview of Linux - RPM Packages#Package Building.
When you are ready to build the package download the following files into your RPM build environment:
The following packages are required on Red Hat and Fedora systems to build the VMware vSphere Perl SDK package.
The following command would install all these packages in one go:
Building the package
Always build packages as a non-privileged user and never as root
Building the package will result in the created of two RPM packages,
Many thanks to Schlomo Schapiro for providing updates for version 5.1.0.
As mentioned in the build section there are two packages. The
VMware-vSphere-Perl-SDK package can be installed by itself and only provides the VMware SDK Perl modules which can be used to develop yourr own vSphere tools.
VMware-vSphere-CLI package provides the RCLI/vCLI components which are used to remotely manage vCenter and hypervisor hosts. This package depends on the Perl SDK in which case both packages need to be installed.
"Server version unavailable" error message
First ensure that LWP::Protocol::https is installed. Secondly recent versions of the Perl LWP module have strict checking enabled for SSL connections by default. Since most ESX and vCenter installs make use of self-signed certificates the check will fail as these certificates are not signed by a trusted certificate authority.
To fix the strict checking issue any of the following options are available:
- Install certificates signed by a certificate authority on all ESX and vCenter hosts
If an enterprise internal certificate authority is used the CA certificate will need to be installed on the Perl SDK hosts as well
PERL_LWP_SSL_VERIFY_HOSTNAMEenvironment variable to
0prior to running the scripts (or set it in your profile)
add the environment variable to any scripts that use the Perl SDK
If none of these options work then it could also be a proxy issue so try unsetting any
$https_proxy environment variables if not required for connections to the ESXi or vCenter hosts.