Howto: Install vSphere Perl SDK on CentOS 7 / RHEL 7

This quick howto will guide you through the installation proces of vSphere Perl SDK on a CentOS 7 server.
I don't fancy long guides, so I'll try to keep mine brief and simple.
  1. Download the 64bit tar.gz archive of the SDK here. Please note that my.vmware.com access is required.
  2. Install prerequisities, run all commands as root:
  3. yum install e2fsprogs-devel libuuid-devel openssl-devel perl-devel
    yum install glibc.i686 zlib.i686
    yum install perl-XML-LibXML libncurses.so.5 perl-Crypt-SSLeay
    
  4. Extract the downloaded archive and start installer:
  5. tar xzf VMware-vSphere-Perl-SDK-*
    ./vmware-vsphere-cli-distrib/vmware-install.pl
    
  6. Follow the installation process using default options. At the very end, you might get a warning about old versions of some Perl modules. Proceed to next point to remedy this.
  7. Get new modules from CPAN to get rid of warnings:
  8. yum install gcc perl-CPAN
    cpan IO::Compress::Zlib::Extra
    cpan MIME::Base64
    cpan LWP
    
That's it. Your server should now be ready. For some sample code take a look at:
/usr/share/doc/vmware-vcli/samples
/usr/lib/vmware-vcli/apps
A good next step would be to try it! Login to your vCenter Server or ESXi host and try to save a session:
/usr/share/doc/vmware-vcli/samples/session/save_session.pl --server "hostname" \
    --username "user1" --password "pass123" --savesessionfile "/tmp/vcli.test"
It should take no more than a few seconds to log in. If the script runs slower than that, you might need to downgrade Perl's Net::HTTP module to 6.03. In my experience mainly the older versions of vSphere Perl SDK used to require this, the current build seems to run fine at the default state.
That's all for today, have a good one!

Comments

  1. Good Morning:

    I have installed and configured a virtual server with CentOS 7.5, I have installed all the prerequisites indicated in the Vmware-vsphere perl SDK installation manual, but I can not get the Vmware configuration wizard running in Nagios, it tells me that it is not installed

    Do you have any idea how I can prove that the SDK is installed?

    Best regards...

    Frank Guillén

    ReplyDelete
  2. Hi Frank,

    I would suggest to reinstall the SDK by running the "vmware-install.pl" script again. At the very end, it should say "Enjoy --the VMware team". If it does that, the SDK is properly installed.

    Next, please verify that nagios script check_esx3.pl actually exists in /usr/local/nagios/libexec directory. If it doesn't, copy it manually.

    Lastly, set proper permissions to /usr/local/nagiosxi/html/includes/configwizards/vmware/scripts/getguests.pl script. It should be owned by nagios:root with 755 file permissions.

    Best of luck, Pavel

    ReplyDelete
  3. Hi Sadhana, thanks. I've slowed down a bit as I am quite busy at the moment. But more stuff is coming.

    ReplyDelete

Post a Comment