Installing Perl modules for Linux and Win32
If you are a hosting company or running your own
server. You've probably discovered that many Perl modules
that are required by scripts do not come installed by default.
Installing Perl modules is VERY easy if you know how to
do it. So here is a quick guide:-
Suggested modules to install
Installing modules the old fashioned way
The easiest way to install Perl modules on Linux is by
using the CPAN module. Login to your server by SSH or Telnet
as root. Then type:-
perl -MCPAN -e shell;
If this is the first time you have used this method
then you will need to answer a few configuration questions.
Make sure you answer these correctly (usually just do what
it suggests). If it suggests 'yes' then type 'yes' not 'y'
or 'return'. If it offers automatic config then go for it.
From now all you have to do to install Perl modules is type:-
From the CPAN shell. The CPAN module will do all the installing
for you. Most usefully it'll install any dependencies. So
if a module requires others in able to work, installing
perl modules this way will install them all for you. This
can save a lot of time. Note that this method always tests
a module before installing. Some modules will pass most
tests and fail on some because the module is old but still
working perfectly well. If this is the case, for example
with the LWP module, you must force the install by typing:-
force install LWP
Installing Perl modules in windows is easy. Just open the
command prompt and type:-
This will open the Perl Package Manager. From here you can
install perl modules simply by typing:-
modules to install
From time to time you'll need to install or update new
perl modules. Here is a list of common modules that you'll
probably want to install at some point. Get them done now
and you'll save time later. It only takes 2 minutes using
the methods above! (Note. if installing on windows, swap
:: in module names for - to make DBD-mysql).
the old fashioned way
For whatever reason you may find the need to install a module without using
the CPAN module. Here is what to do in a nice ordered list:-
- Visit CPAN.org
and search for the module you require, such as DBI.
- Select the correct module from the search results.
- The next page you see provides a summary for information
about the module. In the top (ish) left is a download
link for the module.
- Select the download link and save the file. If you are
in SSH then type "wget http://www.urltodownload.com".
- Continue to ungzip and untar the file to a temp folder.
"gzip -d downloadedfile.tar.gz"
then "tar xvf downloadedfile.tar".
- Change directory into the folder that was created when
you untared. This folder will have the same name as the
downloaded file without an extension. "cd
- To create the makefile type "perl
- Now run the standard "make"
followed by "make test"
and finally "make install".
You may find that you need to install additional modules
before others will install.