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 a different version if your site requires it.
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:
- Log into your server via SSH.
- 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
- Decompress this file.
[server]$ tar zxf perl-5.18.4.tar.gz
- Change into the new directory.
[server]$ cd perl-5.18.4
- 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
- Next, run make, make test, and finally make install.
[server]$ make [server]$ make test [server]$ make install
- Add code to your .bash_profile to find the local version.
- source the .bash_profile.
[server]$ . ~/.bash_profile
- 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