Yarn is a Package Manager for Node.js that replaces NPM. The Yarn has been developed with the goal of improving and fixing the problems that exist in NPM and is being expanded by dozens of companies and hundreds of developers. Due to Yarn’s good features, the project’s Github stars are now almost double the number of NPMs. In this article, we are going to teach you to step by step How to Install Yarn on Debian 11 (bullseye). You can see the packages available in Eldernode if you want to buy a Linux VPS server.
Table of Contents
How to Install Yarn on Debian 11 | Debian 10
Introduction to Yarn and its Features
Yarn was actually Facebook’s attempt to make up for npm deficiencies. Technically, Yarn was not created instead of npm because it still uses npm registry modules, but a new installer that still uses the npm structure. In simpler language, the registry is still the same registry, but the installation method is different. Since Yarn and npm have a package set, you will not need to make major changes if you want to go from Yarn to npm or vice versa.
Yarn enables you to manage resources and plan jobs in Hadoop. Here are some of the features of Yarn:
1. Multi-tenancy
With this feature, you can use multiple open source and dedicated data access engines for batch, interactive, and real-time access to the same dataset.
2. Cluster utilization
You can allocate cluster resources dynamically to improve resource usage.
3. Multiple resource types
You can use several different sources such as memory, CPU, and GPU.
4. Scalability
You can significantly improve data center processing power by using Yarn. ResourceManager YARN focuses exclusively on scheduling and maintains its speed by extending clusters to thousands of petabytes of data management nodes.
5. Compatibility
The MapReduce applications developed for Hadoop 1 run on YARN without interrupting any existing processes. YARN maintains API compatibility with the previous stable version of Hadoop.
In the continuation of this article, join us to show you how to install Yarn on Debian 11.
Install Yarn on Debian 11 | Debian 10
In this section, we want to teach you how to install Yarn on Debian 11. To do this you need to perform the following steps as root or user with Sudo Privileges to install Yarn in Debian 11 or Debian 10.
Since the yarn package is available in the Yarn repository, you must run the following commands to enter the repository GPG key and activate the APT repository:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Then you need to update the package list using the following commands and install Yarn:
sudo apt update
sudo apt install yarn
Note that Node.js will be installed on your system by executing the above command. If you are using nvm, you can skip installing Node.js with the following:
sudo apt install --no-install-recommends yarn
Finally, by executing the following command, you can check the installation status of Yarn:
yarn --version
How to Use Yarn on Debian 11 (bullseye)
After you have successfully installed Yaren on Debian 11, we now want to teach you how to use it. Follow the steps below.
First, we want to show you how to create a Yarn project. To do this, you must first enter the yarn init command and then the project name. For example, to create a project called my_project, you must do the following:
yarn init my_project
You can also launch a Yarn project in an existing directory by going to the directory:
yarn init
In the next step you can use the following command to add a package as a dependency to your project:
yarn add [package_name]
If you want to install a special version or label, you can use the following command:
yarn add [package_name]@[version_or_tag]
The next step is to upgrade the dependencies. You can upgrade packages by running one of the following commands:
yarn upgrade
or
yarn upgrade [package_name]
or
yarn upgrade [package_name]@[version_or_tag]
You can also use the following command to remove a package of project dependencies:
yarn remove [package_name]
Finally, run one of the following commands to install all the dependencies of an existing project specified in the package.json file:
yarn
or
yarn install
Conclusion
Yarn uses the NPM repository and is highly compatible with this tool, so migrating from NPM to Yarn is easy. In this article, we tried to teach you how to install Yarn on Debian 11 (bullseye) after introducing Yarn and its features. You can refer to the articles How To Install Yarn On CentOS 8 and Ubuntu 20.04 if you wish.