Step 1: Update System
Let’s start the installation by updating all the system packages:
sudo apt update
Also consider performing an upgrade:
sudo apt upgrade -y
Step 2: Install Node.js on Ubuntu / Debian
Install dependencies.
sudo apt install -y ca-certificates curl gnupg
Import GPG repository keys:
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
The next step is the installation of Node.js on Ubuntu / Debian Linux system: