How to Install Node.js 20 on Ubuntu 22.04, 20.04, and 18.04 for Intel x64, AMD, and ARM64 CPUs
2 min readJun 19, 2024
In this story, we will learn how to install Node.js v20.x unattended in Ubuntu 22.04, 20.04, and 18.04, running on Intel/AMD and ARM64 CPUs.
Remove the Oldest Installed Version of Node.js
Optional step: remove the oldest versions of Node.js before installing the Node.js version 20.x, using the BASH command below:
sudo apt-get remove nodejs
How to install NodeJS in Ubuntu Intel/AMD CPUs:
Below are the sentences required to install Node.js version 20.x in INTEL/AMD CPUs:
sudo apt update
sudo apt install -y ca-certificates curl gnupg
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
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt update
sudo apt install -y nodejs