打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
vSphere Perl SDK and CLI RPM Packages


Overview

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.

Icon

The VMware site offers separate downloads for VMware-vSphere-Perl-SDK and 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 VMware-vSphere-CLI.

 

Preparation

Files

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:

$rpmbuild/SOURCES/VMware-vSphere-Perl-SDK/VMware-vSphere-Perl-SDK-5.1.0-780721.x86_64.tar.gz
$rpmbuild/SOURCES/VMware-vSphere-Perl-SDK/makefile.patch
$rpmbuild/SOURCES/VMware-vSphere-Perl-SDK/uuid-module.patch
$rpmbuild/SPECS/VMware-vSphere-Perl-SDK.spec

Packages

The following packages are required on Red Hat and Fedora systems to build the VMware vSphere Perl SDK package.

  • perl
  • perl-Crypt-SSLeay
  • perl-ExtUtils-MakeMaker
  • perl-libwww-perl
  • perl-Net-SSLeay
  • perl-SOAP-Lite
  • perl-URI
  • perl-XML-LibXML
  • rpm-build
  • uuid-perl

The following command would install all these packages in one go:

sudo yum install perl perl-Crypt-SSLeay perl-ExtUtils-MakeMaker perl-libwww-perl perl-Net-SSLeay \
                 perl-SOAP-Lite perl-URI perl-XML-LibXML rpm-build uuid-perl

 

Building the package

 

Icon

Always build packages as a non-privileged user and never as root

Building the package will result in the created of two RPM packages, VMware-vSphere-Perl-SDK and VMware-vSphere-CLI.

rpmbuild -ba ~rpmbuild/SPECS/VMware-vSphere-Perl-SDK.spec
Icon

Many thanks to Schlomo Schapiro for providing updates for version 5.1.0.

 

Installation

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.

sudo yum localinstall ~rpmbuild/RPMS/VMware-vSphere-Perl-SDK-5.0.0-422456.1.fc15.x86_64.rpm

The 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.

sudo yum localinstall ~rpmbuild/RPMS/VMware-vSphere-Perl-SDK-5.0.0-422456.1.fc15.x86_64.rpm \
                      ~rpmbuild/RPMS/VMware-vSphere-CLI-5.0.0-422456.1.fc15.x86_64.rpm

 

Troubleshooting

"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
  • set the PERL_LWP_SSL_VERIFY_HOSTNAME environment variable to 0prior to running the scripts (or set it in your profile)

    export PERL_LWP_SSL_VERIFY_HOSTNAME=0
  • add the environment variable to any scripts that use the Perl SDK

    $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;

If none of these options work then it could also be a proxy issue so try unsetting any $http_proxy and $https_proxy environment variables if not required for connections to the ESXi or vCenter hosts. 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
MySQL 测试 sql-bench 出错
git: command not found
如何处理错误消息Please install the gcc make perl packages from your distribution
VMware vSphere入门到精通培训系列视频
vSphere?5.1?(ESXi?5.1)开启并配置SNMP
周剑辉的 《VMware vSphere 5.1 学习系列》
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服