How to install Perl on Ubuntu Server?

5

1

I'm trying to deploy an application which according to the documentation requires the following:

2.2.5. Perl

LMS-MGC and the rest of Perl scripts requires also Perl interpreter and some modules:

Perl and its basic modules (POSIX, GetOpt::Long),

Config::IniFiles,

DBI,

DBD-mysql (if you use MySQL),

DBD-Pg (if you use Postgres),

How do I install the requirements with apt-get?

rimmer

Posted 2011-11-30T13:40:46.117

Reputation: 51

Answers

9

The Ubuntu package for Perl is simply "perl":

sudo apt-get install perl

which I think is preinstalled.

To find a Perl module that's provided as an Ubuntu package:

apt-cache search perl <module-name>

For example:

$ apt-cache search perl Config::IniFiles
libconfig-inifiles-perl - Read .ini-style configuration files
$ apt-cache search perl DBD-mysql
libdbd-mysql-perl - Perl5 database interface to the MySQL database
$ apt-cache search perl DBD-Pg
libdbd-pg-perl - Perl DBI driver for the PostgreSQL database server

I've skipped apt-cache search perl DBI because it produces 112 lines of output. The Ubuntu package name for that follows the others, and is libdbi-perl.

Then use sudo apt-get install ... to install each package. You should be able to use a single apt-get command to install all of them.

Keith Thompson

Posted 2011-11-30T13:40:46.117

Reputation: 4 645

1

The packages are sometimes different in different versions. Perl package names are similar with module names. You can start from Ubuntu Packages Search, espexially "Search the contents of packages" is useful if you do not know package name but know its contents. For example Config::IniFiles should have file IniFiles.pm in directory Config. Choose your Ubuntu version, enter "IniFiles.pm" and you'll get package name.

Cougar

Posted 2011-11-30T13:40:46.117

Reputation: 533

-1

You could install Perl normally using apt-get and then use Perl package manager (command ppm) to install the rest.

arcyqwerty

Posted 2011-11-30T13:40:46.117

Reputation: 968

1PPM is primarily used on Windows systems. It is not necessary, or desirable, on Linux systems. Use apt-get or CPAN to install Perl modules. – duskwuff -inactive- – 2014-12-13T05:48:03.837

What commands might you need to run to get this result? – Simon Sheehan – 2011-11-30T20:54:17.313