I recently put up an article on my technical blog (brainbuz.org/techinfo).
Here's the cut and paste:
Installing an Alternate Perl with perlbrew
.... put a current Perl at /usr/bin/perl5. I prefer this solution to the env
perl approach many others have chosen. It does require that for your scripts
you change the #! line by appending the 5, but it is much easier to append a 5
to the line than remember where your alternate perl is buried in the file
system (for scripts run outside your environment).
To begin, you’ll need to fire up your system CPAN for its first and only ever
run. But even before that you may need to install a few things like gcc. On
ubuntu it is as simple as (sudo) apt-get install build-essential. You also need
to decide which user is going to maintain perlbrew, it is not unreasonable to
choose root, it is also quite reasonable to choose a different user.
(sudo) cpan App:perlbrew
Say yes to installing dependincies 89 times. There are two tricks you can use
to make this a little easier: install App::cpanminus first, it has fewer
dependencies and can install perlbrew quietly, alternately Ubuntu Oneric has a
perlbrew package, install it and then use perlbrew’s self update option.
If installation of perlbew fails, open up a cpan session and type
force notest install App::perlbrew.
>From this point onwards we consider ourselfs to have 2 perls, our real Perl
>(perl5) the system perl which we will never touch, but which is a dependency
>for packages needing perl we might have installed.
export PERLBREW_ROOT=/opt/perlbrew
(/usr/perlbrew and /usr/local/perlbrew are also good choices)
perlbrew init
/opt/perlbrew/bin/perlbrew available
/opt/perlbrew/bin/perlbrew install
Using Perl 5.14.1 as an example, type the following two lines
ln /opt/perlbrew/perls/perl-5.14.1/bin/perl /usr/bin/perl5
ln /opt/perlbrew/perls/perl-5.14.1/bin/perl5.14.1 /usr/bin/perl5.14.1
This will make Perl5.14.1 your default perl5, and it will give you a specific
alias to perl5.14.1 if in the future you need to invoke it specifically you can
type perl5.14.1 from anywhere without having to remember the full path.
Install cpanminus
Now that you have your new perl installed, even though perlbrew has an option
to do this I recommend using the cpan in your new perlbrew directory. ./cpan
App::cpanminus, configure cpan and answer the prompts.
When this is done go to /usr/bin, if you don’t have links there for cpan and
cpanm copy them from your new perl’s directory, if you do, they’re just
wrappers, edit the #! line to /usr/bin/perl5, so that if in the future you have
a newer perl5, you won’t need to touch them.
Special case: Padre.
Padre requires a multi-threaded Perl, Perlbrew does not build a multi-threaded
Perl by default. I update Padre about once a month. You have a two choices, you
can tell Perlbrew to build a threaded Perl, or you can leave Padre on your
system Perl, which means that you need to make sure that you update it in your
system Perl, not your real Perl. If you don’t want a threaded perl a third
option would be to build a special threaded perl for Padre (but as long as it
works with system perl, why bother?).
/opt/perlbrew/bin/perlbrew install \
perl-5.xx.x -Dusethreads -Duselargefiles \
-Dcccdlflags=-fPIC -Doptimize=-O2 \
-Duseshrplib -Dcf_by="Your_name_here" \
-Dcf_email="Your_email@here"
-----Original Message-----
From: Dermot [mailto:[email protected]]
Sent: Friday, September 30, 2011 10:39 AM
To: The elegant MVC web framework
Subject: [Catalyst] How best not to use the system perl
Hi,
I have got a new server that I want to put into production. To comply with the
manufacturer, I have installed RedHat 6.1 on it. Up till now we have used
Debian based machines and have been using the system perl. That worked ok
because all the necessay libperl*.deb could be installed via the package
manager. That's not an option with yum. I know using the system perl is frowned
upon by some so I'd like to do the right thing before the server is deployed.
AFAIK, there are two options; 1) install a perl from source into somewhere like
/usr/local and set-up the environment so that's the perl that's used or 2) use
the system perl (5.10.1) and local::lib. I'm sure there are others with my
hardware set-up and I'd be interested in hearing what approached they've taken.
Similarly if there are other options to consider or there are strong reasons
for using one approach over an other, I'd appreciate hearing them.
Thanks,
Dermot.
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/