How to install Node.js on Ubuntu is one of the most common first steps for developers building backend applications, APIs, real-time services, or full-stack JavaScript projects in 2025–2026. Node.js lets you run JavaScript server-side, and Ubuntu remains one of the most popular Linux distributions for hosting Node applications.
In this up-to-date guide, you’ll learn how to install Node.js on Ubuntu using three reliable methods: the default Ubuntu repositories (simplest), the NodeSource PPA (for specific or newer versions), and NVM (Node Version Manager) for full version control and flexibility. All steps are tested and working on Ubuntu 22.04 LTS, 24.04 LTS, and 24.10.
Key Takeaways – How to Install Node.js on Ubuntu
- How to install Node.js on Ubuntu via default apt is fastest for beginners but often gives older versions.
- NodeSource PPA provides the latest stable or LTS releases through apt (recommended for most production use).
- NVM lets you install, switch between, and manage multiple Node.js versions on the same system without conflicts.
- npm is included automatically with NodeSource and NVM installs; default apt may require a separate sudo apt install npm.
- Always verify installation with node -v and npm -v.
- Remove cleanly: sudo apt purge nodejs (apt), nvm uninstall <version> (NVM).
Prerequisites
- Ubuntu server (22.04 LTS, 24.04 LTS, or 24.10 recommended)
- Non-root user with sudo privileges
- Basic terminal knowledge
- Internet connection
Method 1: How to Install Node.js on Ubuntu Using Default Repositories (Simplest)
Ubuntu’s default repositories always include a stable (but usually older) version of Node.js.
- Update package index:
sudo apt update
2. Install Node.js:
sudo apt install nodejs
3. (Optional) Install npm if not included:
sudo apt install npm
4. Verify:
node -v
npm -v
Example output (Ubuntu 24.04):
v20.17.0
10.8.3
Best for: Quick testing, learning, or when you don’t need the absolute latest version.
Method 2: How to Install Node.js on Ubuntu Using NodeSource PPA (Recommended for Production)
NodeSource maintains official PPAs with the latest Node.js versions (LTS and Current).
- Choose your version and download the setup script (examples for v22 LTS and v24 Current):
# For Node.js 22.x LTS (recommended for production in 2025–2026)
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
# OR for latest Current (v24.x as of early 2026)
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
2. Install Node.js (includes npm):
sudo apt update
sudo apt install nodejs
3. Verify:
node -v
npm -v
Example output:
v22.14.0 # or v24.x depending on choice
10.9.0
Best for: Most real-world projects — you get the latest stable or current release through apt.
Method 3: How to Install Node.js on Ubuntu Using NVM (Best for Developers)
NVM (Node Version Manager) lets you install and switch between any Node.js version easily — perfect for development.
Install NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
2. Load NVM into current shell:
source ~/.bashrc
# or restart terminal
3. List available versions:
nvm list-remote
4. Install latest LTS (recommended):
nvm install --lts
Or specific version:
nvm install 22.14.0
nvm install 24.13.0
5. Use a version (sets as default):
console.log( 'Code is Poetry' );nvm use 22
# or
nvm use node # latest
6. Verify:
node -v
npm -v
Best for: Developers working on multiple projects with different Node requirements.
Removing / Uninstalling Node.js
Depending on method:
- Default apt / NodeSource:Bash
sudo apt purge nodejs npm
sudo apt autoremove
- NVM:
nvm uninstall 22
# or remove NVM completely:
rm -rf ~/.nvm
# Then remove lines from ~/.bashrc or ~/.zshrc
How to Install Node.js on Ubuntu – FAQ (2025–2026)
- What is the easiest way to install Node.js on Ubuntu?
Use sudo apt install nodejs — the fastest way to install Node.js on Ubuntu for beginners. - How do I install the latest Node.js on Ubuntu?
Use NodeSource PPA — curl the setup script and sudo apt install nodejs to install Node.js on Ubuntu with the newest versions. - Should I use NVM to install Node.js on Ubuntu?
Yes — if you need multiple versions or frequent switching, NVM is the best way to install Node.js on Ubuntu. - How do I check which version of Node.js is installed on Ubuntu?
Run node -v after installation — always verify when you install Node.js on Ubuntu. - How do I remove Node.js completely from Ubuntu?
Use sudo apt purge nodejs (apt) or nvm uninstall (NVM) — clean uninstall after you install Node.js on Ubuntu.
Summary
You now know every major way to install Node.js on Ubuntu in 2025–2026: default apt (quick & simple), NodeSource PPA (latest stable releases), and NVM (full version flexibility). Choose based on your needs — simplicity, newest features, or multi-version development.
Next steps: Set up a basic Express server, use PM2 for production process management, add HTTPS with Let’s Encrypt, or deploy to Progressive Robot App Platform.
Recommended Resources
- Official Node.js Installation Docs
- NodeSource Distributions (PPAs)
- NVM GitHub Repository
- How to Set Up a Node.js App for Production on Ubuntu
- PM2 – Process Manager for Node.js