Home / Linux / How to Install Node.js and npm/Yarn

How to Install Node.js and npm/Yarn

Install Node.js safely using NodeSource, verify node/npm, and install Yarn. Includes commands and verification steps.

Views: 18 Unique: 16 Updated: 2026-03-17

What this is

This guide shows how to install Node.js and package managers (npm and Yarn) on a VPS.

Prerequisites

  • SSH + sudo

Step-by-step

Ubuntu/Debian (NodeSource)

sudo apt update
sudo apt install -y curl ca-certificates
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

Verify Node and npm

node -v
npm -v

Install Yarn (via npm)

sudo npm install -g yarn
yarn -v

Warnings & notes

  • Prefer LTS versions of Node for servers.

Conclusion

Node.js and npm/Yarn are installed. Next step: install dependencies and run your app using a process manager.

Back to category