YARN is a advanced package management software for Node.js applications and it is a package manager for the code that we want to run on our system and it allows us to use and share the code with the different user.It is a fast, secure, and reliable Nodejs package manager.
In this tutorial we are going to install Yarn In three ways for CentOS, Redhat and Fedora operating system.
Installing Yarn using NPM
We can install Yarn package with NPM. You can simply run the below command to install Yarn globally
$ sudo npm install yarn -g
Check installed version:
$ yarn -v 1.19.1
Install Yarn using Script
This is the most recommended way to install the yarn . it downloads the yarn archive and extracts under the .yarn directory at home and also set the PATH environment variable.
$ curl -o- -L https://yarnpkg.com/install.sh | bash
Using above installation yarn is available only for the current user.
Install Yarn using Yum
Yarn packages are also available with yum package manager. we can configure yarn from official yum repository using the below command.
$ curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
For installation now run the following command.
sudo yum install yarn ## CentOS and Redhat Operating System sudo dnf install yarn ## Fedora Operating systems