How To Install Perl Modules With CPAN? – POFTUT

How To Install Perl Modules With CPAN?


Perl is an old and popular scripting language. Todays Python is preferred over Perl but there are a lot of useful tools used already by system administrators. There is generally a problem of dependency for Perl scripts. Here we will look at how to install required Perl modules into Linux.

Install Via CPAN

CPAN is a very good solution to install modules. It resolves and installs dependencies easily. CPAN is very easy to use versus installing modules manually.

CentOS, Fedora, Red Hat

We can install CPAN in rpm-based distributions like CentOS, Fedora and Red Hat like below.

$ sudo yum install perl-CPAN.noarch

Ubuntu, Debian, Mint, Kali

We can use following command in order to install CPAN in deb based distributions like Debian, Ubuntu, Kali, and Mint.

$ sudo apt-get install libpath-tiny-perl
Install CPAN For Ubuntu, Mint, Kali, Debian
Install CPAN For Ubuntu, Mint, Kali, Debian

Install MIME

We have installed the CPAN and we can use CPAN interactive shell in order to install MIME::Lite package. First, we will enter to the CPAN interactive shell.

$ cpan
CPAN Interactive Shell
CPAN Interactive Shell
# cpan> install MIME::Lite
Install MIME
Install MIME

Install Perl Modules With CPAN From Bash

We can run the installation process without entering CPAN shell-like below.

$ sudo cpan -i MIME::Lite

-i parameter simple provides install command like in CPAN shell.

Install Perl Modules With CPAN From Bash
Install Perl Modules With CPAN From Bash

LEARN MORE  What Is Shebang Linux or Bash Term?

Leave a Comment