Atlantic.Net Blog

How to Install Yarn NPM Package Manager on RockyLinux 8

Hitesh Jethva
by Atlantic.Net (345 posts) under Dedicated Server Hosting, Tutorials
0 Comments

Yarn, also called “Yet Another Resource Navigator,” is a fast, secure and reliable JavaScript package manager that allows you to automate the installation, configuring, updating, and removing of npm packages. Yarn caches every package it has downloaded, so it never needs to download the same package again.

In this post, we will explain the following:

  • Install Yarn using NPM
  • Install Yarn from repository NPM
  • Install Yarn with Script

Prerequisites

  • A server running Rocky Linux 8 on the Atlantic.Net Cloud Platform
  • A root password is configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Rocky Linux as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install YARN using NPM

In this section, we will show you how to install Yarn via Node Package Manager.

First, you will need to add the NodeSource repository to your system. You can add it with the following command:

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

Once the repository is added, install the Node.js and NPM package using the following command:

dnf install nodejs npm -y

Next, verify the Node.js version with the following command:

node --version

Sample output:

v16.9.1

You can also check the NPM version using the following command:

npm -v

Sample output:

7.21.1

Now, install the Yarn package using the NPM as shown below:

npm install --global yarn

You should get the following output:

npm notice 
npm notice New minor version of npm available! 7.21.1 -> 7.24.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.24.0
npm notice Run npm install -g [email protected] to update!
npm notice 

Next, verify the Yarn version with the following command:

yarn -v

Sample output:

1.22.11

You can uninstall the Yarn package from your system using the following command:

npm uninstall -g yarn

Step 3 – Install YARN from Yum Repository

In this section, we will show you how to install the Yarn package from the Rocky Linux repository. By default, the Yarn package is not included in the Rocky Linux default repository, so you will need to add the Yarn repo to your system.

You can create a Yarn repo with the following command:

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

Once the repository is created, install the Yarn package with the following command:

dnf install yarn -y

Once Yarn has been installed, verify the Yarn version with the following command:

yarn -v

Sample output:

1.22.5

If you want to remove the Yarn package from your system, run the following command:

dnf remove yarn -y

Step 4 – Install YARN with Script

In this section, we will show you how to install Yarn via the Yarn installation script.

You can download and run the Yarn installation script using the following command:

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

Once the Yarn package has been installed, you should get the following output:

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

Next, activate the system path with the following command:

source ~/.bashrc

Next, verify the Yarn version using the following command:

yarn -v

Sample output:

1.22.5

Conclusion

In the above guide, we explained the three-way to install the Yarn package on RockyLinux 8. You can now use your preferred way to install the Yarn to your system. Get started with Yarn on a dedicated host from Atlantic.Net today!

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

How to Install Python 3.10 on Rocky Linux 8
How to Install TaskBoard on Rocky Linux 8
How to Set Up Pritunl VPN Server on Rocky Linux 8
How to Install Teampass Password Manager on Rocky Linux 8
How to Install and Configure RabbitMQ Server on Rocky Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources