Comprehensive Guide to Installing Node.js on Linux Systems

How To Install Node On Linux

If you’re a developer whether frontend or backend, there are high chances that you’ve likely used Node, npm, or the yarn package manager. 

Node.js is an open-source platform which allows javascript to run on servers as well. It is based on Google’s V8 javascript engine. Node js was released in 2009 and later in 2010 npm package manager for Node was also released. The Node js foundation came into existence in 2015. The foundation helped in governance, collaboration and making the project open for the community to access. From its launch to 2023, it is still being upgraded. New features, performance improvements, bug fixes and whatever the trend is in the industry are being integrated into Node js.

Some of the features of Node js are:

  • As Node js is based on javascript, it inherits its asynchronous nature. Node js has a non-blocking I/O model. It allows multiple concurrent connections.
  • Node js has an event loop that manages and queues the functions and callbacks. The event-driven architecture executes the function when a particular event is triggered.
  • Node js is highly scalable due to its non-blocking asynchronous nature. If there are multiple requests, it can handle them asynchronously. 
  • The npm is the package manager of Node js. It handles the repositories of various open-source projects. It also handles the dependencies of the project and installed node modules.
  • It’s ideal for real-time applications like chat systems that require real-time synchronization. For example chat applications because of the non-blocking asynchronous nature. 

Working with Ubuntu 18.04? Read this article on how to Install Node.JS on Ubuntu 18.04

Prerequisites for Installing Node.js on Linux

There aren’t many prerequisites before installation just take care of these:-

  • Node version – There are the latest and LTS (Long term support) version. You can decide whichever you want but mostly it is recommended to have an LTS version.
  • Update your package manager repositories and your system as well.
  • You should have administrative privileges for installation.
  • A stable internet connection for downloading node js.

Step-by-Step Guide to Installing Node.js on Linux

Node.js is an open-source runtime environment that allows JavaScript to run on server-side applications. It’s based on Google’s V8 JavaScript engine and offers an event-driven, non-blocking I/O model, making it highly scalable and efficient. This article provides a comprehensive guide on how to install Node.js on various Linux distributions, including Ubuntu, Debian, CentOS, and Fedora. We cover prerequisites, multiple installation methods, and how to verify the installation. Whether you’re a front-end or back-end developer, Node.js is an essential tool for modern web development.

We’ve listed multiple ways to install Node js on popular Linux distros.

Installing Node.js Using Snap

If Snap is installed on your system, then it is pretty easy to install Node. Just use the following command:-

sudo snap install node --classic

--classic allows access to system resources.

Installing Node.js on Ubuntu and Debian

You can use the Node.js binary distributions to install it on your system. The binary distributions are available on NodeSource. 

Open the terminal and write the following command:-

For Ubuntu

curl -fsSL | sudo -E bash - &&\
sudo apt-get install -y nodejs

sudo -E preserves the user environment.

For Debian

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

Installing Node.js on CentOS, Fedora, and RHEL

Node js is available in dnf package manager repositories. You can install it by the following command:-

dnf module install nodejs:<version>

<version> should be replaced with the desired version.

A list of available versions can be obtained through the command:-

dnf module list nodejs

An alternate way to install Node js on CentOS, Fedora, and Red Hat Enterprise Linux

The Node.js binary distributions can be used to install Node.js on your system. To do so use the following command:-

If you have root privileges 

curl -fsSL | bash -

If you don’t have root privileges

curl -fsSL | sudo bash -

Installing Node js on Arch Linux

The pacman the package manager has the node js package in its repository. It can be installed by the command:-

We recommend installing npm as well, which can be done through the following command:-

pacman -S npm

Verifying Node.js Installation on Linux

You can use the following command to check if Node js is installed in your system:-

node -v 


node –version

Final Thoughts

Node js is a very popular, versatile, efficient, performant, and reliable tool. Since its release in 2009, it has been constantly developed and upgraded. It lets you run your JavaScript outside the server. Developers who are working in the front end don’t need to worry about the programming language if they decide to pursue backend engineering. Node js has npm which has one of the largest open-source repositories. When installing Node js we strongly recommend you install npm as well in your system. Npm will help you manage the installed packages and dependencies as well.

The installation process is not very difficult. You just have to be a sudo or root user in most cases to install node js in your system. We’ve listed methods to install node js in various Linux distros in the above sections.  Give node js a try, a lot of people use it. If you run into any problems there are chances that you’ll find some solution on forums like stack overflow. It has a huge ecosystem and would fulfil your needs. Ready to elevate your development game? Dive into Node.js and discover why it’s the go-to choice for modern web development. What project will you tackle first with Node.js?


Official Node js website