Install Yarn on Rocky Linux 8 / AlmaLinux 8 - Best method ?

YARN, short for Yet Another Resource Navigator, is a fast, stable, and reliable Javascript package manager which is compatible with npm ( Node Package Manager). Yarn helps with the management of npm packages which includes installation, updating, configuration, and removal of packages.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Node JS queries.

In this context, we shall look into how to install Yarn on Rocky Linux 8 / AlmaLinux 8.


Steps to Install Yarn on Rocky Linux 8 / AlmaLinux 8


1. Install Node.JS and NPM

To set sail, we need to install NPM as a prerequisite for Yarn installation. To achieve this, we will install NodeJS which provides the npm package. At the moment, Node.JS 16 is the latest version of Node and can be installed from Nodesource.

Now, login as a sudo user and download and run the Nodesource script:

$ curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -

The script inspects your system's architecture, confirms if it supports Node.JS, and proceeds to install the Nodesource repository on your system.

The next step is to install npm and NodeJS which is an open-source Javascript runtime environment. To install NodeJS and npm by extension, execute the command:

$ sudo dnf install nodejs

Once installed, verify that NodeJS is installed:

$ node -v

To install npm, run the below command:

$ npm -v


2. Install Yarn on Rocky Linux

To install Yarn, proceed and add the Yarn repository to Rocky Linux with the below command:

$ curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

Then install Yarn from the Yarn repository:

$ sudo dnf install yarn

When prompted, accept the GPG key by pressing 'y'.

When the installation is complete, confirm that Yarn is installed by checking its version:

$ yarn -v

Alternatively, you can easily install Yarn by downloading and running an installation script with the below command:

$ curl -o- -L https://yarnpkg.com/install.sh | bash


[Need assistance in Installing any Software Package on Debian Linux system ? We can help you. ]

This article covers the process of installing Yarn on Rocky Linux system. In fact, Yarn is a tool for managing, updating, and sharing your Java code. Yarn works through node.js helping to track libraries, dependencies, and even enables you to share solutions with other developers.

Related Posts