How to install Perl on a Unix system

This web page explains how to install the Perl programming language from source code under Unix.

First, download the Perl source code. The "perl.org" website offers a convenient way to do this at www.perl.org. The file is called something like perl-5.14.1.tar.gz. The numbers after the perl- are the version number of Perl. "Tar" is a form of file archive. "Gz" indicates that the file is compressed with the gzip utility, which is usually installed on Unix systems.

Extract the files from the archive with the command

tar xfz perl-5.14.1.tar.gz

This creates a directory (folder) called perl-5.14.1 and puts all the files into it.

Change to the new directory:

cd perl-5.14.1

There are three stages to installing Perl. First of all, run the script Configure in order that Perl can understand what operating system it is being installed on:

./Configure

The initial output looks something like this:

$ ./Configure
 
Beginning of configuration questions for perl5.
 
Checking echo to see how to suppress newlines...
...using -n.
The star should be here-->*
 
First let's make sure your kit is complete.  Checking...
Looks good...

This script asks a lot of questions. Usually it is OK to just press "Enter" each time to accept the default answer. When installing Perl, it is possible to install it into a user directory with an answer like

Installation prefix to use? (~name ok) [/usr/local] /home/ben/software/install

This will make it possible to, for example, install Perl modules without using a special privileged account. Also note that on Linux systems such as Debian or Ubuntu, the "system Perl" in /usr/bin/perl is used in various ways by the system and it is better not to upgrade or otherwise alter it in any way.

After Configure has finished, it is then necessary to build and install Perl. These stages are done via the make command:

make
make install

There is also a make test option to test whether Perl has built correctly, if required.

After make install has completed, Perl is installed in the computer and nothing further needs to be done.


Copyright © Ben Bullock 2009-2023. All rights reserved. For comments, questions, and corrections, please email Ben Bullock (benkasminbullock@gmail.com) or use the discussion group at Google Groups. / Privacy / Disclaimer