Tuesday, January 24, 2006

Installing Perl Modules in FreeBSD

I needed the following modules to be installed

Digest::SHA1
Digest::HMAC

Net::DNS
Time::HiRes
HTML::Tagset
HTML::Parser

Pod::Usage
Parse::Syslog
Statistics::Distributions

There are 3 main ways of doing it

1. The old fashioned way (CPAN) - Go to http://www.cpan.org, download the needed module, read the "INSTALL" file and away you go.

2. Using the pkg_add utility - This is the best method because the pkg_add utility AUTOMATICALLY installs any dependencies that may be needed for these Perl modules to be installed. This saves lots of time and hassle.

As root, run the following commands:

pkg_add -r p5-Time-HiRes
pkg_add -r p5-Net-DNS
pkg_add -r p5-Digest-SHA1
pkg_add -r p5-Digest-HMAC
pkg_add -r p5-HTML-Tagset
pkg_add -r p5-HTML-Parser
pkg_add -r p5-Parse-Syslog
pkg_add -r p5-Pod-Parser
pkg_add -r p5-Statistics-Distributions

3. The easy way (The Ports Collection) - The Freebsd ports collection has made a lazy man out of me. They make all this crap so easy.

On my server, I found the needed ports in the following locations:

Time::HiRes - /usr/ports/devel/p5-Time-HiRes
Net::DNS - /usr/ports/dns/p5-Net-DNS
Digest::SHA1 - /usr/ports/security/p5-Digest-SHA1
Digest::HMAC - /usr/ports/security/p5-Digest-HMAC
HTML-Tagset - /usr/ports/www/p5-HTML-Tagset
HTML::Parser - /usr/ports/www/p5-HTML-Parser
Pod::Usage - /usr/ports/textproc/p5-PodParser
Parse::Syslog - /usr/ports/textproc/p5-Parse-Syslog
Statistics::Distributions - /usr/ports/math/p5-Statistics-Distributions

Simply cd into each packages directory as shown above and run: make install && make clean

Note: If you find that the directory "/usr/ports" does not exist, it means you don't have the ports collection. You can get the latest Freebsd ports tree at ftp://ftp.freebsd.org/pub/FreeBSD/ports/ports/ports.tar.gz (anonymous login)

Damn! Now wasn't that easy?

No comments: