Install Node.js on Ubuntu 20.04

Node.js is a JavaScript runtime for server-side programming. It allows developers to create scalable backend functionality using JavaScript, a language many are already familiar with from browser-based web development.

In this guide, we will show you three different ways of getting Node.js installed on an Ubuntu 20.04 server:

  • using apt to install the nodejs package from Ubuntu’s default software repository
  • using apt with an alternate PPA software repository to install specific versions of the nodejs package
  • installing nvm, the Node Version Manager, and using it to install and manage multiple versions of Node.js

For many users, using apt with the default, the repo will be sufficient. If you need specific newer (or legacy) versions of Node, you should use the PPA repository.


This guide assumes that you are using Ubuntu 20.04. Before you begin, you should have a non-root user account with sudo privileges set up on your system.

If you are actively developing Node applications and need to switch between node versions frequently, choose the nvm method.

Get Started

To get this version, you can use the apt package manager. Refresh your local package index first by typing:

sudo apt update

Then install Node.js:

sudo apt install nodejs

Check that the install was successful by querying node for its version number:

node -v


If the package in the repositories suits your needs, this is all you need to do to get set up with Node.js. In most cases, you’ll also want to also install npm, the Node.js package manager. You can do this by installing the npm package with apt:

sudo apt install npm

This will allow you to install modules and packages to use with Node.js.


There are quite a few ways to get up and running with Node.js on your Ubuntu 20.04 server. Your circumstances will dictate which of the above methods is best for your needs. While using the packaged version in Ubuntu’s repository is the easiest method, using nvm or a NodeSource PPA offers additional flexibility.


Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

Install Django and Set Up a Development Environment on Ubuntu 20.04

Next Post

Install and Use PostgreSQL on Ubuntu 18.04

Related Posts