Install the VI Perl Toolkit on OS X: Difference between revisions

From VI-Toolkit
Jump to navigation Jump to search
(Installation notes for installing VI Perl Toolkit on OS X using cpan)
 
mNo edit summary
Line 1: Line 1:
== Installing the VI Perl Toolkit on OS X ==
== Installing the VI Perl Toolkit on OS X ==
// by Wil van Antwerpen //
'' by Wil van Antwerpen ''
=== Installing Developer Tools ===
== Installing Developer Tools ==
The VI Perl Toolkit needs to get a few extra packages to the perl setup that is by default installed on Mac OS X. In order to get these package we use CPAN.
The VI Perl Toolkit needs to get a few extra packages to the perl setup that is by default installed on Mac OS X. In order to get these package we use CPAN.
Perl CPAN has some prerequisites of its own.
Perl CPAN has some prerequisites of its own.
Line 11: Line 11:
It is a bit big though (over 2GB) so it is a steep requirement for just getting the VI Perl toolkit to work OK. If you don't have the space, the part that is needed is the BSD "make" command and a number of other commands. It should be sufficient to install the UNIX Development Support (or BSD SDK) sub-package of the Developer Tools.
It is a bit big though (over 2GB) so it is a steep requirement for just getting the VI Perl toolkit to work OK. If you don't have the space, the part that is needed is the BSD "make" command and a number of other commands. It should be sufficient to install the UNIX Development Support (or BSD SDK) sub-package of the Developer Tools.


=== Getting the Perl VI Toolkit SDK ===
== Getting the Perl VI Toolkit SDK ==
First step is to download the latest perl SDK from:
First step is to download the latest perl SDK from:
http://communities.vmware.com/community/developer/forums/vsphere_sdk_perl
http://communities.vmware.com/community/developer/forums/vsphere_sdk_perl
Line 32: Line 32:
The warnings we see here are the packages we need to install in perl that are missing for the toolkit to work.
The warnings we see here are the packages we need to install in perl that are missing for the toolkit to work.


=== Installing missing perl dependencies ===
== Installing missing perl dependencies ==
So now we need to setup CPAN unless you already have it working, then you can skip this step.
So now we need to setup CPAN unless you already have it working, then you can skip this step.


==== Is /usr/local setup? ====
== Is /usr/local setup? ==
By default cpan will try to install some documentation under the /usr/local folder, so this folder has to exist and it needs to have the correct ownership privileges setup.
By default cpan will try to install some documentation under the /usr/local folder, so this folder has to exist and it needs to have the correct ownership privileges setup.
See if the folder already exists:
See if the folder already exists:
Line 59: Line 59:
  drwxr-xr-x@ 12 topaz topaz  408B Feb 27 01:06 ..
  drwxr-xr-x@ 12 topaz topaz  408B Feb 27 01:06 ..


==== Configure CPAN ====
== Configure CPAN ==
With the developer tools setup now you have to configure CPAN. You can also use this step if you want to change your CPAN configuration.
With the developer tools setup now you have to configure CPAN. You can also use this step if you want to change your CPAN configuration.
Configuring CPAN makes sure that the tools finds the necessary commands on your system (make et al). To do that, run:
Configuring CPAN makes sure that the tools finds the necessary commands on your system (make et al). To do that, run:
Line 80: Line 80:
The main things to select are country to download from and the site(s) which you want to use for the repositories. Just make the most logical selections here.
The main things to select are country to download from and the site(s) which you want to use for the repositories. Just make the most logical selections here.


=== Installing the VI Perl Toolkit dependencies ===
== Installing the VI Perl Toolkit dependencies ==


Now we'll get the missing dependencies by running them one by one. We could add all of these on a single line, but we want it to be easy to see if the install was successful so we are running them one by one.  
Now we'll get the missing dependencies by running them one by one. We could add all of these on a single line, but we want it to be easy to see if the install was successful so we are running them one by one.  
Line 101: Line 101:
Which down here installed fine too, so now we can finally get back to installing the VI Perl Toolkit.
Which down here installed fine too, so now we can finally get back to installing the VI Perl Toolkit.


=== Install VI Perl Toolkit ===
== Install VI Perl Toolkit ==
Now go back to the folder where you unpacked the VI Perl Toolkit:  
Now go back to the folder where you unpacked the VI Perl Toolkit:  


Line 134: Line 134:
If you want you can now delete your unpacked setup files and VI Perl tar.gz file.
If you want you can now delete your unpacked setup files and VI Perl tar.gz file.


=== Uninstall Developer Tools and cleaning up CPAN ===
== Uninstall Developer Tools and cleaning up CPAN ==


If you want to uninstall the Developer Tools, you need to run the command:
If you want to uninstall the Developer Tools, you need to run the command:
Line 148: Line 148:
  rm -r ~/.cpan
  rm -r ~/.cpan


=== External links ===
== External link ==


The following link turned out to be very helpful while I was trying to get this to work:
The following link turned out to be very helpful while I was trying to get this to work:


[http://itknowledgeexchange.techtarget.com/virtualization-pro/managing-vi3-from-os-x-1051-leopard/ Managing VMware Infrastructure 3 (VI3) from OS X (10.5.1 Leopard)]
[http://itknowledgeexchange.techtarget.com/virtualization-pro/managing-vi3-from-os-x-1051-leopard/ Managing VMware Infrastructure 3 (VI3) from OS X (10.5.1 Leopard)]
[[Category: Perl]]

Revision as of 17:59, 27 February 2010

Installing the VI Perl Toolkit on OS X

by Wil van Antwerpen

Installing Developer Tools

The VI Perl Toolkit needs to get a few extra packages to the perl setup that is by default installed on Mac OS X. In order to get these package we use CPAN. Perl CPAN has some prerequisites of its own.

For starters your system must have "make" installed. The most straightforward way to get that package installed is to take your original OS X installation disk and install Developer Tools (XcodeTools.mpkg) which can be found under Option Installs on the DVD. Just keep the default settings and you'll be fine.

It is a bit big though (over 2GB) so it is a steep requirement for just getting the VI Perl toolkit to work OK. If you don't have the space, the part that is needed is the BSD "make" command and a number of other commands. It should be sufficient to install the UNIX Development Support (or BSD SDK) sub-package of the Developer Tools.

Getting the Perl VI Toolkit SDK

First step is to download the latest perl SDK from: http://communities.vmware.com/community/developer/forums/vsphere_sdk_perl

for OS X Leopard I downloaded the 32 bits .tar.gz linux installer.

Then untar the archive by running

tar -xvzf VMware-vSphere-SDK-for-Perl-4.0.0-161974.i386.tar.gz 

from the command line. cd into the new vmware-vsphere-cli-distrib/ folder

cd vmware-vsphere-cli-distrib/

and run:

perl MakeFile.pl

this will most likely return the following warnings:

Warning: prerequisite Class::MethodMaker 2.08 not found.
Warning: prerequisite Crypt::SSLeay 0.51 not found.
Warning: prerequisite SOAP::Lite 0.67 not found.
Warning: prerequisite UUID 0.03 not found.
Writing Makefile for VIPerlToolkit

The warnings we see here are the packages we need to install in perl that are missing for the toolkit to work.

Installing missing perl dependencies

So now we need to setup CPAN unless you already have it working, then you can skip this step.

Is /usr/local setup?

By default cpan will try to install some documentation under the /usr/local folder, so this folder has to exist and it needs to have the correct ownership privileges setup. See if the folder already exists:

$ ls /usr/
X11		bin		lib		sbin		standalone
X11R6		include		libexec		share

In my case it isn't there yet, so create it:

$ mkdir /usr/local
mkdir: /usr/local: Permission denied

Ha!.. you can't create the folder unless you have elevated rights (of course)

$ sudo mkdir /usr/local
Password:

So now we create the folder, but as you will see its owned by root and we can't install our packages in there unless we allow our user.

$ ls -alh /usr/local
total 0
drwxr-xr-x   2 root  wheel    68B Feb 27 01:06 .
drwxr-xr-x@ 12 root  wheel   408B Feb 27 01:06 ..

In my case the username is "topaz", replace "topaz" with your username below:

$ sudo chown topaz:topaz /usr/local
$ ls -alh /usr/local
total 0
drwxr-xr-x   2 topaz topaz    68B Feb 27 01:06 .
drwxr-xr-x@ 12 topaz topaz   408B Feb 27 01:06 ..

Configure CPAN

With the developer tools setup now you have to configure CPAN. You can also use this step if you want to change your CPAN configuration. Configuring CPAN makes sure that the tools finds the necessary commands on your system (make et al). To do that, run:

perl -MCPAN -e shell
cpan> o conf init

This throws up a bunch of questions.

/Users/topaz/.cpan/CPAN/MyConfig.pm initialized.


CPAN is the world-wide archive of perl resources. It consists of about 100 sites that all replicate  the same contents all around the globe. Many countries have at least one CPAN site already. The  resources found on CPAN are easily accessible with the CPAN.pm module. If you want to use CPAN.pm, you have to configure it properly.

If you do not want to enter a dialog now, you can answer 'no' to this question and I'll try to autoconfigure. (Note: you can revisit this dialog anytime later by typing 'o conf init' at the cpan prompt.)

Are you ready for manual configuration? [yes]

You can take the defaults for pretty much all of them, so just press enter. It is fine if the configuration script doesn't find programs for things like lynx, wget, ncftp, ftp etcetera...

The main things to select are country to download from and the site(s) which you want to use for the repositories. Just make the most logical selections here.

Installing the VI Perl Toolkit dependencies

Now we'll get the missing dependencies by running them one by one. We could add all of these on a single line, but we want it to be easy to see if the install was successful so we are running them one by one.

cpan Class::MethodMaker

this should now end with:

Appending installation info to /Library/Perl/Updates/5.8.8/darwin-thread-multi-2level/perllocal.pod
 /usr/bin/make install  -- OK

So continue with the next one:

cpan Crypt::SSLeay 

Just choose the defaults if questions are asked. As long as it ends like the previous package you are fine.

Next up is:

cpan SOAP::Lite

Same same, choose defaults. In my setup it nagged that I missed out on some dependencies of its own and if I wanted to add those.. Sure.. let the installer add anything it suggests.

Finally:

cpan UUID

Which down here installed fine too, so now we can finally get back to installing the VI Perl Toolkit.

Install VI Perl Toolkit

Now go back to the folder where you unpacked the VI Perl Toolkit:

perl MakeFile.pl
Warning: prerequisite UUID 0.03 not found. We have 0.020.
Writing Makefile for VIPerlToolkit

That UUID is not yet version 0.03 seems to be OK With this version of the toolkit, there are no tests defined for the make file so install it directly:

sudo make install
Password:
Manifying blib/man3/VMware::VIM25Runtime.3pm
Manifying blib/man3/VMware::VIM2Stub.3pm
Manifying blib/man3/VMware::VIM25Stub.3pm
Manifying blib/man3/VMware::VIM2Runtime.3pm
Installing /Library/Perl/5.8.8/vmware-install.pl
Installing /Library/Perl/5.8.8/VMware/VICommon.pm
Installing /Library/Perl/5.8.8/VMware/VICredStore.pm
....
 many more lines here
....
Installing /usr/share/doc/vmware-viperl/doc/samples/vm/vmregister.pl
Installing /usr/share/doc/vmware-viperl/doc/samples/vm/vmunregister.pl
Installing /usr/share/doc/vmware-viperl/doc/samples/WSMan/checksensorhealth.pl
Installing /usr/share/doc/vmware-viperl/doc/samples/WSMan/firmwarerevisions.pl
Installing /usr/share/doc/vmware-viperl/doc/samples/WSMan/listfrus.pl
Installing /usr/share/doc/vmware-viperl/doc/samples/WSMan/listpowersupplies.pl

and that's how a successful Perl Toolkit install looks like.

If you want you can now delete your unpacked setup files and VI Perl tar.gz file.

Uninstall Developer Tools and cleaning up CPAN

If you want to uninstall the Developer Tools, you need to run the command:

/Developer/Library/uninstall-devtools --mode=all

From CPAN you can remove an installed module by running a clean command. Such as:

cpan clean Class::MethodMaker

This is sometimes needed if a module gets stuck while trying to install it.

If CPAN still gives problems, then you can remove your local CPAN configuration and cache directory by running:

rm -r ~/.cpan

External link

The following link turned out to be very helpful while I was trying to get this to work:

Managing VMware Infrastructure 3 (VI3) from OS X (10.5.1 Leopard)