This write-up will discuss the method to install Yarn on Ubuntu 22.04. So, let’s start!
How to Install Yarn on Ubuntu 22.04
To install Yarn on Ubuntu 22.04, you must follow the below-given step-by-step instructions.
Step 1: Update system repositories
Press “CTRL+ALT+T” to open the terminal of the Ubuntu 22.04 and run the below-given command to update system repositories:
Step 2: Install CURL on Ubuntu 22.04
After updating the Ubuntu 22.04 system repositories, execute the following command for CURL installation:
The given error-free output signifies that we have successfully installed CURL on our system:
Step 3: Import Yarn GPG key
In the next step, utilize the “curl” command for importing the Yarn GPG key to Ubuntu system repositories:
Step 4: Enable Yarn repository
After importing the GPG key, you have to enable the Yarn repository on your Ubuntu 22.04 system. For this purpose, write out the following command in the terminal:
Step 5: Install Yarn on Ubuntu 22.04
If you have carefully followed the previous steps, then at this point, your Ubuntu 22.04 system is all ready for Yarn installation. To do so, execute the below-given command:
Enter “y” to permit the installation process to continue and wait for a few minutes:
Step 6: Check Yarn version
To verify if Yarn is successfully installed or not, then check its installed version on your Ubuntu 22.04 system:
As you can see that currently Yarn version “0.32+git” is installed on our system:
How to upgrade Yarn on Ubuntu 22.04
Want to upgrade Yarn to the latest version? If yes, then first install “npm” on your system; if you do not have it already:
Then, download the “Yarn” tarball and install its latest version by writing out the following command in the Ubuntu 22.04 terminal:
As you can see from the highlighted part of the below output, Yarn installed on our system is upgraded to the latest “1.22.18” version:
Lastly, execute the “yarn” command with the “–version” option to confirm that Yarn is upgraded to the latest version:
We have compiled the simplest method to install Yarn on Ubuntu 22.04. Moreover, the procedure to upgrade the current Yarn to the latest version is also provided to you.
To install Yarn on Ubuntu 22.04, first of all, install CURL with the “$ sudo apt install curl” command. After doing so, import the Yarn GPG key and enable its repository on your system. Then, execute the “$ sudo apt install yarn” for Yarn installation. You can also utilize the “$ sudo curl –compressed -o- -L https://yarnpkg.com/install.sh | bash” to upgrade Yarn. This write-up discussed the method to install Yarn on Ubuntu 22.04.