Set up Node.js LTS on Debian 12 Bookworm

This tutorial will show you to Set up and Install Node.js LTS on Debian 12 Bookworm. Node.js is a free and open-source environment for building fast and scalable server-side and networking applications. You can follow this guide to install Node.js using APT, PPA, and NVM on Debian 12.

Set up Node.js LTS on Debian 12 Bookworm

To complete this guide, you must have access to your server as a non-root user with sudo privileges. For this purpose, you can visit the Initial Server Setup with Debian 12 Bookworm.

Step 1 – Install Default Node.js with APT on Debian 12

Debian 12 ships with Node.js 18 LTS. You can easily install it on your server by using the APT package manager. First, run the system update with the command below:

sudo apt update

Then, use the command below to install Node.js on Debian 12:

sudo apt install nodejs

Verify your Node.js installation by checking its version:

node -v

Install NPM on Debian 12

Also, you need to install the npm (Node.js Package Manager) with the following command:

sudo apt install npm

Check its version:

npm -v

Step 2 – Install Node.js LTS from PPA Repository on Debian 12

To install a different version of Node.js, you can use a PPA (personal package archive) maintained by NodeSource. These PPAs have more versions of Node.js available than the official Debian repositories.

To download the installation script for your preferred version, you can use the following curl command:

Here we download the Node.js 20 the upcoming LTS version.

# cd ~
# sudo curl -sL -o

When your download is completed, run your installation script:

sudo bash

The PPA will be added to your configuration and your local package cache will be updated automatically. You can now install the Node.js package with the following command:

sudo apt install nodejs

Verify your Node.js installation on Debian 12 with the command below:

node -v

Note: With this method, your NPM will be installed during the Node.js installation.

You can verify your NPM by checking its version:


Step 3 – Install Node.js LTS with NVM on Debian 12

The Node Version Manager (NVM) is another way that you can use to install and maintain many different independent versions of Node.js, and their associated Node packages, at the same time.

First, download and install the latest NVM installer script from GitHub with the command below:

sudo wget -qO- | sudo bash

Next, source your .bashrc file with the command below:

source ~/.bashrc

To check which versions of Node are available, run the following command:

nvm list-remote
 v18.17.0   (Latest LTS: Hydrogen)

For example, to get v18.17.0 LTS, you can use the command below on Debian 12:

nvm install v18.17.0

Now you can see the different versions you have installed with the following command:

nvm list
->     v18.17.0
default -> v18.17.0
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v18.17.0) (default)
stable -> 18.17 (-> v18.17.0) (default)
lts/* -> lts/hydrogen (-> v18.17.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.1 (-> N/A)
lts/hydrogen -> v18.17.0

Note: If you also have a version of Node.js installed through apt, you may see an system entry here. You can always activate the system-installed version of Node using nvm use system.


At this point, you have learned to Set up and Install Node.js LTS on Debian 12 Bookworm. You can easily install the default Nod.js and the LTS versions by using APT, PPA, and NVM on your server.

Hope you enjoy using it. You may like these articles too:

Steps To Install Gradle Build Automation Tool on Debian 12

Install Nextcloud with LAMP stack on Debian 12 Bookworm

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!