Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Perl Modules Using CPAN on CentOS 8 - DesignLinux

May 29 2020
designlinux 0 Comments

The Comprehensive Perl Archive Network (CPAN in short) is a popular central repository of currently 188,714 Perl modules in 40,986 distributions. It is a single location where you can find, download and install any of the incredible (and still growing) collection of Perl libraries.

It has 25,000 modules available and it is mirrored on servers around the world. It also supports automated testing: cross-platform and on multiple versions of Perl, and bug tracking for every library. Also, you can search it using various sites on the web, which offer tools such as grep, version-to-version diff as well as documentation.

The CPAN Perl module is a core module that allows you to query, download, build and install Perl modules and extensions from CPAN sites. It has been distributed with Perl since 1997 (5.004). It includes some primitive searching capabilities and supports named and versioned bundles of modules.

In this article, you will learn how to install Perl and Perl modules in CentOS 8 using CPAN.

How to Install Perl CPAN Module in CentOS 8

Before you can use CPAN, you need to install the Perl-CPAN package, using the DNF package manager as shown.

# dnf install perl-CPAN
Install Perl CPAN in CentOS 8

Install Perl CPAN in CentOS 8

Note: Although most Perl modules are written in Perl, some use XS – they are written in C and so require a C compiler which is included in the Development Tools package.

Let’s install the Development Tools package as shown.

# dnf install "@Development Tools"
Install Development Tools in CentOS 8

Install Development Tools in CentOS 8

How to Install Perl Modules Using CPAN

To install Perl modules using CPAN, you need to use the cpan command-line utility. You can either run cpan with arguments from the command-line interface, for example, to install a module (e.g Geo::IP) use the -i flag as shown.

# cpan -i Geo::IP  
OR
# cpan Geo::IP  

When you run cpan for the first time, it requires configuration as shown in the screenshot below. For this guide, we will enter yes to configure it automatically. If you enter no, the configuration script will take you through a series of questions to configure it.

Configure CPAN Automatically

Configure CPAN Automatically

The following screenshot shows the module Geo::IP has been installed on the system.

Perl Module Geo::IP Installed

Perl Module Geo::IP Installed

Alternatively, you can run a cpan without arguments to start CPAN.pm shell. Then use the install sub-command to install a module (e.g Log::Log4perl) as shown.

# cpan
cpan[1]> install Log::Log4perl
Install Perl Modules Using CPAN

Install Perl Modules Using CPAN

How to List Installed Perl Modules and Versions

To list all installed Perl modules with their versions, use the -l flag as shown.

# cpan -l
List Installed Perl Modules

List Installed Perl Modules

How to Search a Perl Module Using CPAN

To search a module, open the cpan shell and use the m flag as shown.

# cpan
cpan[1]> m Net::Telnet
cpan[1]> m HTML::Template
Search Perl Modules Using CPAN

Search Perl Modules Using CPAN

For more information, read the cpan manual entry page or get help from the CPAN shell using the help command.

# man cpan
OR
# cpan
cpan[1]> help

How to Install Perl Modules Using CPANM

App::cpanminus(cpanm) is another popular module used to download, unpack, build and install modules from CPAN. To get it working on your system, install the App::cpanminus module as shown.

# cpan App::cpanminus
Install CPANM Module

Install CPANM Module

You can install a module using cpanm as shown.

# cpanm Net::Telnet
Install Perl Module Using CPANM

Install Perl Module Using CPANM

How to Install Perl Modules from Github

cpanm supports the installation of Perl modules directly from Github. For example, to install the Starman – a high-performance preforking Perl PSGI web server, run the following command.

# cpanm git://github.com/miyagawa/Starman.git
Install Perl Modules from Github

Install Perl Modules from Github

For more usage options, see the cpanm man page.

# man cpanm

CPAN is a single location where you can find, download and install Perl modules; it currently has 192,207 Perl modules in 41,002 distributions. If you have any queries, share them with us via the feedback form below.

Sharing is Caring…
Share on FacebookShare on TwitterShare on LinkedinShare on Reddit

Related

Tags: CentOS Tips

How to Set Up NFS Server and Client on CentOS 8

Prev Post

How to Install NextCloud on CentOS 8

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 687
  • 615,059

DesignLinux.com © All rights reserved

Go to mobile version