Atlantic.Net Blog

How to Install Yarn NPM Package Manager on Oracle Linux 8

Hitesh Jethva
by Atlantic.Net (414 posts) under Tutorials, VPS Hosting
0 Comments

Yarn is a JavaScript package manager used to automate the installation, configuration, update, and removal of npm packages. Yarn stands for “Yet Another Resource Navigator.” It was developed by Facebook and is very similar to the npm package manager, with a focus on speed, security, and consistency. Yarn replaces the existing workflow of the npm client or other package managers while remaining compatible with the npm registry.

In this post, we will explain the following:

  • How to install Yarn using NPM
  • How to install Yarn from repository NPM
  • How to install Yarn using a script

Prerequisites

  • A server running Oracle Linux 8 on the Atlantic.Net Cloud Platform
  • A root password 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 Oracle Linux 8 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

First, you will need to install Node.js and npm on your server. First, list all available Node.js versions using the following command:

dnf module list nodejs

You will get the following list:

Last metadata expiration check: 0:13:42 ago on Saturday 30 April 2022 08:14:41 AM EDT.
Oracle Linux 8 Application Stream (x86_64)
Name                     Stream                     Profiles                                               Summary                            
nodejs                   10 [d][x]                  common [d], development, minimal, s2i                  Javascript runtime                 
nodejs                   12 [x]                     common [d], development, minimal, s2i                  Javascript runtime                 
nodejs                   14 [x]                     common [d], development, minimal, s2i                  Javascript runtime                 
nodejs                   16 [x]                     common [d], development, minimal, s2i                  Javascript runtime                 

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

Now, install Node.js version 16 using the following command:

dnf install @nodejs:16

Once Node.js is installed, verify the Node.js version with the following command:

node --version

Sample output:

v16.13.1

You can also check the npmversion using the following command:

npm -v

Sample output:

8.1.2

Now, use npm to install the Yarn package as shown below:

npm install --global yarn

You can verify the Yarn version with the following command:

yarn -v

Sample output:

1.22.18

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

npm uninstall -g yarn

Step 3 – Install YARN from Yum Repository

By default, the Yarn package is not included in the Oracle Linux default repository, so you will need to add the Yarn repo to your system.

First, 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 Yarn repo is created, install the Yarn package with the following command:

dnf install yarn -y

Once the Yarn has been installed, activate the Yarn environment variable using the following command:

source /etc/profile

Next, verify the Yarn version with the following command:

yarn -v

Sample output:

1.22.18

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

Yarn also provides a bash script that allows you to install Yarn on any Linux operating system. 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:

> 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.18! 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.18

Conclusion

In the above guide, we explained three-way to install the Yarn package on Oracle Linux 8. You can now use your preferred way to install the Yarn on your system. Give it a try on your virtual server from Atlantic.Net!

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

Top 10 Best Cybersecurity Training Services
How to Install Ansible on Oracle Linux 8
How to Install LEMP Server on Oracle Linux 8
How to Install and Configure Apache Webserver on Oracle Linux 8
How to Install and Configure Nginx Webserver on Oracle 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

2008 Lookout Dr,

Dallas, Texas 75044

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