There are various ways to download and install perl modules from CPAN. In general it’s a good idea to download and install the perl module but we will see the different ways of installing the perl module.
1. The easiest way is to use the perl CPAN module. SSH to the server as root and execute:
if you are running this for the first time, it will prompt you for a few questions (default answers are fine) before providing you with the “cpan >” prompt. To install a module, say for example “Perl::OSType”, execute
cpan > install Perl::OSType
this will download and compile the module and install it server wide. To know more commands/options of cpan, type question mark ( ? ) at the cpan prompt.
2. The second and the quickest method is to use perl CPAN module from the bash prompt instead of ‘cpan’ prompt. If you are on the command line of Linux, just execute
# perl -MCPAN -e 'install Perl::OSType'
3. The above 2 methods are the easiest one but it is recommended to install the module manually as the above methods may not always work. You can search the module at http://search.cpan.org/ and then wget it on your server. Once done, extract it:
# tar -zxf Perl-OSType-1.002.tar.gz
There is a standard way of installing the perl module, however, you will see a README file inside the extracted directory containing the installation steps. Goto the extracted directory and execute
# perl Makefile.PL # make # make test # make install
That is it.}