VMware has a guide available at https://pubs.vmware.com/vsphere-65/topic/com.vmware.ICbase/PDF/vsphere-perl-sdk-65-installation-guide.pdf, which if you follow carefully you will be able to successfully install the vSphere SDK for Perl without any issues. I, unfortunately, didn’t follow the guide properly and landed into some issues, which I have documented here. This blog post captures:

  1. How to install vSphere SDK for Perl on Ubuntu 14.04
  2. Issues encountered

Install vSphere SDK on Ubuntu 14.04

It’s assumed that Ubuntu has been updated with the latest packages and the vSphere SDK for Perl has been downloaded. I downloaded the vSphere SDK for Perl from https://my.vmware.com/group/vmware/home.

Configuration snippet below can be used to install.

sudo apt -y install perl-doc libssl-dev libxml-perl libxml-libxml-perl uuid-dev
sudo cpan LWP::Protocol::https
tar -zxvf VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.tar.gz 
cd vmware-vsphere-cli-distrib/
# Follow prompts
sudo perl vmware-install.pl

Software gets installed in the following location

vCLI scripts – /usr/bin 
vSphere SDK for Perl utility applications – /usr/lib/vmware-vcli/apps 
vSphere SDK for Perl sample scripts – /usr/share/doc/vmware-vcli/samples
Verify your install

Modify the IP address and password to match your enviornment and use the command below to print details of the nics on an ESXi host. This will confirm that the install was successful.

esxcfg-nics -l --server 192.168.1.2 --username root --password password

Output

Name    PCI     Driver     Link Speed    Duplex MAC Address        MTU    Description                                  
vmnic0  0000:03:00.0 bnx2       Up   1000Mbps Full   78:e3:b5:18:80:1c  1500   Broadcom Corporation NC382i Integrated Multi Port PCI Express Gigabit Server Adapter 
vmnic1  0000:03:00.1 bnx2       Up   100Mbps  Full   78:e3:b5:18:80:1e  1500   Broadcom Corporation NC382i Integrated Multi Port PCI Express Gigabit Server Adapter 
vmnic2  0000:04:00.0 bnx2       Down 0Mbps    Half   78:e3:b5:18:70:b4  1500   Broadcom Corporation NC382i Integrated Multi Port PCI Express Gigabit Server Adapter 
vmnic3  0000:04:00.1 bnx2       Down 0Mbps    Half   78:e3:b5:18:70:b6  1500   Broadcom Corporation NC382i Integrated Multi Port PCI Express Gigabit Server Adapter 
vmnic4  0000:06:00.0 e1000e     Down 0Mbps    Half   00:1b:21:ae:d4:ba  1500   Intel Corporation 82571EB Gigabit Ethernet Controller 
vmnic5  0000:06:00.1 e1000e     Down 0Mbps    Half   00:1b:21:ae:d4:bb  1500   Intel Corporation 82571EB Gigabit Ethernet Controller 
Issues Encountered – UUID Perl module install

At the end of the install, I got the error below.

CPAN was not able to install following Perl modules on the system. These must be
installed manually for use by vSphere CLI:

UUID 0.03 or newer

You will see this error id uuid-dev package is not installed. Install, uuid-dev package using

sudo apt -y install uuid-dev

and then install UUID Perl module using

sudo cpan UUID
Issues Encountered – Outdated Perl modules

There have been issues reported if the Perl modules were old and hence using the latest version of Perl modules is recommended. I got the error below, when installing.

The following Perl modules were found on the system but may be too old to work with vSphere CLI:

MIME::Base64 3.14 or newer
IO::Compress::Zlib::Constants 2.061 or newer
Socket6 0.23 or newer

Verify the version of the Perl module, using the command below

cpan -D MIME::Base64

Upgrade to latest version by running

sudo cpan MIME::Base64
Issues Encounted – Undefined subroutine &Opts::set_option

When trying to use the Perl modules, I started getting the following error when I would execute the scripts.

Undefined subroutine &Opts::set_option

This was happening because I had installed viperltoolkit, which was conflicting with the installation of vSphere SDK for Perl. The fix was to uninstall and reinstall the SDK

cd vmware-vsphere-cli-distrib/
sudo perl bin/vmware-uninstall-vSphere-CLI.pl

I hope this post helps. RTFM Folks! 🙂

print