Monday 18 August 2014

Perl installation on Linux

Perl installation on Linux/Unix

Lets install Perl in an easy way. Go through the below given steps to install Perl on Linux/Unix platforms.

(1) Download Perl using the URL provided below.

wget http://www.cpan.org/src/5.0/perl-5.8.9.tar.gz

(2) Now, we need to extract the download tar.gz file

 tar -xzf perl-5.8.9.tar.gz

(3) Once its done, just move( cd..) into the extracted file

cd perl-5.8.9

(4) Now the actual installation part starts.

./Configure -des -Dprefix=<path_to_perl_install_dir> -Dotherlibdirs=<default_path_to_search_for_perl_modules> -A ccflags=-fPIC

here the flag '-Dotherlibdirs' is used to set the path from where the perl will pick its modules. Below is the official documentation

otherlibdirs
This variable contains a colon-separated list of additional directories to add to @INC. By default, it will be empty. Perl will search these directories (including architecture and version-specific subdirectories) for add-on modules and extensions.
For example, if you have a bundle of perl libraries from a previous installation, perhaps in a strange place:
        Configure -Dotherlibdirs=/usr/lib/perl5/site_perl/5.8.9
(5) Now its the time to 'make'. Lets do it.

make && make install

(6) And its done. Yes, we have installed perl...Yahoo

One final thing, copy the perl installable file to /usr/bin ( for getting perl into system default path).

cp <path_to_perl_install_dir>/bin/perl /usr/bin/perl.

 Now, lets check our Perl installation.

perl -V

The above command will provide Perl version as well as the other important information.

So, we are done now. See, how easy it is.

 

No comments:

Post a Comment