Installing Perl environment on Linux

By using plenv, you can easily install and switch among different version of Perl. This will be installed under your home directory in~/.plenv.

Install latest Perl (with supporting multithreading) and CPANMinus.

 $ cd
 $ git clone git://github.com/tokuhirom/plenv.git ~/.plenv
 $ git clone git://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/
 $ echo 'export PATH="$HOME/.plenv/bin:$PATH"' >> ~/.bashrc
 $ echo 'eval "$(plenv init -)"' >> ~/.bashrc
 $ source ~/.bashrc
 $ plenv install 5.18.1 -Dusethreads
 $ plenv rehash
 $ plenv global 5.18.1
 $ plenv install-cpanm
  • git is a distributed revision control and source code management software which can help you to download files from GitHub server.
  • echo means "print".
  • >> means adding the output into the end of the file, while > means adding the output by overwriting the whole file. Please use> with additional cares.
  • In Linux system, there are two types of outputs when you execute a command. One is called standard output (or sometimes STDOUT for short), and the other is a standard error (STDERR). 1> is for STDOUT only, 2> is for STDERR only, and &>means for both. In default > is the same to 1>.
  • exec is execution.
  • Remember to install Perl in supporting multithreading (with option -Dusethreads), which is important for many NGS analysis packages (e.g. Trinity). In this setting, you can use multiple CPU for Perl software.
  • Install the CPAN (Comprehensive Perl Archive Network) manager software, CPANMinus, by install-cpanm.

You can use plenv global and plenv local to change the different version of Perl to fulfil different needs of your Perl software.

For example, if the specific version of Perl is not compatible with your script, you can switch to the different version by:

 $ plenv local 
  • It is similar to set the local version of your script language when you use pyenv and rbenv as the following.

Put the following path into ~/.bashrc file.

export PERL5LIB="$HOME/.plenv/build/perl-5.18.1/lib"

Install BioPerl and PerlIO::gzip

CPANMinus is a very good Perl module manager, use cpanm to install BioPerl can save you a lot of time. Here are some useful modules:

$ cpanm Bio::Perl
$ cpanm Bio::SearchIO
$ cpanm PerlIO::gzip

For more information, please visit: https://github.com/tokuhirom/plenv