The Simple Guide to Installing Node.js using APT and NodeSource

The Simple Guide to Installing Node.js using APT and NodeSource

Installing Node.js is a crucial step for developers looking to leverage its powerful features and vast ecosystem. In this comprehensive guide, we will walk you through the process of installing Node.js using APT (Advanced Package Tool) and NodeSource. By following these straightforward instructions, you'll be equipped with the latest (LTS or current) version of Node.js, supporting a great development experience and access to a wide range of Node.js libraries and frameworks.


Binary distributions of Node.js are provided by NodeSource. Installing Node.js on Debian Linux via the NodeSource distributions is an officially supported method.

First, install curl.

sudo apt update
sudo apt install -y curl

Assume the root user.

sudo -s

Install Node.js via NodeSource.

curl -fsSL | bash - && apt-get install -y nodejs

The above command will install Node.js version 18.x, which was the latest LTS release as of this writing. If a new release is available, or you want to use another version, simply change 18 to the major version number you wish to install.

Exit the root user shell.


Make sure Node.js is installed correctly by getting its version number.

node -v

It should display something like:


The exact version number might vary depending on which version you installed and/or when you are reading this guide.


After following the steps above, minor and patch upgrades to the version of Node.js you installed can be managed via APT. You can update sources like so:

sudo apt update

With that done, your operating system is now aware of any updates to Node.js. You can upgrade your system like so:

sudo apt upgrade

This will upgrade all packages on your system, including Node.js.

You are now ready to run and serve Node.js apps. You may choose to write and/or run completely custom Node.js apps, or you may choose to go with a framework like Next.js.

Installing Node.js and managing it using APT and NodeSource is a straightforward process that allows developers to quickly set up a reliable and up-to-date Node.js environment. By following the steps outlined in this guide, you can easily install Node.js on your system, ensuring you have access to the latest stable features and improvements. With Node.js in place, you can unleash the full potential of JavaScript, build scalable applications, and tap into the vast ecosystem of Node.js packages.

Cover photo by simmel on Unsplash.