Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install Perl on Ubuntu

Install Perl from the Ubuntu repository, or compile a newer version from source.

VPS and Cloud Servers1 min read11 screenshots

Requirements

  • A current Ubuntu version.
  • sudo rights.
  • An internet connection.

Method 1: The Ubuntu repository

Step 1: Update

sudo apt update && sudo apt upgrade
Updating the system

Step 2: Install Perl

sudo apt install perl
Installing Perl

Perl is often installed already on Ubuntu.

Step 3: Check it

perl -v
The Perl version

Method 2: Compile from source

Use this for a newer version than the one in Ubuntu.

Step 1: Download the source

wget https://www.cpan.org/src/5.0/perl-5.34.0.tar.gz
Downloading the Perl source

Check cpan.org for the current version.

Step 2: Extract it

tar -xvf perl-5.34.0.tar.gz
Extracting the archive

Step 3: Go into the folder

cd perl-5.34.0
Opening the Perl folder

Step 4: Install make

sudo apt install make
Installing make

Step 5: Install the build tools

sudo apt install build-essential
Installing build-essential

Step 6: Configure

./Configure -des -Dprefix=/usr/local/perl
Configuring Perl

-des accepts the defaults. -Dprefix sets where Perl is installed.

Step 7: Build

make
Compiling Perl

Optionally run the tests with make test.

Step 8: Install

sudo make install
Installing Perl

Check the new version:

/usr/local/perl/bin/perl -v

Add /usr/local/perl/bin to your PATH if you want to use it by default.

Quick recap

  • sudo apt install perl is the easy way.
  • Compile from source for the newest version.
  • Check with perl -v.