Best Steps to Install Perl on RHEL/CentOS 8

In this article, I will take you through best steps to Install Perl on RHEL/CentOS 8. Perl (Practical Extraction and Reporting Language) is a very popular and powerful language for String Handling and String Processing. You will see the usage of Perl as web scripting language along with other web technologies and frameworks. It is used for writing Server side tasks. Perl can also be used to interface front end languages like HTML with the backend Databases. It has very robust modules available to interact with other programming languages in various platforms. We will look into the steps of installing Perl and its modules on RHEL/CentOS 8 based systems in great detail.

Best Steps to Install Perl on RHEL/CentOS 8 1

Install Perl on RHEL/CentOS 8

Also Read: Best Step by Step Guide to Install Jenkins on Ubuntu 20.04

Step 1: Prerequisites

a) You need to have a running RHEL/CentOS 8 Server.

b) You should have dnf tool installed in your Server. You can check 31 Useful DNF Command Examples for RPM Package Management in Fedora/RHEL/CentOS to know more about dnf command.

c) You should have sudo access to run privileged commands. You can Check How to Add User to Sudoers to know more about providing sudo access to the User.

Step 2: Update Your Server

Before going through the steps to install Let’s encrypt tool you need to first update your Server using dnf update -y command as shown below. This will download and install all the latest available updates from enabled Repo on your RHEL/CentOS 8 based server. Sometimes installing a new package requires dependencies to be updated with the latest version hence it is always recommended to run an update first. This is particularly required if you have not updated your Server from long time.

[root@localhost ~]# dnf update -y
CentOS-8 - AppStream 6.1 kB/s | 4.3 kB 00:00
CentOS-8 - Base 7.7 kB/s | 3.9 kB 00:00
CentOS-8 - Extras 3.4 kB/s | 1.5 kB 00:00
CentOS-8 - PowerTools 8.1 kB/s | 4.3 kB 00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64 7.3 kB/s | 8.5 kB 00:01
Extra Packages for Enterprise Linux 8 - x86_64 15 kB/s | 13 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 1.5 MB/s | 8.0 MB 00:05
Google Cloud SDK 289 B/s | 454 B 00:01
Google Cloud SDK 3.8 MB/s | 18 MB 00:04
RPM Fusion for EL 8 - Free - Updates 3.8 kB/s | 3.7 kB 00:00
RPM Fusion for EL 8 - Free - Updates 58 kB/s | 262 kB 00:04
Dependencies resolved.
========================================================================================================================================================================
Package Architecture Version Repository Size
========================================================================================================================================================================
Installing:
kernel-core x86_64 4.18.0-193.14.2.el8_2 BaseOS 28 M
Upgrading:
alsa-lib x86_64 1.2.1.2-3.el8 AppStream 441 k
container-selinux noarch 2:2.124.0-1.module_el8.2.0+305+5e198a41 AppStream 47 k
containers-common x86_64 1:0.1.40-11.module_el8.2.0+377+92552693 AppStream 50 k
fribidi x86_64 1.0.4-8.el8 AppStream 89 k
fuse-overlayfs x86_64 0.7.2-5.module_el8.2.0+305+5e198a41 AppStream 60 k
git x86_64 2.18.4-2.el8_2 AppStream 186 k
git-core x86_64 2.18.4-2.el8_2 AppStream 4.0 M
git-core-doc noarch 2.18.4-2.el8_2 AppStream 2.3 M
gtk-update-icon-cache x86_64 3.22.30-5.el8 AppStream 32 k
gtk3 x86_64 3.22.30-5.el8 AppStream 4.5 M
java-1.8.0-openjdk-headless x86_64 1:1.8.0.262.b10-0.el8_2 AppStream 34 M
java-11-openjdk x86_64 1:11.0.8.10-0.el8_2 AppStream 249 k
java-11-openjdk-devel x86_64 1:11.0.8.10-0.el8_2 AppStream 3.4 M
java-11-openjdk-headless x86_64 1:11.0.8.10-0.el8_2 AppStream 40 M
libdrm x86_64 2.4.100-1.el8 AppStream 164 k
libepoxy x86_64 1.5.3-1.el8 AppStream 225 k
libmaxminddb x86_64 1.2.0-7.el8 AppStream 25 k
libtiff x86_64 4.0.9-17.el8 AppStream 188 k
libvncserver x86_64 0.9.11-15.el8_2.1 AppStream 275 k
libwayland-client x86_64 1.17.0-1.el8 AppStream 39 k
libwayland-cursor x86_64 1.17.0-1.el8 AppStream 26 k
libwayland-egl x86_64 1.17.0-1.el8 AppStream 19 k
libxcb x86_64 1.13.1-1.el8 AppStream 229 k
libxkbcommon x86_64 0.9.1-1.el8 AppStream 116 k
nodejs x86_64 1:10.21.0-3.module_el8.2.0+391+8da3adc6 AppStream 8.9 M
nodejs-docs noarch 1:10.21.0-3.module_el8.2.0+391+8da3adc6 AppStream 3.5 M
nodejs-full-i18n x86_64 1:10.21.0-3.module_el8.2.0+391+8da3adc6 AppStream 7.3 M
npm x86_64 1:6.14.4-1.10.21.0.3.module_el8.2.0+391+8da3adc6 AppStream 3.8 M
nspr x86_64 4.25.0-2.el8_2 AppStream 142 k
nss x86_64 3.53.1-11.el8_2 AppStream 721 k
nss-softokn x86_64 3.53.1-11.el8_2 AppStream 484 k
nss-softokn-freebl x86_64 3.53.1-11.el8_2 AppStream 289 k
nss-sysinit x86_64 3.53.1-11.el8_2 AppStream 71 k
nss-tools x86_64 3.53.1-11.el8_2 AppStream 559 k
nss-util x86_64 3.53.1-11.el8_2 AppStream 135 k
perl-Git noarch 2.18.4-2.el8_2 AppStream 77 k
perl-IO-Socket-SSL noarch 2.066-4.el8 AppStream 297 k
pixman x86_64 0.38.4-1.el8 AppStream 257 k
plymouth x86_64 0.9.3-16.el8 AppStream 114 k
plymouth-core-libs x86_64 0.9.3-16.el8 AppStream 115 k
plymouth-scripts x86_64 0.9.3-16.el8 AppStream 42 k
python2 x86_64 2.7.17-1.module_el8.2.0+381+9a5b3c3b AppStream 108 k

Step 3: Install Perl on RHEL/CentOS 8

After successfully updating the Server you can now install Perl packages using dnf install perl -y command as shown below.

Advertisements
[root@localhost ~]# dnf install perl -y
Last metadata expiration check: 0:03:30 ago on Wed 16 Sep 2020 05:39:42 PM EDT.
Dependencies resolved.
========================================================================================================================================================================
Package Architecture Version Repository Size
========================================================================================================================================================================
Installing:
perl x86_64 4:5.26.3-416.el8 AppStream 72 k
Installing dependencies:
dwz x86_64 0.12-9.el8 AppStream 109 k
efi-srpm-macros noarch 3-2.el8 AppStream 22 k
ghc-srpm-macros noarch 1.4.2-7.el8 AppStream 9.3 k
go-srpm-macros noarch 2-16.el8 AppStream 14 k
ocaml-srpm-macros noarch 5-4.el8 AppStream 9.4 k
openblas-srpm-macros noarch 2-2.el8 AppStream 7.9 k
perl-Algorithm-Diff noarch 1.1903-9.el8 AppStream 52 k
perl-Archive-Tar noarch 2.30-1.el8 AppStream 79 k
perl-Archive-Zip noarch 1.60-3.el8 AppStream 108 k
perl-Attribute-Handlers noarch 0.99-416.el8 AppStream 88 k
perl-B-Debug noarch 1.26-2.el8 AppStream 26 k
perl-CPAN noarch 2.18-397.el8 AppStream 554 k
perl-CPAN-Meta noarch 2.150010-396.el8 AppStream 191 k
perl-CPAN-Meta-Requirements noarch 2.140-396.el8 AppStream 37 k
perl-CPAN-Meta-YAML noarch 0.018-397.el8 AppStream 34 k
perl-Compress-Bzip2 x86_64 2.26-6.el8 AppStream 72 k
perl-Config-Perl-V noarch 0.30-1.el8 AppStream 22 k
perl-DB_File x86_64 1.842-1.el8 AppStream 83 k
perl-Data-OptList noarch 0.110-6.el8 AppStream 31 k
perl-Data-Section noarch 0.200007-3.el8 AppStream 30 k
perl-Devel-PPPort x86_64 3.36-5.el8 AppStream 118 k
perl-Devel-Peek x86_64 1.26-416.el8 AppStream 93 k
perl-Devel-SelfStubber noarch 1.06-416.el8 AppStream 75 k
perl-Devel-Size x86_64 0.81-2.el8 AppStream 34 k
perl-Digest-SHA x86_64 1:6.02-1.el8 AppStream 66 k
perl-Encode-devel x86_64 4:2.97-3.el8 AppStream 39 k
perl-Env noarch 1.04-395.el8 AppStream 21 k
perl-ExtUtils-CBuilder noarch 1:0.280230-2.el8 AppStream 48 k
perl-ExtUtils-Command noarch 1:7.34-1.el8 AppStream 19 k
perl-ExtUtils-Embed noarch 1.34-416.el8 AppStream 79 k
perl-ExtUtils-Install noarch 2.14-4.el8 AppStream 46 k
perl-ExtUtils-MM-Utils noarch 1:7.34-1.el8 AppStream 17 k
perl-ExtUtils-MakeMaker noarch 1:7.34-1.el8 AppStream 300 k
perl-ExtUtils-Manifest noarch 1.70-395.el8 AppStream 37 k
perl-ExtUtils-Miniperl noarch 1.06-416.el8 AppStream 76 k
perl-ExtUtils-ParseXS noarch 1:3.35-2.el8 AppStream 83 k
perl-File-Fetch noarch 0.56-2.el8 AppStream 33 k
perl-File-HomeDir noarch 1.002-4.el8 AppStream 61 k
perl-File-Which noarch 1.22-2.el8 AppStream 23 k
perl-Filter-Simple noarch 0.94-2.el8 AppStream 29 k
perl-IO-Zlib noarch 1:1.10-416.el8 AppStream 80 k
perl-IPC-Cmd noarch 2:1.02-1.el8 AppStream 43 k
perl-IPC-SysV x86_64 2.07-397.el8 AppStream 43 k
perl-IPC-System-Simple noarch 1.25-17.el8 AppStream 43 k
perl-JSON-PP noarch 1:2.97.001-3.el8 AppStream 68 k
perl-Locale-Codes noarch 3.57-1.el8 AppStream 311 k
perl-Locale-Maketext noarch 1.28-396.el8 AppStream 99 k
perl-Locale-Maketext-Simple noarch 1:0.21-416.el8 AppStream 78 k
perl-MRO-Compat noarch 0.13-4.el8 AppStream 24 k
perl-Math-BigInt-FastCalc x86_64 0.500.600-6.el8 AppStream 27 k
perl-Math-BigRat noarch 0.2614-1.el8 AppStream 40 k
perl-Memoize noarch 1.03-416.el8 AppStream 118 k
perl-Module-Build noarch 2:0.42.24-5.el8 AppStream 273 k
perl-Module-CoreList noarch 1:5.20181130-1.el8 AppStream 87 k
perl-Module-CoreList-tools noarch 1:5.20181130-1.el8 AppStream 22 k
perl-Module-Load noarch 1:0.32-395.el8 AppStream 19 k
perl-Module-Load-Conditional noarch 0.68-395.el8 AppStream 24 k
perl-Module-Loaded noarch 1:0.08-416.el8 AppStream 74 k
perl-Module-Metadata noarch 1.000033-395.el8 AppStream 44 k
perl-Net-Ping noarch 2.55-416.el8 AppStream 101 k
perl-Package-Generator noarch 1.106-11.el8 AppStream 27 k
perl-Params-Check noarch 1:0.38-395.el8 AppStream 24 k
perl-Params-Util x86_64 1.07-22.el8 AppStream 44 k
perl-Perl-OSType noarch 1.010-396.el8 AppStream 29 k
perl-PerlIO-via-QuotedPrint noarch 0.08-395.el8 AppStream 13 k
perl-Pod-Checker noarch 4:1.73-395.el8 AppStream 33 k
perl-Pod-Html noarch 1.22.02-416.el8 AppStream 87 k
perl-Pod-Parser noarch 1.63-396.el8 AppStream 108 k
perl-SelfLoader noarch 1.23-416.el8 AppStream 82 k
perl-Software-License noarch 0.103013-2.el8 AppStream 138 k
perl-Sub-Exporter noarch 0.987-15.el8 AppStream 73 k
perl-Sub-Install noarch 0.928-14.el8 AppStream 27 k
perl-Sys-Syslog x86_64 0.35-397.el8 AppStream 50 k
perl-Test noarch 1.30-416.el8 AppStream 89 k
perl-Test-Harness noarch 1:3.42-1.el8 AppStream 279 k
perl-Test-Simple noarch 1:1.302135-1.el8 AppStream 516 k
perl-Text-Balanced noarch 2.03-395.el8 AppStream 58 k
perl-Text-Diff noarch 1.45-2.el8 AppStream 45 k
perl-Text-Glob noarch 0.11-4.el8 AppStream 17 k
perl-Text-Template noarch 1.51-1.el8 AppStream 64 k
perl-Thread-Queue noarch 3.13-1.el8 AppStream 24 k
perl-Time-Piece x86_64 1.31-416.el8 AppStream 98 k
perl-Unicode-Collate x86_64 1.25-2.el8 AppStream 686 k
perl-autodie noarch 2.29-396.el8 AppStream 98 k
perl-bignum noarch 0.49-2.el8 AppStream 44 k
perl-devel x86_64 4:5.26.3-416.el8 AppStream 599 k
perl-encoding x86_64 4:2.22-3.el8 AppStream 68 k
perl-experimental noarch 0.019-2.el8 AppStream 24 k
perl-inc-latest noarch 2:0.500-9.el8 AppStream 25 k
perl-libnetcfg noarch 4:5.26.3-416.el8 AppStream 77 k
perl-local-lib noarch 2.000024-2.el8 AppStream 74 k
perl-open noarch 1.11-416.el8 AppStream 77 k
perl-perlfaq noarch 5.20180605-1.el8 AppStream 386 k
perl-srpm-macros noarch 1-25.el8 AppStream 11 k
perl-utils noarch 5.26.3-416.el8 AppStream 128 k
perl-version x86_64 6:0.99.24-1.el8 AppStream 67 k

Step 4: Verify Your Package

Once the installation is completed, you can verify the installation by querying the package from RPM database using rpm -qa | grep -i perl-5.26.3-416.el8.x86_64 command as shown below.

[root@localhost ~]# rpm -qa | grep -i perl-5.26.3-416.el8.x86_64
perl-5.26.3-416.el8.x86_64

Step 5: Check Perl Version

If you want to check the installed perl version then you need to use perl -v command as shown below. As you can see from below output, current perl version is 5.26.3. You can check Perl man page to know more about the available options.

[root@localhost ~]# perl -v

This is perl 5, version 26, subversion 3 (v5.26.3) built for x86_64-linux-thread-multi
(with 51 registered patches, see perl -V for more detail)

Copyright 1987-2018, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Step 6: Write Your First Perl Script

By this time you are now ready to write your first Perl Script. You can use the vi editor to write a simple perl script which can print a statement in the output as shown below.

[root@localhost ~]# vi example.pl
#!/usr/bin/perl
use warnings;
print("Hi, This is from CyberITHub\n");

Run Your Script

If you try to run the above script using perl example.pl command then you will see "Hi, This is from CyberITHub"  in the output as expected. This confirms that Perl is now ready for further scripting.

[root@localhost ~]# perl example.pl
Hi, This is from CyberITHub

Step 7: Install Perl Module on RHEL/CentOS 8

If you want to install any perl module then you can simply do that by using dnf install <perl_module_name> -y command as shown below. Here we are trying to install Perl MySQL module using dnf install perl-DBD-MySQL -y command.

[root@localhost ~]# dnf install perl-DBD-MySQL -y
Dependencies resolved.
========================================================================================================================================================================
 Package                               Architecture                  Version                                                     Repository                        Size
========================================================================================================================================================================
Installing:
 perl-DBD-MySQL                        x86_64                        4.046-3.module_el8.1.0+203+e45423dc                         AppStream                        156 k
Transaction Summary
========================================================================================================================================================================
Install 1 Package

Total download size: 156 k
Installed size: 367 k
Downloading Packages:
perl-DBD-MySQL-4.046-3.module_el8.1.0+203+e45423dc.x86_64.rpm 493 kB/s | 156 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 193 kB/s | 156 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : perl-DBD-MySQL-4.046-3.module_el8.1.0+203+e45423dc.x86_64 1/1
Running scriptlet: perl-DBD-MySQL-4.046-3.module_el8.1.0+203+e45423dc.x86_64 1/1
Verifying : perl-DBD-MySQL-4.046-3.module_el8.1.0+203+e45423dc.x86_64 1/1

Installed:
perl-DBD-MySQL-4.046-3.module_el8.1.0+203+e45423dc.x86_64

Complete!

 

 

 

 

 

 

 

For Linux Tutorials, Check below Posts:-

How to Install Let’s Encrypt(Certbot) on RHEL/CentOS 8 Using 10 Easy Steps

33 Practical Examples of ulimit command in Linux/Unix for Professionals

8 Easy Ways to check Ubuntu Version using Bash Command Line

5 Easy Steps to Install Openssh-Server on Ubuntu 20.04 to Enable SSH 

15 Practical Bash For Loop Examples in Linux/Unix for Professionals

How to Limit CPU Limit of a Process Using CPULimit in Linux (RHEL/CentOS 7/8)

6 Popular Methods to List All Running Services Under Systemd in Linux

Unix/Linux Find Files and Directories Owned By a Particular User(5 Useful Examples)

Advertisements

Leave a Reply