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:
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:
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
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
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 )
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: RFC: Installing perl on CentOS/RedHat
by proceng (Scribe) on Oct 07, 2009 at 04:02 UTC | |
by gsiems (Deacon) on Oct 07, 2009 at 11:36 UTC |