Dual-license your content for inclusion in The Perl 5 Wiki using this HOWTO, or join us for a chat on irc.freenode.net#PerlNet.
Installing Perl Modules on Linux
From PerlNet
This information was initially culled from the Melbourne Perl Mongers mailing list based on comments by Paul Fenwick, Matthew Robertson, Daniel Pittman, and others.
Using the package management tools included with your Linux distribution is nearly always the recommended solution in preference to installing via the CPAN shell.
Package tools help ensure that:
- C library and other non-CPAN dependencies are resolved correctly
- existing packages that rely on CPAN modules will not install conflicting versions
- there is a single tool for admins to check what packages have been installed on a system
Most distributions will already include packages for popular CPAN modules. The information below provides some pointers on how to create packages for newer module versions (or ones that aren't yet packaged in your Linux distribution).
APT package management (i.e. Debian, Knoppix, Ubuntu, ..)
Building an apt package from CPAN is usually as simple as:
dh-make-perl --build --cpan Example::Module
You can change --build to --install if you want to install the module after the package is built.
If you don't have dh-make-perl installed, you can do so using:
apt-get install dh-make-perl
The package file created will have a ".deb" extension, for example:
libwww-perl_5.805-1_all.deb
To install the generated .deb package use:
dpkg -i packagename.deb
For more information see Building Debian packages of Perl modules.
Portage package management (i.e. Gentoo)
To find or create a Gentoo package for a CPAN module, use:
g-cpan -i <Example::Module>
If a package isn't found, g-cpan will fetch the current CPAN version of the requested module and create a Gentoo package, then install the package into the dependency tree.
For more information see the g-cpan Guide in the Gentoo documentation.
RPM package management (i.e. Redhat, Fedora, CentOS, Yellow Dog. ...)
To create an RPM package for a CPAN module, use:
cpan2rpm Example::Module /tmp/Example-Module.tar.gz
You may find that cpan2rpm occasionally needs a bit of a helping hand; for example, you may need to run with debug options to allow terminal interaction during the build process. In general this program does a great job of spitting out an RPM from an arbitrary CPAN module.
For more information visit the cpan2rpm project home page or refer to the cpan2pm man page.

