• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install Yarn on Ubuntu 20.04

Written by Rahul, Updated on September 1, 2020

Yarn is the fast, reliable, and secure package management system for Nodejs application. it have multiple benefit over the npm. Yarn makes a cache for every package downloaded on your system and reuse when required again. It doesn’t need to download it again and again.

This tutorial provides 3 methods to install Yarn on Ubuntu 20.04 LTS (Focal Fosaa) Linux system. You can choose one of the below methods as per your choice and system environments.

Before you begin yarn installation, don’t forgot to install Node.js on your system.

1. Install Yarn on Ubuntu 20.04 (Using PPA)

Yarn provides an official repository for the installation on Linux system. Using the PPA, yarn install globally on system. Every system user can access this yarn.

First, import the GPG key to verify the yarn packages before the installation.

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

Then, enable the Yarn package manager repository, type:

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Next, run below commands to install yarn on Ubuntu 20.04 Linux system:

sudo apt update && sudo apt install yarn

Once the installation finished, check the installed yarn version
.

yarn --version

1.22.5

2. Install Yarn on Ubuntu 20.04 (Using NPM)

Yarn package manager also available as a npm module. You can install Yarn on Ubuntu 20.04 using the module by executing command:

npm install -g yarn

The “-g” option will install the yarn globally on your system. So you can access it from any where or any project of your system.

3. Install Yarn on Ubuntu 20.04 (Using Script)

You can also use the bash script to install yarn provided by the yarn team. The script installed yarn under to users home directory. It means, when you install yarn with this script will accessible to current user only.

To install Yarn on Ubuntu 20.04 using a shell script, type:

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

The installer makes yarn environment configuration in users .bashrc file. You can reload this file to load environment

source ~/.bashrc

All done. Yarn has been installed successfully.

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

1 Comment

  1. Avatar polokoki Reply
    December 2, 2020 at 6:18 am

    thank you

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Ubuntu 20.04 5
  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
  • How To Install NVM on macOS with Homebrew 0
  • How to Install .NET Core on Debian 10 0
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy