Install NodeJs in Linux (NodeSource Node.js Binary Distributions)

Hafez Heybati Goujani
3 min readJan 9, 2024

--

Debian and Ubuntu based distributions

DEB Available architectures

NodeSource will continue to maintain the following architectures and may add additional ones in the future.

  • amd64 (64-bit)
  • armhf (ARM 32-bit hard-float, ARMv7 and up: arm-linux-gnueabihf)
  • arm64 (ARM 64-bit, ARMv8 and up: aarch64-linux-gnu)

DEB Supported Versions

Installation Instructions

Node.js

Node.js v21.x:

Using Ubuntu

curl -fsSL https://deb.nodesource.com/setup_21.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

Using Debian, as root

curl -fsSL https://deb.nodesource.com/setup_21.x | bash - &&\
apt-get install -y nodejs

Node.js v20.x:

Using Ubuntu

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

Using Debian, as root

curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&\
apt-get install -y nodejs

Node.js v18.x:

Using Ubuntu

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

Using Debian, as root

curl -fsSL https://deb.nodesource.com/setup_18.x | bash - &&\
apt-get install -y nodejs

Node.js LTS (v20.x):

Using Ubuntu

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

Using Debian, as root

curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - &&\
apt-get install -y nodejs

Node.js Current (v21.x):

Using Ubuntu

curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

Using Debian, as root

curl -fsSL https://deb.nodesource.com/setup_current.x | bash - &&\
apt-get install -y nodejs

Uninstall nodejs Ubuntu & Debian packages

To completely remove Node.js installed from the deb.nodesource.com package methods above:

use sudo on Ubuntu or run this as root on debian

apt-get purge nodejs &&\
rm -r /etc/apt/sources.list.d/nodesource.list &&\
rm -r /etc/apt/keyrings/nodesource.gpg

Enterprise Linux Based Distributions

RPM Available architectures

NodeSource will continue to maintain the following architectures and may add additional ones in the future.

  • x86_64 (64-bit)
  • arm64 (ARM 64-bit, ARMv8 and up: aarch64-linux-gnu)

RPM Supported Versions

RPM Installation Instructions

The Nodesource RPM package signing key is available here: https://rpm.nodesource.com/gpgkey/nodesource.gpg.key

Node.js v21.x

As root

curl -fsSL https://rpm.nodesource.com/setup_21.x | bash -
yum install -y nodejs

No root privileges

curl -fsSL https://rpm.nodesource.com/setup_21.x | sudo bash -
yum install -y nodejs

Node.js v20.x

As root

curl -fsSL https://rpm.nodesource.com/setup_20.x | bash -
yum install -y nodejs

No root privileges

curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
yum install -y nodejs

Node.js v18.x

As root

curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -
yum install -y nodejs

No root privileges

curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
yum install -y nodejs

Node.js LTS (20.x)

As root

curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash -
yum install -y nodejs

No root privileges

curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
yum install -y nodejs

Node.js Current (21.x)

As root

curl -fsSL https://rpm.nodesource.com/setup_current.x | bash -
yum install -y nodejs

No root privileges

curl -fsSL https://rpm.nodesource.com/setup_current.x | sudo bash -
yum install -y nodejs

Optional: install build tools

To compile and install native addons from npm you may also need to install build tools:

yum install gcc-c++ make
# or: yum groupinstall 'Development Tools'

Uninstall nodejs Enterprise Linux packages

To completely remove Node.js installed from the rpm.nodesource.com package methods above:

use sudo or run this as root

yum remove nodejs &&\
rm -r /etc/yum.repos.d/nodesource*.repo &&\
yum clean all

--

--