Home / Exciting tips / Linux / Linux Yarn: How to Get Things Going

Linux Yarn: How to Get Things Going

Yarn is an alternative to NPM. It is used to install NodeJS packages. It is widely used in the Linux community due to its speed and stability. In this guide, we will walk you through how you can get the Yarn package manager tool up and running on popular Linux operating systems.

Ubuntu installation instructions

Setting up Yarn on Ubuntu is best done by making use of the Yarn third-party software repository. To enable this repository, you must start by installing the Curl tool. To install Curl, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard and enter the Apt command below.

sudo apt install curl

Once the Curl tool is set up on your Ubuntu Linux PC, you must use it to download the Yarn public key, which is necessary to access the third-party software repository on Ubuntu.

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

After downloading the Yarn public key to your Ubuntu PC, it is time to add the third-party software repository to Ubuntu. Using the echo command below, add the repo.

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

Following the addition of the Yarn third-party software repository, it is time to update Ubuntu’s software sources. Using the update command, refresh Ubuntu’s software sources.

sudo apt update

Once Ubuntu is up to date, make use of the apt install command to get the latest Yarn set up on your system. Please note that the package Cmdtest conflicts with Yarn on Ubuntu. If you have Cmdtest installed, please remove it with sudo apt remove cmdtest before attempting to install Yarn.

sudo apt install yarn

Debian installation instructions

The developers make it possible to get Yarn working on Debian thanks to their third-party software repository. To start the installation, you must install the Curl program if you do not have it set up already. To install Curl, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard and use the apt-get command below.

sudo apt-get install curl

With the Curl app set up on your Debian PC, it can finally be used to download the Yarn public key. This key is necessary to download, as Debian will refuse to work with the Yarn repository otherwise.

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

Now that the Yarn public key is on your Debian Linux PC, it is time to add the third-party software repository so that it can be used to install Yarn. To add the software repository to your Debian PC, make use of the echo command below.

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

Now that the Yarn third-party software repository is on your Debian Linux PC, it is time to update the system. Using the update command, refresh the software sources on Debian.

sudo apt-get update

With everything up to date, it is possible to install Yarn on Debian with the following apt-get command in the terminal window.

sudo apt install yarn

Arch Linux installation instructions

On Arch Linux, the Yarn tool is incredibly straightforward to install. There’s no need to set up any third-party software repositories. Instead, just open up a terminal window and enter the following Pacman command below.

sudo pacman -S yarn

Fedora installation instructions

Those on Fedora Linux looking to get the latest Yarn working must do it by enabling the developer’s third-party software repository. First, the Curl program must be installed, as it is used to download the Fedora repo file.

Note: these installation instructions also work with CentOS and RedHat Enterprise Linux. Just replace Dnf with Yum.

To install Curl on your Fedora Linux PC, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, use the following dnf command.

sudo dnf install curl

With the Curl app up and running in Fedora, use the curl command to download the Yarn repo file to your system. This repo file contains all the information required to install Yarn on Fedora.

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

Once the repository is on your Fedora Linux PC, the installation of Yarn can begin. Using the dnf install command, get Yarn installed.

sudo dnf install yarn

OpenSUSE installation instructions

Sadly, OpenSUSE Linux isn’t on the Yarn website. However, there is a dedicated Yarn installation page in the OpenSUSE Build Service. To start the installation, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T. Then, follow the installation instructions below that correspond with your OpenSUSE release.

Tumbleweed

First, use the addrepo command to subscribe to the Yarn repository for Tumbleweed.

sudo zypper addrepo https://download.opensuse.org/repositories/home:darix:apps/openSUSE_Tumbleweed/home:darix:apps.repo

Next, run the refresh command.

sudo zypper refresh

Lastly, install Yarn on Tumbleweed.

sudo zypper install yarn

LEAP 15.1

First, use the addrepo command to subscribe to the Yarn repository for LEAP 15.1.

sudo zypper addrepo https://download.opensuse.org/repositories/home:Ximi1970:Servers:Gitlab:12.5-stable/openSUSE_Leap_15.2/home:Ximi1970:Servers:Gitlab:12.5-stable.repo
zypper refresh

Next, run the refresh command.

sudo zypper refresh

Lastly, install Yarn on LEAP 15.1.

sudo zypper install yarn

LEAP 15.2

First, use the addrepo command to subscribe to the Yarn repository for LEAP 15.2.

sudo zypper addrepo https://download.opensuse.org/repositories/home:Ximi1970:Servers:Gitlab:12.5-stable/openSUSE_Leap_15.2/home:Ximi1970:Servers:Gitlab:12.5-stable.repo

Next, run the refresh command.

sudo zypper refresh

Lastly, install Yarn on LEAP 15.2.

sudo zypper install yarn

About excitingtips

Check Also

How to install the Snow GTK theme on Linux

Snow is a light theme for Linux that follows a Mac-like design spec with greyish …

Leave a Reply

Your email address will not be published. Required fields are marked *