Skip to content

Instantly share code, notes, and snippets.

@Getty
Created March 17, 2015 05:43
Show Gist options
  • Save Getty/afa507175721e731dde8 to your computer and use it in GitHub Desktop.
Save Getty/afa507175721e731dde8 to your computer and use it in GitHub Desktop.
Installed via:
./Configure -des -Dprefix=/opt/perl
or:
Try out my https://metacpan.org/pod/installto ;) (which generates the export.sh)
Be sure to install local::lib and cpanm into this Perl
root@executor /opt/perl # ls -al
total 28K
drwxr-xr-x 6 root root 4.0K Nov 30 01:13 .
drwxr-xr-x 5 root root 4.0K Dec 20 05:21 ..
drwxr-xr-x 2 root root 4.0K Nov 30 01:11 bin
-rw-r--r-- 1 root root 584 Nov 30 01:11 export.sh
drwxr-xr-x 4 root root 4.0K Nov 30 01:02 lib
drwxr-xr-x 5 root root 4.0K Nov 30 01:16 local
drwxr-xr-x 4 root root 4.0K Nov 30 01:02 man
root@executor /opt/perl # cat export.sh
#!/bin/sh
export PATH="/opt/perl/bin:$PATH"
export LD_LIBRARY_PATH="/opt/perl/lib:$LD_LIBRARY_PATH"
export C_INCLUDE_PATH="/opt/perl/include:$C_INCLUDE_PATH"
export MANPATH="/opt/perl/man:$MANPATH"
PATH="/opt/perl/local/bin${PATH+:}${PATH}"; export PATH;
PERL5LIB="/opt/perl/local/lib/perl5${PERL5LIB+:}${PERL5LIB}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="/opt/perl/local${PERL_LOCAL_LIB_ROOT+:}${PERL_LOCAL_LIB_ROOT}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"/opt/perl/local\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/opt/perl/local"; export PERL_MM_OPT;
This could be added to the .bashrc of the users to make it available on logon:
#
# insert system perl 5.20.1
#
source /opt/perl/export.sh
Additionally i would suggest making it so that another local::lib is used by the users to give them the ability to install in their home, so just add this to the .bashrc of them:
eval $( perl -Mlocal::lib )
Then they can automatically install new perl modules in their home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment