Install Perl from source

From CobaltFAQs

Jump to: navigation, search

One of the classic "gotchas" of adding Perl-based software to RaQs and Qubes is that many packages (most commonly SpamAssassin) require a newer version of Perl than Cobalt supplies. However, doing a straight upgrade of /usr/bin/perl often breaks the GUI. There are two ways to work around this: Installing a second copy of Perl, or updating Perl and adding required modules.

Installing a second Perl

If you choose to install an up to date Perl into an alternate path, like /usr/local/bin/perl, you can then install all other modules needed for your software using /usr/local/bin/perl Makefile.PL instead of perl Makefile.PL.

Doing this with CPAN, however, is a prescription for screwing up your Cobalt unless you are remarkably careful and able to recover unexpected changes. Following the clue Steve Werby posted on the cobaltfacts list, we can walk through that here.

First you need to download the Perl source.

# wget

Undo this with tar -xzvf stable.tar.gz and cd into the new Perl directory created by the unpacking. Inside that directory, type this:

perl-5.8.0# ./configure.gnu --prefix=/usr/local

Once this is done, you should be able to go on with the install using make and make install as usual for perl. There's only one more step, once this is all done.

Your standard Cobalt perl install is still at /usr/bin/perl5.00503 and your new Perl 5.8 will be at /usr/local/bin/perl. However, our install has probably also put a symbolic link at /usr/bin/perl pointing to /usr/local/bin/perl!

cd to /usr/bin and give these commands (don't panic):

bin# ls -l perl*  # Notice the new symlink
bin# rm perl
bin# ln -s perl5.00503 perl
bin# ls -l perl*

What you've done is remove the incorrect symlink and put in a correct one to the "correct" perl (verify with the ls -l perl* that the Cobalt one is at perl5.00503).

If you've really munged your perl, you'll have to re-install from the Cobalt RPM.

Note that once you have this "alternate Perl" installed, you can use CPAN through this perl binary to update modules, etc.. Just be careful to invoke CPAN as /usr/local/bin/perl -MCPAN -e shell rather than perl -MCPAN -e shell.

Updating Perl and adding Cobalt modules


Personal tools