AMP AMP

How To Install Yarn on REDHAT 8.5

To Install Yarn on RedHat 8.5

Introduction:

The yarn package manager is an advanced package management tool for Node.js applications, offering a fast, secure, and reliable alternative to other Node.js package manager options.

Installation command:

Step 1: Check the version of the OS by using the below command

[root@linuxhelp ~]# cat /etc/os-release 
NAME="Red Hat Enterprise Linux"
VERSION="8.5 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.5"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.5 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL=https://bugzilla.redhat.com/

Step 2: Add the yarn repository to the system repository by using the below command

[root@linuxhelp ~]# curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo

Step 3: Install the yarn by using the below command

 [root@linuxhelp ~]# dnf install yarn
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Yarn Repository                                                    1.1 MB/s | 316 kB     00:00    
Dependencies resolved.
===================================================================================================
 Package            Arch     Version                                                  Repo    Size
===================================================================================================
Installing:
 yarn               noarch   1.22.19-1                                                yarn   1.2 M
Installing dependencies:
 nodejs             x86_64   1:10.24.0-1.module+el8.3.0+10166+b07ac28e                1      8.8 M
 npm                x86_64   1:6.14.11-1.10.24.0.1.module+el8.3.0+10166+b07ac28e      1      3.7 M
Installing weak dependencies:
 nodejs-full-i18n   x86_64   1:10.24.0-1.module+el8.3.0+10166+b07ac28e                1      7.3 M
Enabling module streams:
 nodejs                      10                                                                   

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

Total download size: 21 M
Installed size: 76 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): nodejs-10.24.0-1.module+el8.3.0+10166+b07ac28e.x86_64.rpm    83 MB/s | 8.8 MB     00:00    
(2/4): nodejs-full-i18n-10.24.0-1.module+el8.3.0+10166+b07ac28e.x8  84 MB/s | 7.3 MB     00:00    
(3/4): npm-6.14.11-1.10.24.0.1.module+el8.3.0+10166+b07ac28e.x86_6  51 MB/s | 3.7 MB     00:00    
(4/4): yarn-1.22.19-1.noarch.rpm                                   656 kB/s | 1.2 MB     00:01    
---------------------------------------------------------------------------------------------------
Total                                                               10 MB/s |  21 MB     00:02     
Yarn Repository                                                    7.7 kB/s | 1.6 kB     00:00    
Importing GPG key 0x6963F07F:
 Userid     : "Yarn RPM Packaging <yarn@dan.cx>"
 Fingerprint: 9A6F 73F3 4BEB 7473 4D8C 6914 9CBB B558 6963 F07F
 From       : https://dl.yarnpkg.com/rpm/pubkey.gpg
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: npm-1:6.14.11-1.10.24.0.1.module+el8.3.0+10166+b07ac28e.x86_64            1/1 
  Preparing        :                                                                           1/1 
  Installing       : nodejs-full-i18n-1:10.24.0-1.module+el8.3.0+10166+b07ac28e.x86_64         1/4 
  Installing       : npm-1:6.14.11-1.10.24.0.1.module+el8.3.0+10166+b07ac28e.x86_64            2/4 
  Installing       : nodejs-1:10.24.0-1.module+el8.3.0+10166+b07ac28e.x86_64                   3/4 
  Installing       : yarn-1.22.19-1.noarch                                                     4/4 
  Running scriptlet: yarn-1.22.19-1.noarch                                                     4/4 
  Verifying        : nodejs-1:10.24.0-1.module+el8.3.0+10166+b07ac28e.x86_64                   1/4 
  Verifying        : nodejs-full-i18n-1:10.24.0-1.module+el8.3.0+10166+b07ac28e.x86_64         2/4 
  Verifying        : npm-1:6.14.11-1.10.24.0.1.module+el8.3.0+10166+b07ac28e.x86_64            3/4 
  Verifying        : yarn-1.22.19-1.noarch                                                     4/4 
Installed products updated.

Installed:
  nodejs-1:10.24.0-1.module+el8.3.0+10166+b07ac28e.x86_64                                          
  nodejs-full-i18n-1:10.24.0-1.module+el8.3.0+10166+b07ac28e.x86_64                                
  npm-1:6.14.11-1.10.24.0.1.module+el8.3.0+10166+b07ac28e.x86_64                                   
  yarn-1.22.19-1.noarch                                                                            

Complete!

Step 4: Once the yarn is installed then install the packages of the yarn by using the below command

[root@linuxhelp ~]# curl -o- -L https://yarnpkg.com/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    53  100    53    0     0     93      0 --:--:-- --:--:-- --:--:--    93
100  7152  100  7152    0     0   8606      0 --:--:-- --:--:-- --:--:--  205k
Installing Yarn!
> Downloading tarball...

[1/2]: https://yarnpkg.com/latest.tar.gz --> /tmp/yarn.tar.gz.e27K5BW96i
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    56  100    56    0     0    455      0 --:--:-- --:--:-- --:--:--   455
100    94  100    94    0     0    268      0 --:--:-- --:--:-- --:--:--   268
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 1215k  100 1215k    0     0   344k      0  0:00:03  0:00:03 --:--:--  470k

[2/2]: https://yarnpkg.com/latest.tar.gz.asc --> /tmp/yarn.tar.gz.e27K5BW96i.asc
100    60  100    60    0     0   1132      0 --:--:-- --:--:-- --:--:--  1132
100    98  100    98    0     0   1065      0 --:--:-- --:--:-- --:--:--  1065
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   833  100   833    0     0    508      0  0:00:01  0:00:01 --:--:--  3279
> Verifying integrity...
gpg: key 1646B01B86E50310: public key "Yarn Packaging <yarn@dan.cx>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: Signature made Wednesday 11 May 2022 01:18:23 AM IST
gpg:                using RSA key 6D98490C6F1ACDDD448E45954F77679369475BAA
gpg: Good signature from "Yarn Packaging <yarn@dan.cx>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
     Subkey fingerprint: 6D98 490C 6F1A CDDD 448E  4595 4F77 6793 6947 5BAA
> GPG signature looks good
> Extracting to ~/.yarn...
> Adding to $PATH...
> We've added the following to your /root/.bashrc
> If this isn't the profile of your current shell then please add the following to your correct profile:
   
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

> Successfully installed Yarn 1.22.19! Please open another terminal where the `yarn` command will now be available.

Step 5: After the package is installed. Now check the version of yarn by using the below command

[root@linuxhelp ~]# yarn -version
1.22.19

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required To Install Yarn on REDHAT 8.5. Your feedback is much welcome.

FAQ
Q
What is the command to check the version of Yarn?
A
To check the version of Yarn use the command # yarn -v
Q
How do we install Yarn packages on Fedora 34?
A
To install Yarn packages on Fedora 34 use the command # curl -o- -L https://yarnpkg.com/install.sh | bash
Q
How do we add the yarn repository to the system repository?
A
To add the yarn repository to the system repository use the command # curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
Q
How do we enable the Yarn Repository?
A
To enable the Yarn Repository use the command # curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
Q
What is Yarn software?
A
The yarn is an advanced package management software for Node.js applications. It is a fast, secure, and reliable alternative that any other Nodejs package manager.