« Software review: Hamachi | Main | APT NO_PUBKEY error »

décembre 31, 2005

CPAN.pm on OpenSlug

Dring the holidays, I installed and run BackupPC on a Linksys NSLU2. The result was too slow (too little RAM, too much swapping) to be useful -- backups would take five times longer than with a PC with enough RAM.

However, I learned a few tricks along the way. The most interesting of them is how to run CPAN.pm on the SLUG.

Installing and configuring OpenSlug

The first thing is to install OpenSlug. The documentation is pretty clear, so I won't rewrite it. Just take a look at it and come back here when you're at step 8 of Initialising OpenSlug.

OpenSlug uses ipkg, which is similar to apt on Debian. The first thing to do is to update your slug.

ipkg update
ipkg upgrade

I personally can't live without screen, sudo and nano and I'm using them to install CPAN so it might be a good idea to do the same.

ikpg install screen sudo nano

Installing perl

Now with the real thing! We start by installing perl.

ipkg install perl perl-dev perl-misc perl-modules

Unlike other distros, OpenSlug has packaged every single perl module in its own package, so don't be surprised to see a gazillion packages being installed.

Installing CPAN

A lot of CPAN modules need a compiler. So we'll need to install a native compilation environment.

There are two ways to do this, the full blown one is to install openslug-native, which will install all sorts of utilities for application developement.

ipkg install openslug-native

However, openslug-native installs some packages that you don't need (python for example), so if you want to install less packages, you can only install those:

ipkg install gcc gcc-symlinks make binutils libc6-dev coreutils libexpat-dev

Install ccache

Lots of perl modules want ccache to compile properly. At the time, it's not available as a ipkg package, so you'll need to compile it. It's available at http://ccache.samba.org/

wget http://ccache.samba.org/ftp/ccache/ccache-2.4.tar.gz
tar zxvf http://ccache.samba.org/ftp/ccache/ccache-2.4.tar.gz
cd ccache-2.4
make install


Any perl installation wouldn't be complete without CPAN. And since the version of perl included in OpenSlug is particularly thin, CPAN can be used to make it a little more healty.

When I first wrote this article, the version of CPAN that's included with OpenSlug did not work. I sent a patch to the author (Andreas Koenig) and it has been included in version 1.81. Go take a look on the CPAN site and download the lastest version of CPAN.

tar zxvf CPAN-1.83.tar.gz
cd CPAN-1.83/
perl Makefile.PL
make test
make install


Once CPAN is intalled, you should be able to use it to install a good dose of packages. If you haven't done so already, opening a screen by typing screen would be a good idea. This should take quite a long time -- a couple hours. When entering CPAN, it will ask for some configurations, it would be a good idea to set the Policy on building prerequisites to follow.

perl -MCPAN -e shell
install Bundle::libnet
reload cpan
install Bundle::CPAN

Congratulations, you now have CPAN, and all the power of perl modules, on your slug.

Posted by gfk at décembre 31, 2005 11:43 AM


Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Remember me?