In this tutorial, we will be guiding you on how to install Yarn on your Linux VPS server. The Linux distro used in this guide is Ubuntu version 18.04.
Step 1: Access Server with SSH
Firstly, you will need to access your server using a SSH and also requires the root access.
Step 2: Add GPG Key
It is necessary to add the GPG key to your server by using the following command.
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
It is used to assure that all the downloaded packages are authentic.
Step 3: Add Yarn Repository
After adding the GPG Key, the next thing that needs to be added is the Yarn repository. To install the Yarn repository into your server, use the following command.
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Step 4: Installation
Now that you have the Yarn repository installed, you can install it on your server. However, it is always recommended to update all your repositories before making any installation. To update your repositories, use the following command.
sudo apt update
After finishing updating, use the following command to install Yarn on your server.
sudo apt install yarn node.js
Step 5: Verification
Finally, check if the installation for Yarn was successful or not. To verify it, you can check the Yarn version installaed using the following command.
The output shown will be the version of Yarn you had installed. If it is not installed correctly, you won’t be able to see the version or might not be found. Retrace the previous steps to check if you missed any steps if the installation failed.
With this, you have successfully installed Yarn onto your VPS.