How to install Perl on Ubuntu Server?

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?

3 Answers

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.

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.

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

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like