Installing Perl Modules as Non-Root User

By | April 17, 2008

I wanted to install the Perl scripts for o2sms on my new webfaction account and ran into a problem. I’ve not got root so the cpan install was going to complain when it tried to install to the default directory /usr/bin. I needed to figure out how to install o2sms and the associated modules (Crypt:SSLeay, XML::Parser etc.) as a non-root user.

I started off downloading modules and running through a manual install with perl Makefile.PL PREFIX=/home/sneely/perl; make; make test; make install but that turned out to be too slow. So I figured out the fast way with cpan:

  1. set PERL5LIB and PERLLIB environmental variables to point at ~/perl/lib (or where ever you’re going to put your libraries — I needed to add site_perl/lib too
  2. run the cpan installer. The cpan executable wasn’t available so I ran perl -MCPAN -e shell
  3. follow the instructions to configure cpan (pretty much accept all the defaults)
  4. add ~/perl/bin to your PATH
  5. run cpan and install Bundle::CPAN WWW::SMS::IE::iesms

That was pretty much it. I had to run cpan a couple of times to update and install things like Crypt:SSLeay but now o2sms is up and running fine.

Of course later I find a page with more details on install perl modules as a non-root user.