Installing all prerequisite modules without being root.
Prerequisites:
* a new user account, here "teensy".
* gcc needs to be installed
* Multipool.pl (to test it works)
First, we fetch "cpanm", best practice Perl module installer:
teensy:~$ curl -L http://cpanmin.us > cpanm 2>/dev/null
teensy:~$ chmod +x cpanm
We will then install the prerequisites under the current directory's "lib" subdirectory. This is done via the parameter "-l lib" to cpanm:
teensy:~$ ./cpanm -l lib JSON::RPC::Client
--> Working on JSON::RPC::Client
Fetching http://search.cpan.org/CPAN/authors/id/M/MA/MAKAMAKA/JSON-RPC-0.96.tar.gz ... OK
Configuring JSON-RPC-0.96 ... OK
Building and testing JSON-RPC-0.96 ... OK
Successfully installed JSON-RPC-0.96
1 distribution installed
Finance::Bitcoin is a signed package, we need to make sure we have the right signature or it will hang and cause grief.
teensy:~$ gpg --recv-keys --keyserver keyserver.ubuntu.com 6A2A7D39
gpg: directory `/home/teensy/.gnupg' created
gpg: new configuration file `/home/teensy/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/teensy/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/teensy/.gnupg/secring.gpg' created
gpg: keyring `/home/teensy/.gnupg/pubring.gpg' created
gpg: requesting key 6A2A7D39 from hkp server keyserver.ubuntu.com
gpg: /home/teensy/.gnupg/trustdb.gpg: trustdb created
gpg: key 6A2A7D39: public key "Toby Inkster " imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
Once the key has been imported, we can install it:
teensy:~$ ./cpanm -l lib Finance::Bitcoin
--> Working on Finance::Bitcoin
Fetching http://search.cpan.org/CPAN/authors/id/T/TO/TOBYINK/Finance-Bitcoin-0.002.tar.gz ... OK
Configuring Finance-Bitcoin-0.002 ... OK
Building and testing Finance-Bitcoin-0.002 ... OK
Successfully installed Finance-Bitcoin-0.002
1 distribution installed
Last prerequisite:
teensy:~$ ./cpanm -l lib Math::Integral::Romberg
--> Working on Math::Integral::Romberg
Fetching http://search.cpan.org/CPAN/authors/id/B/BO/BOESCH/Math-Integral-Romberg-0.04.tar.gz ... OK
Configuring Math-Integral-Romberg-0.04 ... OK
Building and testing Math-Integral-Romberg-0.04 ... FAIL
! Installing Math::Integral::Romberg failed. See /home/teensy/.cpanm/build.log for details.
It will fail, at least it did for me.. as it tried to install it under /usr/. Bad boy, no cookie!
Since it's a pure-Perl module, we and it _did_ pass the tests (run cpanm with -v if you don't believe it), just copy the module over to the local lib:
teensy:~$ cp -Rfv ~/.cpanm/latest-build/Math-Integral-Romberg-0.04/blib/lib/* lib/lib/perl5/
`/home/teensy/.cpanm/latest-build/Math-Integral-Romberg-0.04/blib/lib/Math' -> `lib/lib/perl5/Math'
`/home/teensy/.cpanm/latest-build/Math-Integral-Romberg-0.04/blib/lib/Math/Integral' -> `lib/lib/perl5/Math/Integral'
`/home/teensy/.cpanm/latest-build/Math-Integral-Romberg-0.04/blib/lib/Math/Integral/Romberg.pm' -> `lib/lib/perl5/Math/Integral/Romberg.pm'
We are almost set; we need to know which PERL5LIB to use when launching Multipool.pl.
Check the subdirectories of lib/lib/perl5 for the architecture-specific subdirectory:
teensy:~$ ls lib/lib/perl5/
Finance JSON JSONRPC.pm Math x86_64-linux-gnu-thread-multi
In this case, mine is "x86_64-linux-gnu-thread-multi".
The environment var PERL5LIB needs to be set to _both_ lib/lib/perl5 _and_ the architecture-specific path.
Once that's done, we can use "perl -c" to ensure no other dependencies are needed:
teensy:~$ PERL5LIB="lib/lib/perl5/x86_64-linux-gnu-thread-multi:lib/lib/perl5" perl -c Multipool.pl
Multipool.pl syntax OK
You can either launch Multipool.pl that way, or amend Multipool.pl to have the correct "use lib" on the line under the line which reads "use strict;":
use strict;
use lib 'lib/lib/perl5', 'lib/lib/perl5/x86_64-linux-gnu-thread-multi';
Use your architecture-specific subdirectory, of course.
Happy hopping!