In this article we will cover the basics of installing perl modules with perl-CPAN.
You will need to have GNU C Compiler installed on your system. It can be installed by running the following command:
yum -y install gcc
We need to install perl-CPAN with the following command:
yum -y install perl-CPAN
Now that we have perl-CPAN installed, we now have to configure it, or better yet, let it configure itself.
CPAN is the world-wide archive of perl resources. It consists of about 300 sites that all replicate the same contents around the globe. Many countries have at least one CPAN site already. The resources found on CPAN are easily accessible with the CPAN.pm module. If you want to use CPAN.pm, lots of things have to be configured. Fortunately, most of them can be determined automatically. If you prefer the automatic configuration, answer 'yes' below.
If you prefer to enter a dialog instead, you can answer 'no' to this question and I'll let you configure in small steps one thing after the other. (Note: you can revisit this dialog anytime later by typing 'o conf init' at the cpan prompt.)
Would you like me to configure as much as possible automatically? [yes]
Hitting enter will tell cpan to try to configure itself. (So hit enter)
The screen will scroll with a lot of information, then you will be presented with the following prompt (if all went well)
This is the cpan shell prompt. .
From here it is simple to install all your perl modules. For this example we will install Term::ReadKey which is a small module that allows you to hide passwords typed on the command line in perl scripts.
At the cpan prompt (cpan> )type the following:
cpan> install Term::ReadKey
CPAN will now fetch the necessary files and install them for you.
Some people have reported issues when using a proxy server. The simplest way around this is to export the http_proxy variable as root.
For more information on http_proxy and how to set the variable, see "How to Set the http_proxy Variable in Linux".
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Join Our Newsletter
- Bash Scripting (17)
- Basic Commands (50)
- Featured (7)
- Just for Fun (5)
- Linux Quick Tips (98)
- Linux Tutorials (60)
- Miscellaneous (15)
- Network Tools (6)
- Reviews (2)
- Security (32)
Leave a Reply