CPAN (Comprehensive Perl Archive Network) is a large repository of Perl modules, and it’s officially supported by Perl Community. Standard Perl already has many CPAN libraries installed from birth, but usually you have to install a few extra Perl modules, so that you can benefit from their new features, or fix some dependency issues like below:
$ sudo rpm -ivh vzdump-1.2-5.noarch.rpm error: Failed dependencies: perl(LockFile::Simple) is needed by vzdump-1.2-5.noarch
This guide tells you very commons ways to install CPAN modules.
For building the CPAN modules from sources it is assumed that you have a fully working Perl and C development environment (including a C compiler and make tool). This is not required if you install the libraries from pre-compiled packages.
1. Install CPAN module from source code
You can find the right package here at search.cpan.org, and the download link is always available on the top right side.
$ tar zxvf LockFile-Simple-0.207.tar.gz
Then change your working directory to the source code directory, and start compiling it like this:
$ perl Makefile.PL $ make
The first command will generate a “Makefile“, and the second one will do the real work. Finally you can install the compiled modules now (before that you can run a test first):
$ make test $ sudo make install
2. An alternative way is using CPAN module
The installation itself can be simpilized to one command like below:
perl -MCPAN -e 'install LockFile::Simple;'
Or you can divide this command into some steps, like:
[root@vz-ms ~]# perl -MCPAN -e shell CPAN> i /LockFile::Simple/ CPAN> install LockFile::Simple CPAN> exit
If you have multiple Perls installed on your system, this post on perlmonks might be helpful for you. If any issues occured during the installation, please dont hesitate to ask a question here at our support forum.