Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

A while ago I decided to investigate some of the newer goodies available in perl. Specifically, I wanted to look at Catalyst and Padre. In that I work with RedHat/CentOS at $job I wanted things to run on RedHat/CentOS (version 5 to be exact).

Historically I've stuck with using rpms to install maintain all the packages on my boxes. For those packages that either come with the distribution or are available through EPEL this works well. For packages that:

    a) are not available through the distribution or EPEL, and
    b) have few dependencies not covered by a) then cpanspec fills in the gap nicely.

This approach doesn't work when trying to install something like Catalyst so I decided that it was time to install a newer local installation of perl.

While I've read multiple times recommending installation of a separate perl than the system supplied one I have yet to read where anyone layed out how they went about it.

My requirements were that:

    a) the local install could not be owned by root as I did not want to risk messing up the perl install that came with the system,
    b) the install could not be under /home as it would likely be used by more than one user, and
    c) any scripts written have to work under the default bash shell.
So, my approach was/is as follows. Hopefully it is of use to someone. Comments are (probably) most welcome.

1. Logon as the non-root owner of the installation

2. Create the installation directory

Since one of my requirements is to not install under /home, and as the other oddball installs are already under /opt, I decided to install under /opt (rather than /usr/local).

TEMP_FILE=`mktemp -p $HOME` cat <<EOT> $TEMP_FILE /bin/mkdir -p /opt/perl/ /bin/chown $USER.$USER /opt/perl EOT su -c "sh $TEMP_FILE" rm $TEMP_FILE

3. Create an environment script for the local install

cat <<'EOT'> /opt/perl/perl_profile.sh #!/bin/sh PERL_VER=5.10.1 export PERL_VER PERL_BASE=/opt/perl export PERL_BASE PERL_HOME=$PERL_BASE/current export PERL_HOME # ensure that the local perl is at the front of the path, but don't # add it again if it is already there. ( echo $PATH | grep "^$PERL_HOME" > /dev/null ) || PATH=$PERL_HOME/bin +:$PATH export PATH EOT chmod 755 /opt/perl/perl_profile.sh

4. Perform the local install

Note that in order to get threads working (needed for Padre) I resorted to lifting the compile arguments from the perl source rpm and adjusted to my needs/liking.

Also note that, since this installation is not done as root, it can not (to my knowlege) support setuid.

. /opt/perl/perl_profile.sh mkdir $PERL_HOME mkdir $PERL_BASE/install cd $PERL_BASE/install wget http://search.cpan.org/CPAN/authors/id/D/DA/DAPM/perl-${PERL_VER} +.tar.gz tar -xzf perl-${PERL_VER}.tar.gz ( cd perl-${PERL_VER} # NOTES: # - Configure parameters shamelessly derived from the vendor per +l.spec # file and the output of `perl -V` # - suid is disabled as we are not installing as root UNAME_I=`uname -i` UNAME_S=`uname -s | tr [A-Z] [a-z]` sh Configure -des \ -Doptimize="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 \ -fexceptions -fstack-protector --param=ssp-buffer-size=4 \ -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tabl +es" \ -Dversion=${PERL_VER} \ -Dmyhostname=localhost \ -Dperladmin=root@localhost \ -Dcc=gcc \ -Dinstallprefix=${PERL_HOME} \ -Dprefix=${PERL_HOME} \ -Darchname=${UNAME_I}-${UNAME_S} \ -Dvendorprefix=${PERL_HOME} \ -Dsiteprefix=${PERL_HOME} \ -Duseshrplib \ -Dusethreads \ -Duseithreads \ -Duselargefiles \ -Ud_dosuid \ -Dd_semctl_semun \ -Di_db \ -Ui_ndbm \ -Di_gdbm \ -Di_shadow \ -Di_syslog \ -Dman3ext=3pm \ -Duseperlio \ -Dinstallusrbinperl=n \ -Ubincompat5005 \ -Uversiononly \ -Dpager='/usr/bin/less -isr' \ -D/opt/perld_gethostent_r_proto -Ud_endhostent_r_proto \ -Ud_sethostent_r_proto \ -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto \ -Ud_endservent_r_proto -Ud_setservent_r_proto \ -Dinc_version_list=${PERL_VER} \ -Dscriptdir=${PERL_HOME}/bin make && make test && make install )

In reply to RFC: Installing perl on CentOS/RedHat by gsiems

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-25 08:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found