How to Install Node.js on a Linux VPS
Short answerInstall an official Node.js LTS build with NodeSource (apt/dnf) or nvm, then verify with node -v and npm -v. This article covers installing Node.js — not a full PM2/Nginx production deploy.
Overview
Use this guide when you need the Node.js runtime on a VPSGrid Linux VPS (Ubuntu, Debian, AlmaLinux, or Rocky). After Node is installed, you can run apps with node/npm. For process managers and reverse proxies, use a separate deploy guide once the runtime works.
Before you start
- SSH access as
rootor a sudo user - Your VPS primary IP from the welcome email or client area
- Prefer an LTS Node.js release for production
Option A — NodeSource packages (system-wide)
Ubuntu / Debian
ssh root@YOUR_PRIMARY_IP
apt update
apt install -y ca-certificates curl gnupg
# Example: Node.js 20.x LTS via NodeSource setup script
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt install -y nodejs
node -v
npm -vAlmaLinux / Rocky
ssh root@YOUR_PRIMARY_IP
dnf install -y curl
curl -fsSL https://rpm.nodesource.com/setup_20.x | bash -
dnf install -y nodejs
node -v
npm -vIf the setup script URL changes, use the current instructions from NodeSource distributions.
Option B — nvm (per-user installs)
Useful when you need multiple Node versions without changing the whole system.
# As the user who will run Node apps
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# Re-open the shell or source nvm, then:
nvm install --lts
nvm use --lts
node -v
npm -vQuick verification
node -e "console.log('Node OK', process.version)"
npm -v
which nodeWhat this guide does not cover
- PM2 process management / cluster mode
- Nginx reverse proxy and HTTPS
- Application deployment pipelines
Those belong in a deploy article after Node itself is installed and node -v works.
Important notes
- VPSGrid is unmanaged — you install and maintain Node.js inside the guest OS
- Keep Node updated for security; pin versions intentionally for production apps
- Do not expose a Node app directly on
0.0.0.0without a firewall/reverse proxy plan
VPSGrid context
VPSGrid provides the KVM VPS, primary IP, and power controls. You administer the Linux guest, Node.js runtime, packages, and application code.
Frequently Asked Questions
Which install method should I choose?
Use NodeSource for a simple system-wide LTS install. Use nvm if you need multiple Node versions per user.
Does VPSGrid manage Node.js for me?
No. On unmanaged VPS plans you install and update Node.js yourself.
Can I install any Node version?
Yes, within what your chosen method supports. Prefer LTS for production unless your app requires a specific major version.
Related Articles
Need More Help?
Open a ticket at billing.vpsgrid.net with your service ID, OS version, and the output of node -v / install errors.
Was this answer helpful?