Join 3,411 readers in helping fund MetaFilter (Hide)


Installing perl in a user folder
January 23, 2008 7:37 PM   Subscribe

Does anyone have any experience with or tips on installing Perl without root privileges?

The version of AIX I use at work has an old version of Perl (5.005) that is driving me nuts. Many of the 'core' modules are missing from the install. Occasionally I spend an evening or weekend putting together a perl script at home, only to find it won't run at work.

Our sysadmin doesn't have a lot of experience with Perl, and is a bit wary of installing a new version, particularly when a lot of overnight batch processing scripts are written in Perl, and he doesn't want to take the chance that something might break as a result of an upgrade (and I can't say I blame him).

I'm going to try installing Perl 5.8.8 at work in my own user folder. I've some experience installing Perl on my home system, but never without superuser privileges. Are there any things to be aware of, any 'gotchas', any tips that will make it easier, any things you wish you'd known before doing it? Is there any chance I could royally screw things up, even without being superuser?
posted by Ritchie to Computers & Internet (9 answers total)
 
Maybe you could try testing some of the overnight batch processing scripts on a box with a newer version of Perl? With an eye towards having him do the upgrade once he's confident they'll still function?
posted by JaredSeth at 7:46 PM on January 23, 2008


Are any of the batch scripts run from your home directory/account? If no, then I doubt you could screw anything up. As long as you don't have access to the system perl location, you should be okay.

Fink (OS X package manager) builds a relocated version of perl all the time. Looking through the build script, the only relevant line is this:

sh Configure -des -Dcc="gcc" -Dcpp="gcc -E" -Dprefix=%p -Dccflags=-I%p/include -Dldflags=-L%p/lib -Dperladmin=none -Uinstallusrbinperl -Dprivlib="%p/lib/perl5-core/5.8.8" -Darchlib="%p/lib/perl5-core/5.8.8/darwin-thread-multi-2level" -Dman3dir="%p/lib/perl5-core/5.8.8/man/man3" -Dman3ext=3pm -Duseithreads -Dinc_version_list="5.8.8/darwin-thread-multi-2level 5.8.6/darwin-thread-multi-2level 5.8.1 5.8.0 5.6.0" -Adefine:startperl="#!%p/bin/perl5.8.8"

Nothing tricky there. For Fink, %p becomes where the package will be finally located. So substitute appropriately. Obviously, don't call your arch directory "darwin-thread-multi-2level". Look at your current install and figure out what it should be.
posted by sbutler at 7:50 PM on January 23, 2008


if it's the lack of modules that's the problem rather than the version so much: you can use cpan to install the modules you need in local directories and they'll be available to any scripts you want to run.

(will require some configuration of both cpan settings and stuff like @INC paths, but it is fairly painless and in the end transparent)
posted by dorian at 8:06 PM on January 23, 2008


and yeah you can always build perl with a modified prefix setting as sbutler suggests, but this assumes your aix box has all the necessary build tools and libraries...
posted by dorian at 8:08 PM on January 23, 2008


Check the Configure script, I'm away on vacation/trip, but I've installed multiple local variations of Perl routinely. Not really a big deal once you get the hang of it. i.e.:
/usr/local/perl/5.8.0/bin/cpan -- installs modules for 5.8.0 perl.
/usr/local/perl/5.8.3/bin/perl -- runs junk under perl 5.8.3 (only with modules for 5.8.3 install)

You can make later versions use modules from older installs if you like. Search Perl Monks or email me later in the week. It's always been pretty easy to have many local (even just in my home directory) installs of Perl. Can't really think of any gotchas.
posted by zengargoyle at 3:31 AM on January 24, 2008


If you want to build and install XXX in your own home directory, usually what you do is run ./configure with the prefix flag set to the directory you want the files to end up in. I usually create a subfolder called local in my home directory and install everything there -- i.e. ./configure --prefix=/home/yourname/local; make; make install.

This assumes you have build tools on your box.
posted by chunking express at 6:32 AM on January 24, 2008


Adding to what chunking express said:

I do pretty much this on some boxes I maintain, since for specific maintenance reasons we want the Fedora-packaged perl for system processes and our own perl for our CGIs. In this case the system perl is at /usr/bin/perl and ours is in /usr/local/bin/perl. The only "tricks" to this are that you have to set the prefix when you configure (as given above) and then set your own path so that the path to the one you want is searched first.

If the build environment doesn't work you could just install that (gcc, etc.) first, also into ~/local . I'm a fan of getting a bigger hammer when necessary, and if you put everything under ~/local you don't have to worry about conflicts with system binaries (or need to be root to update things as you see fit). You can undo, redo, and trash the entire ~/local tree to your heart's content, and the system binaries will remain untouched.

Two more possibly relevant comments: (1) I hope your sysadmin will seek more familiarity with perl, as it's a very useful thing. I understand his fear of regression bugs, but you'll never know what will break until somebody actually tries it, and (2) perl 5.10.0 is out now. If you desire 5.8.8 and not 5.10.0 you might have some issues with cpan if you, say, do an autobundle install ('module foo is part of the perl-5.10.0 package and can't be updated without blah blah blah' -- I forget the exact wording of the messages I was getting this weekend as I rebuilt one of my own boxes). I know there's a way around those messages, but I didn't look into what it was.
posted by fedward at 10:01 AM on January 24, 2008


lots of new modules won't work with perl 5.005 which really is ancient, wow. Compiling perl as a user is fine in other unixes, but given my slightly hairy experience getting a copy of git working on a locked down solaris box with no root, I'm reluctant to say it will be straightforward. One solution might be for someone to compile you a (statictically linked?) perl on another AIX box and copy it over.
posted by singingfish at 12:18 PM on January 24, 2008


Thanks everyone, the install went without incident. I ended up installing in my own directory, as /usr/local is off-limits to me. For anyone else wishing to do this, the steps are as follows:

gzip -dc perl-5.8.8.tar.gz | tar xvf -
cd perl-5.8.8
sh Configure -de -Dprefix=/home/users/foo/perl
make
make test && make install


... where foo is your username, of course.

I haven't bothered installing any modules yet, although DBI and DBD::Oracle will be a high priority. I'm just rejoicing in having an up-to-date Perl!
posted by Ritchie at 6:02 PM on January 28, 2008


« Older Is there a word for: expecting...   |  Help me think in terms of prog... Newer »
This thread is closed to new comments.