This is a tutorial on how to install the latest LTS (Long Term Support) release of Node.js in Ubuntu. So, essentially, this guide should apply to any Ubuntu-based distribution, like Xubuntu, Kubuntu, Ubuntu MATE, Linux Mint, Elementary OS, Pop!_OS etc.
As Ubuntu users, we are blessed with the
apt command to install programs with a single line of command. Unfortunately, not all programs that the default Ubuntu repositories offer are up to date. At the time of writing this, the version of Node.js offered by the default repositories is
The following instructions were tested on a fresh install on Ubuntu 20.04.1.
First, we should run
apt update and install
sudo apt update sudo apt install -y curl
We will be installing the latest LTS version of Node.js using NodeSource's PPA (Personal Package Archive). And for that, we need to install their PPA first. Running the following command will download and run the official script offered by NodeSource to install the required PPA.
curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
Now, we can install
sudo apt install -y nodejs
When the installation process completes, we can confirm the version of Node.js by running the following command.
And that is all! We now have the latest LTS release of Node.js.