In this post, we will explain the following:
- Install Yarn using NPM
- Install Yarn from repository NPM
- Install Yarn with Script
- A server running Rocky Linux 8 on the Atlantic.Net Cloud Platform
- A root password is configured on your server
Step 1 – Create Atlantic.Net Cloud Server
First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Rocky Linux as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.
Once you are logged in to your server, run the following command to update your base system with the latest available packages.
dnf update -y
Step 2 – Install YARN using NPM
In this section, we will show you how to install Yarn via Node Package Manager.
First, you will need to add the NodeSource repository to your system. You can add it with the following command:
curl -sL https://rpm.nodesource.com/setup_16.x | bash -
Once the repository is added, install the Node.js and NPM package using the following command:
dnf install nodejs npm -y
Next, verify the Node.js version with the following command:
You can also check the NPM version using the following command:
Now, install the Yarn package using the NPM as shown below:
npm install --global yarn
You should get the following output:
npm notice New minor version of npm available! 7.21.1 -> 7.24.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.24.0
npm notice Run npm install -g [email protected] to update!
Next, verify the Yarn version with the following command:
You can uninstall the Yarn package from your system using the following command:
npm uninstall -g yarn
Step 3 – Install YARN from Yum Repository
In this section, we will show you how to install the Yarn package from the Rocky Linux repository. By default, the Yarn package is not included in the Rocky Linux default repository, so you will need to add the Yarn repo to your system.
You can create a Yarn repo with the following command:
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
Once the repository is created, install the Yarn package with the following command:
dnf install yarn -y
Once Yarn has been installed, verify the Yarn version with the following command:
If you want to remove the Yarn package from your system, run the following command:
dnf remove yarn -y
Step 4 – Install YARN with Script
In this section, we will show you how to install Yarn via the Yarn installation script.
You can download and run the Yarn installation script using the following command:
curl -o- -L https://yarnpkg.com/install.sh | bash
Once the Yarn package has been installed, you should get the following output:
> Successfully installed Yarn 1.22.5! Please open another terminal where the `yarn` command will now be available.
Next, activate the system path with the following command:
Next, verify the Yarn version using the following command:
In the above guide, we explained the three-way to install the Yarn package on RockyLinux 8. You can now use your preferred way to install the Yarn to your system. Get started with Yarn on a dedicated host from Atlantic.Net today!