Assuming that you already have installed Node.js on Ubuntu or Debian system. In this article: You can choose any of the 3 methods to install yarn package manager on your system.

Method 1: Install Yarn using NPM

The yarn package is available to install with NPM. You can simply use the npm command as follows to install Yarn globally. To install yarn for the current project only just remove the -g option from the command. Check the installed version:

Method 2: Install Yarn using Shell Script

Yarn also provides a shell script for installation. This is the most recommended way to install Yarn on a Linux system. This script downloads the yarn archive and extracts it under the .yarn directory under your home directory. Also, set the PATH environment variable. As this installation put all files under the user’s home directory, So it is available for the current users only.

Method 3: Install Yarn using PPA

The Yarn team also provides an Apt repository to install yarn on a Debian machine. Run the following commands to import gpg key and configure yarn apt repository. Ubuntu 22.04 and Debian 11 or the newer versions, use the following commands to configure the repository: Now type the following commands to install yarn on Ubuntu Debian and Linux. This will complete the Yarn installation on your system.

Conclusion

In this blog post, you have learned 3 methods of installing the yarn package manager on Ubuntu, Debian, or Linux Mint systems. You can choose any of the three methods to install yarn on Linux system.