How to install Yarn Package Manager on Rocky Linux 9.2
To Install Yarn Package Manager On Rocky Linux 9.2
Introduction:
YARN, short for Yet Another Resource Navigator, is a fast, stable, and reliable Javascript package manager that is compatible with npm ( Node Package Manager). Yarn helps with the management of npm packages which includes installation, updating, configuration, and removal of packages.
Installation Steps:
Step 1: Check the version of the OS by using the below command
[root@Linuxhelp ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.2 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.2"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.2 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.2"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.2"
Step 2: Add the NodeSource repository by using the below command.
[root@Linuxhelp ~]# curl -sL https://rpm.nodesource.com/setup_16.x | bash -
================================================================================
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
================================================================================
SCRIPT DEPRECATION WARNING
The NodeSource Node.js Linux distributions GitHub repository contains
information about which versions of Node.js and which Linux distributions
are supported and how to install it.
https://github.com/nodesource/distributions
SCRIPT DEPRECATION WARNING
TO AVOID THIS WAIT MIGRATE THE SCRIPT
Continuing in 60 seconds (press Ctrl-C to abort) ...
## Installing the NodeSource Node.js 16.x repo...
## Inspecting system...
+ uname -m
rocky-release-9.2-1.6.el9.noarch
exec redhat-release
Release package: rocky-release-9.2-1.6.el9.noarch
## Confirming "el9-x86_64" is supported...
+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_16.x/el/9/x86_64/nodesource-release-el9-1.noarch.rpm'
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.jCLolm22K2' 'https://rpm.nodesource.com/pub_16.x/el/9/x86_64/nodesource-release-el9-1.noarch.rpm'
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.jCLolm22K2'
## Cleaning up...
+ rm -f '/tmp/tmp.jCLolm22K2'
## Checking for existing installations...
+ rpm -qa 'node|npm' | grep -v nodesource
## Run `sudo yum install -y nodejs` to install Node.js 16.x and npm.
## You may run dnf if yum is not available:
sudo dnf install -y nodejs
## You may also need development tools to build native addons:
sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn
Step 3: Next, install the latest Node.js version by using the below command
[root@Linuxhelp ~]# dnf install nodejs
Node.js Packages for Enterprise Linux 9 - x86_64 452 kB/s | 280 kB 00:00
Rocky Linux 9 - BaseOS 4.4 kB/s | 4.1 kB 00:00
Rocky Linux 9 - AppStream 4.8 kB/s | 4.5 kB 00:00
Rocky Linux 9 - Extras 3.9 kB/s | 2.9 kB 00:00
Dependencies resolved.
===================================================================================================================
Package Architecture Version Repository Size
===================================================================================================================
Installing:
nodejs x86_64 2:16.20.2-1nodesource nodesource 32 M
Transaction Summary
===================================================================================================================
Install 1 Package
Total download size: 32 M
Installed size: 89 M
Is this ok [y/N]: y
Downloading Packages:
nodejs-16.20.2-1nodesource.x86_64.rpm 20 MB/s | 32 MB 00:01
-------------------------------------------------------------------------------------------------------------------
Total 20 MB/s | 32 MB 00:01
Node.js Packages for Enterprise Linux 9 - x86_64 1.6 MB/s | 1.6 kB 00:00
Importing GPG key 0x34FA74DD:
Userid : "NodeSource <gpg-rpm@nodesource.com>"
Fingerprint: 2E55 207A 95D9 944B 0CC9 3261 5DDB E8D4 34FA 74DD
From : /etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Is this ok [y/N]: y
Key imported successfully
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: nodejs-2:16.20.2-1nodesource.x86_64 1/1
Installing : nodejs-2:16.20.2-1nodesource.x86_64 1/1
Running scriptlet: nodejs-2:16.20.2-1nodesource.x86_64 1/1
Verifying : nodejs-2:16.20.2-1nodesource.x86_64 1/1
Installed:
nodejs-2:16.20.2-1nodesource.x86_64
Complete!
Step 4: Verify the installed Node.js version by using the below command
[root@Linuxhelp ~]# node -v
v16.20.2
Step 5: To verify the NPM version, by using the below command
[root@Linuxhelp ~]# npm -v
8.19.4
Step 6: By default, Yarn is not available on Rocky Linux 9 base repository. Now run the below command to add the Yarn repository to your system.
[root@Linuxhelp ~]# curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
[yarn]
name=Yarn Repository
baseurl=https://dl.yarnpkg.com/rpm/
enabled=1
gpgcheck=1
gpgkey=https://dl.yarnpkg.com/rpm/pubkey.gpg
[root@Linuxhelp ~]# rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
Step 7: After the repository has been successfully added, we can install Yarn by using the below command
[root@Linuxhelp ~]# dnf install yarn
Yarn Repository 436 kB/s | 316 kB 00:00
Dependencies resolved.
===================================================================================================================
Package Architecture Version Repository Size
===================================================================================================================
Installing:
yarn noarch 1.22.19-1 yarn 1.2 M
Transaction Summary
===================================================================================================================
Install 1 Package
Total download size: 1.2 M
Installed size: 5.1 M
Is this ok [y/N]: y
Downloading Packages:
yarn-1.22.19-1.noarch.rpm 1.9 MB/s | 1.2 MB 00:00
-------------------------------------------------------------------------------------------------------------------
Total 1.9 MB/s | 1.2 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : yarn-1.22.19-1.noarch 1/1
Verifying : yarn-1.22.19-1.noarch 1/1
Installed:
yarn-1.22.19-1.noarch
Complete!
Step 8: Now we can check the Yarn version by using the below command
[root@Linuxhelp ~]# yarn -v
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 Package Manager on Rocky Linux Debian 9.2. Your feedback is much welcome.
yarn init
yarn add
yarn –version
yarn remove