Installing Perl Modules as a non-root user in one's homedir

The problem, as identified: there wasn't an xhier package for a particular set of modules; and a user would like to take advantage of these modules for a program running on cscf.cs.

Perl will load a library or set of libraries from any arbitrary directory, such as a subdirectory of your home directory.

This guide assumes you're working on cscf.cs or services108.cs. On other hosts, you will possibly need to modify some configuration settings, as described below.

1) run at the command-line: 'cpan'. It will ask you if you want to config manually. hit ctrl-C to break out to the command-line.

2) cp ~drallen/.cpan/CPAN/MyConfig.pm ~/.cpan/CPAN/MyConfig.pm [or download from below link]

3) in ~/.cpan/CPAN/MyConfig.pm, edit the homedir from drallen to yours (either from /u1/drallen or /u4/drallen, depending on whether you were on cscf or services108)

3a) if you are not on cscf.cs or services108.cs: you may need to modify the config file to identify where the specified unix commands are found (such as for wget: 'wget' => q[/software/.admin/bins/bin/wget ). As a first step, you can try running with this configuration; but if it complains it cannot find 'ftp' or 'wget', you will want to run absolute [commandname] for each command in the configuration file and replace inside the brackets.

4) back at the command-line: run 'cpan'.

5) type install Unicode::Map8

6) It will pause and ask you if you also want to install Unicode::String. Hit return for yes. (It will recursively install all necessary sub-modules that are not installed and available).

7) when it's finished (hopefully with no fatal errors), type 'quit' 7a) if there are fatal errors, read them well; perl module writers sometimes provide good hints for fixing. If not, try googling the error.

8) from the command-line type:

perl -e 'use lib "/u1/drallen/lib/perl5"; use Unicode::Map8'

this should run with no errors. This means you've got an installed library; scripts to use this library will need to include near the top:

use lib "/u1/drallen/lib/perl5";

or setting the PERL5LIB environment variable in the shell before the script runs. (It should be set to "/u1/drallen/lib/perl5" as above).

This, in effect, is installing the perl libraries and files into subdirs in your homedir. You can customize other destinations for the libraries by editing the CPAN configs; see: http://search.cpan.org/~andk/CPAN-1.9205/lib/CPAN.pm#FAQ http://sial.org/howto/perl/life-with-cpan/non-root/

for more notes (which I tried to summarize here).

-- DanielAllen - 06 Oct 2008

  • MyConfig.pm: MyConfig.pm CPAN Configuration File for services108.cs

Topic attachments
I Attachment Action Size Date Who Comment
Perl source code filepm MyConfig-cscf.cs.pm manage 1.5 K 2008-10-06 - 17:46 DanielAllen MyConfig.pm CPAN Configuration File for cscf.cs
Perl source code filepm MyConfig.pm manage 1.5 K 2008-10-06 - 17:43 DanielAllen MyConfig.pm CPAN Configuration File for services108.cs
Topic revision: r1 - 2008-10-06 - DanielAllen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback