7

Installing a custom version of Perl locally

 2 years ago
source link: https://help.dreamhost.com/hc/en-us/articles/360028572351-Installing-a-custom-version-of-Perl-locally
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Overview

This article walks you through installing a custom version of Perl locally under your username. If your server is currently running Ubuntu 18 (Bionic), the Perl version is 5.26. This article shows how to install an older version if your site requires it.

dh-kb-important-icon.svg

It's highly recommended that you only use a version of Perl which is currently maintained. This means you should not use a version that has been End-of-Life'd. You can view a full list of versions and their status here:

Installing

  1. Log into your server via SSH.
  2. Visit https://www.cpan.org/src/ to download your version of Perl. Run the wget command to download the tar.gz file.
    [server]$ wget https://www.cpan.org/src/5.0/perl-5.18.4.tar.gz
  3. Decompress this file.
    [server]$ tar zxf perl-5.18.4.tar.gz
  4. Change into the new directory.
    [server]$ cd perl-5.18.4
  5. Run the configure command for the directory you wish to install into. This example installs into a directory named /opt/perl under your username.
    [server]$ ./Configure -des -Dprefix=$HOME/opt/perl
  6. Next, run make, make test, and finally make install.
    [server]$ make
    [server]$ make test
    [server]$ make install
  7. Add code to your .bash_profile to find the local version.
    export PATH=$HOME/opt/perl/bin:$PATH
  8. source the .bash_profile.
    [server]$ . ~/.bash_profile
  9. Finally, check to confirm the new version is being used.
    [server]$ perl -v
    This is perl 5, version 18, subversion 4 (v5.18.4) built for x86_64-linux

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK