How to install Yarn on Fedora 34

To Install Yarn on Fedora 34

Introduction:

The yarn package manager is an advanced package management tool for Node.js applications, offering a fast, secure, and reliable alternative to other Node.js package manager options.

Installation command:

Step 1: Check the version of the OS by using the below command

[root@linuxhelp ~]# cat /etc/os-release
NAME=Fedora
VERSION="34 (Workstation Edition)"
ID=fedora
VERSION_ID=34
VERSION_CODENAME=""
PLATFORM_ID="platform:f34"
PRETTY_NAME="Fedora 34 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:34"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/34/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=34
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=34
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation

Step 2: Add the yarn repository to the system repository by using the below command

[root@linuxhelp ~]# curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo

Step 3: Install the yarn by using the below command

[root@linuxhelp ~]# dnf install yarn
Fedora 34 openh264 (From Cisco) - x86_64                         1.1 kB/s | 989  B     00:00    
Fedora Modular 34 - x86_64                                       7.3 kB/s | 5.8 kB     00:00    
Fedora Modular 34 - x86_64 - Updates                             6.3 kB/s | 4.7 kB     00:00    
Fedora Modular 34 - x86_64 - Updates                             202 kB/s | 875 kB     00:04    
Fedora 34 - x86_64 - Updates                                     5.0 kB/s | 4.7 kB     00:00    
Fedora 34 - x86_64 - Updates                                     1.2 MB/s |  15 MB     00:12    
Fedora 34 - x86_64                                               6.9 kB/s | 5.8 kB     00:00    
MySQL 8.0 Community Server                                       5.6 kB/s | 2.6 kB     00:00    
MySQL 8.0 Community Server                                       7.6 MB/s | 1.0 MB     00:00    
MySQL Connectors Community                                       2.1 kB/s | 2.6 kB     00:01    
MySQL Connectors Community                                       397 kB/s |  36 kB     00:00    
MySQL Tools Community                                            6.6 kB/s | 2.6 kB     00:00    
MySQL Tools Community                                            3.2 MB/s | 239 kB     00:00    
determining the fastest mirror (44 hosts).. done.==============] 7.8 kB/s | 3.5 kB     00:00 ETA
Remi's Modular repository - Fedora 34 - x86_64                   281  B/s | 833  B     00:02    
done.s Modular repository - F100% [============================] 9.4 kB/s | 3.5 kB     00:00 ETA
Remi's Modular repository - Fedora 34 - x86_64                   403 kB/s | 518 kB     00:01    
Remi's RPM repository - Fedora 34 - x86_64                       1.2 kB/s | 833  B     00:00    
Remi's RPM repository - Fedora 34 - x86_64                       2.1 MB/s | 3.0 MB     00:01    
Yarn Repository                                                  888 kB/s | 364 kB     00:00    
Dependencies resolved.
=================================================================================================
 Package                  Architecture   Version                            Repository      Size
=================================================================================================
Installing:
 yarn                     noarch         1.22.17-1                          yarn           1.2 M
Installing dependencies:
 nodejs                   x86_64         1:14.16.0-4.fc34                   fedora          92 k
 nodejs-libs              x86_64         1:14.16.0-4.fc34                   fedora          13 M
 openssl                  x86_64         1:1.1.1k-1.fc34                    fedora         667 k
Installing weak dependencies:
 nodejs-docs              noarch         1:14.16.0-4.fc34                   fedora         5.8 M
 nodejs-full-i18n         x86_64         1:14.16.0-4.fc34                   fedora         7.8 M
 npm                      x86_64         1:6.14.11-1.14.16.0.4.fc34         fedora         3.3 M

Transaction Summary
=================================================================================================
Install  7 Packages

Total download size: 31 M
Installed size: 154 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): nodejs-14.16.0-4.fc34.x86_64.rpm                            220 kB/s |  92 kB     00:00    
(2/7): nodejs-docs-14.16.0-4.fc34.noarch.rpm                   3.3 MB/s | 5.8 MB     00:01    
(3/7): npm-6.14.11-1.14.16.0.4.fc34.x86_64.rpm                  4.1 MB/s | 3.3 MB      00:00    
(4/7): nodejs-full-i18n-14.16.0-4.fc34.x86_64.rpm             2.9 MB/s | 7.8 MB      00:02    
(5/7): openssl-1.1.1k-1.fc34.x86_64.rpm                             3.0 MB/s | 667 kB      00:00    
(6/7): yarn-1.22.17-1.noarch.rpm                                        2.7 MB/s | 1.2 MB       00:00    
(7/7): nodejs-libs-14.16.0-4.fc34.x86_64.rpm                     3.5 MB/s |  13 MB      00:03    
-------------------------------------------------------------------------------------------------
Total                                                            6.3 MB/s |  31 MB     00:04     
warning: /var/cache/dnf/yarn-39eb54bf733530c3/packages/yarn-1.22.17-1.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 6963f07f: NOKEY
Yarn Repository                                                  3.7 kB/s | 1.6 kB     00:00    
Importing GPG key 0x6963F07F:
 Userid     : "Yarn RPM Packaging <yarn@dan.cx>"
 Fingerprint: 9A6F 73F3 4BEB 7473 4D8C 6914 9CBB B558 6963 F07F
 From       : https://dl.yarnpkg.com/rpm/pubkey.gpg
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: npm-1:6.14.11-1.14.16.0.4.fc34.x86_64                  1/1 
  Preparing        :                                                                              1/1 
  Installing       : openssl-1:1.1.1k-1.fc34.x86_64                                  1/7 
  Installing       : nodejs-libs-1:14.16.0-4.fc34.x86_64                         2/7 
  Installing       : nodejs-docs-1:14.16.0-4.fc34.noarch                        3/7 
  Installing       : nodejs-full-i18n-1:14.16.0-4.fc34.x86_64                  4/7 
  Installing       : npm-1:6.14.11-1.14.16.0.4.fc34.x86_64                       5/7 
  Installing       : nodejs-1:14.16.0-4.fc34.x86_64                                6/7 
  Installing       : yarn-1.22.17-1.noarch                                               7/7 
  Running scriptlet: yarn-1.22.17-1.noarch                                         7/7 
  Verifying        : nodejs-1:14.16.0-4.fc34.x86_64                               1/7 
  Verifying        : nodejs-docs-1:14.16.0-4.fc34.noarch                       2/7 
  Verifying        : nodejs-full-i18n-1:14.16.0-4.fc34.x86_64                 3/7 
  Verifying        : nodejs-libs-1:14.16.0-4.fc34.x86_64                        4/7 
  Verifying        : npm-1:6.14.11-1.14.16.0.4.fc34.x86_64                      5/7 
  Verifying        : openssl-1:1.1.1k-1.fc34.x86_64                                 6/7 
  Verifying        : yarn-1.22.17-1.noarch                                              7/7 

Installed:
  nodejs-1:14.16.0-4.fc34.x86_64                    nodejs-docs-1:14.16.0-4.fc34.noarch         
  nodejs-full-i18n-1:14.16.0-4.fc34.x86_64          nodejs-libs-1:14.16.0-4.fc34.x86_64         
  npm-1:6.14.11-1.14.16.0.4.fc34.x86_64             openssl-1:1.1.1k-1.fc34.x86_64              
  yarn-1.22.17-1.noarch                            
Complete!

Step 4: Once the yarn is installed then install the packages of the yarn by using the below command

[root@linuxhelp ~]# curl -o- -L https://yarnpkg.com/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    53  100    53    0     0    144      0 --:--:-- --:--:-- --:--:--   144
100  7152  100  7152    0     0   8211      0 --:--:-- --:--:-- --:--:--  8211
Installing Yarn!
> Downloading tarball...

[1/2]: https://yarnpkg.com/latest.tar.gz --> /tmp/yarn.tar.gz.CcGYYDzj0i
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    56  100    56    0     0     94      0 --:--:-- --:--:-- --:--:--    94
100    94  100    94    0     0    112      0 --:--:-- --:--:-- --:--:--   112
100   657  100   657    0     0    501      0  0:00:01  0:00:01 --:--:--   501
100 1216k  100 1216k    0     0   412k      0  0:00:02  0:00:02 --:--:--  760k

[2/2]: https://yarnpkg.com/latest.tar.gz.asc --> /tmp/yarn.tar.gz.CcGYYDzj0i.asc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    60  100    60    0     0    210      0 --:--:-- --:--:-- --:--:--   210
100    98  100    98    0     0    298      0 --:--:-- --:--:-- --:--:--   298
100   661  100   661    0     0   1001      0 --:--:-- --:--:-- --:--:--  645k
100  1028  100  1028    0     0    876      0  0:00:01  0:00:01 --:--:--   876
> Verifying integrity...
gpg: key 1646B01B86E50310: public key "Yarn Packaging <yarn@dan.cx>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: Signature made Sat 16 Oct 2021 08:38:26 PM IST
gpg:                using RSA key 6D98490C6F1ACDDD448E45954F77679369475BAA
gpg: Good signature from "Yarn Packaging <yarn@dan.cx>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
     Subkey fingerprint: 6D98 490C 6F1A CDDD 448E  4595 4F77 6793 6947 5BAA
> 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.17! Please open another terminal where the `yarn` command will now be available.

Step 5: After the package is installed. Now check the version of yarn by using the below command

[root@linuxhelp ~]# yarn -v
1.22.17

With this method, the installation of the Yarn on Fedora 34 comes to an end

FAQ
Q
What is the command to check the version of Yarn?
A
To check the version of Yarn use the command is # yarn -v
Q
How do we install Yarn packages on Fedora 34?
A
To install Yarn packages on Fedora 34 use the command # curl -o- -L https://yarnpkg.com/install.sh | bash
Q
How do we add the yarn repository to the system repository?
A
To add the yarn repository to the system repository use the command # curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
Q
How do we enable the Yarn Repository?
A
To enable the Yarn Repositor command use # curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
Q
What is Yarn software?
A
The yarn is an advanced package management software for Node.js applications. It is a fast, secure, and reliable alternative that any other Nodejs package manager.