Installing CPAN module without root access for Solaris OS

Manual Installation

In order to install CPAN modules without root access on Solaris OS, The following steps can be used:

1. Create lib/perl5 in your home directory (my prefer shell is bash so I change to bash)

 
> bash
$ pwd
/home/easkazi 
$ mkdir -p lib/perl5

2. Download/copy the CPAN module source from search.cpan.org and store them in the home directory e.g in CPAN directory.

$ mkdir CPAN
$ ls -ltr
Tk-ToolBar-0.12.tar.gz
Tk-804.034.tar.gz 
Tk-Splashscreen-1.0.tar.gz 

3. Unzip those CPANs by using the following command:

$ cd CPAN
$ tar -zxvf Tk-ToolBar-0.12.tar.gz
$ cd Tk-ToolBar-0.12

4. Install CPAN modules

 
$ /usr/perl5/bin/perlgcc Makefile.PL LIB=~/lib/perl5 PREFIX=~/lib/perl5
$ /usr/bin/gmake MAKE=/usr/bin/gmake
$ /usr/bin/gmake MAKE=/usr/bin/gmake test
$ /usr/bin/gmake MAKE=/usr/bin/gmake install

5. Add the new CPAN library so that Perl can find installed modules in the new library.

 
$ PERL5LIB=$PERL5LIB:/home/easkazi/lib/perl5
$ export PERL5LIB

The above is a temporary solution so when we log off and log on again to the system then shell prompt will not recognize that libraries. For this case, we have to add the following line in our scripts:


use lib '/home/easkazi/lib/perl5'

6. Ensure the CPAN module can be used by Perl

 
$ perl -e "use Tk::ToolBar"

The original source of this tutorial from http://twiki.org/cgi-bin/view/Codev/SolarisInstallCookbookPerlModules

Leave a Reply

Your email address will not be published. Required fields are marked *