Cyberithub

Best Steps to Install Perl on Rocky Linux 8

Advertisements

In this article, I will take you through the steps to install Perl on Rocky Linux 8 but before that let me ask you a quick question. Do you know which is the most popular text and string processing language that is in use today ? Well, in my opinion it is Perl Programming Language. You might be probably thinking that there are multiple other languages which is capable of doing text and string processing. Yes you are absolutely correct but none of the other programming languages are as powerful as Perl when it comes to text and string processing.

We will see some more important features about Perl on later articles. As of now, we are going to see the steps to install perl on Rocky Linux 8 in great detail in below section. More on Perl official documentation.

Best Steps to Install Perl on Rocky Linux 8

Steps to Install Perl on Rocky Linux 8

Also Read: How to Install Haskell Platform on Ubuntu 20.04 LTS

Step 1: Prerequisites

a) You should have a running Rocky Linux 8 Server.

b) You should have sudo or root access to run Privileged commands.

c) You should have dnf and rpm utility installed in your Server.

 

Step 2: Update Your Server

It is always recommended to check if there are any new versions of your installed packages are available to download and install using apt update or apt-get update command. This will make sure all the installed packages from all the repositories are up to date.

[root@localhost ~]# dnf update -y
Last metadata expiration check: 0:00:10 ago on Sat 30 Oct 2021 12:49:37 PM EDT.
Dependencies resolved.
=============================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================
Installing:
kernel x86_64 4.18.0-305.19.1.el8_4 baseos 5.9 M
kernel-core x86_64 4.18.0-305.19.1.el8_4 baseos 36 M
kernel-modules x86_64 4.18.0-305.19.1.el8_4 baseos 28 M
Upgrading:
NetworkManager x86_64 1:1.30.0-10.el8_4 baseos 2.6 M
NetworkManager-config-server noarch 1:1.30.0-10.el8_4 baseos 127 k
NetworkManager-libnm x86_64 1:1.30.0-10.el8_4 baseos 1.8 M

 

Step 3: Install Perl

In the next step, you can install perl and its dependent packages by using dnf install perl -y command as shown below.

[root@localhost ~]# dnf install perl -y
Last metadata expiration check: 0:11:52 ago on Sat 30 Oct 2021 12:49:37 PM EDT.
Dependencies resolved.
=============================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================
Installing:
perl x86_64 4:5.26.3-419.el8_4.1 appstream 72 k
Installing dependencies:
dwz x86_64 0.12-9.el8 appstream 108 k
efi-srpm-macros noarch 3-3.el8 appstream 21 k
ghc-srpm-macros noarch 1.4.2-7.el8 appstream 8.3 k
go-srpm-macros noarch 2-17.el8 appstream 12 k
make x86_64 1:4.2.1-10.el8 baseos 497 k
ocaml-srpm-macros noarch 5-4.el8 appstream 8.3 k
openblas-srpm-macros noarch 2-2.el8 appstream 6.9 k
perl-Algorithm-Diff noarch 1.1903-9.el8 baseos 51 k
perl-Archive-Tar noarch 2.30-1.el8 baseos 78 k
perl-Archive-Zip noarch 1.60-3.el8 appstream 107 k

 

Step 4: Verify Perl Installation

You can also verify the installation of Perl package from RPM database by using rpm -qa | grep -i Perl-5.26 command.

[root@localhost ~]# rpm -qa | grep -i Perl-5.26
perl-5.26.3-419.el8_4.1.x86_64

 

Step 5: Check Perl Version

You can check the current installed version of Perl Interpreter by using perl -v command. So as you can see from the output, it is 5.26.3.

[root@localhost ~]# perl -v

This is perl 5, version 26, subversion 3 (v5.26.3) built for x86_64-linux-thread-multi
(with 56 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

Now that you have Perl Interpreter installed in your System, it is time to write your first perl script. In below program, we are only using print statement to display Hi, This is from CyberITHub on the output.

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

Output

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

 

Step 7: Install Perl Module

If you want to install any Perl module on your System then you need to use dnf install perl-<module_name> -y syntax. For example, here we are installing Perl module for DBD-MySQL using dnf install perl-DBD-MySQL -y command as shown below.

[root@localhost ~]# dnf install perl-DBD-MySQL -y
Last metadata expiration check: 0:31:13 ago on Sat 30 Oct 2021 12:49:37 PM EDT.
Dependencies resolved.
=============================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================
Installing:
perl-DBD-MySQL x86_64 4.046-3.module+el8.4.0+577+b8fe2d92 appstream 155 k
Installing dependencies:
mariadb-connector-c x86_64 3.1.11-2.el8_3 appstream 199 k
mariadb-connector-c-config noarch 3.1.11-2.el8_3 appstream 14 k
perl-DBI x86_64 1.641-3.module+el8.4.0+509+59a8d9b3 appstream 739 k
Enabling module streams:
perl-DBD-MySQL 4.046
perl-DBI 1.641

Transaction Summary
=============================================================================================================================================================
Install 4 Packages

Total download size: 1.1 M
Installed size: 2.7 M

 

Step 8: Uninstall Perl 

Usually it is not recommended to uninstall Perl from your System until it is absolutely required. It is because there might be some programs and applications running on the system requires Perl to be installed. So it is absolutely mandatory to be confirmed before you uninstall Perl from the System. You can remove it by using dnf remove perl -y command as shown below.

[root@localhost ~]# dnf remove perl -y
Dependencies resolved.
=============================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================
Removing:
perl x86_64 4:5.26.3-419.el8_4.1 @appstream 0
Removing unused dependencies:
dwz x86_64 0.12-9.el8 @appstream 225 k
efi-srpm-macros noarch 3-3.el8 @appstream 38 k
ghc-srpm-macros noarch 1.4.2-7.el8 @appstream 414
go-srpm-macros noarch 2-17.el8 @appstream 7.2 k

Leave a Comment