To install Yarn in Ubuntu, we add the package repository with Yarn before we install it.
We run
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
to add the Yarn package repo.
And then we run
sudo apt-get update && sudo apt-get install yarn
to run apt
to install yarn
.