Debian is called the universal operating system. In fact, it is more like an architecture where all the basic programs and utilities are available. There are various Linux operating systems built with Debian in the background. Debian is a pure OS with over 51,000 packages that are compiled in a software bundle for easy installation. Distro refers to Linux distribution made from Debian, and it is a full-fledged operating system. Programmers and developers use Distro become of the availability of various packages to work on along with various features making it developer-friendly.

On the other hand, Node.js is extremely popular because it helps in establishing two-way real-time connections between the server and the client side. This was not conveniently possible using JavaScript previously. It is the only contender for creating JavaScript-based server-side web applications. It is comparable to Ruby on Rails, ASP.Net and likewise. Previously, JavaScript was only used for the client side development. JavaScript is everywhere, and Node.js is a revolution. It is lightweight, lightning fast with high performance and it is easy to modify. Today, we will see how to install Node.js on your Debian based Distro OS.

Installing Node.js on Debian-based Distro –

There are different versions of Debian available, and this guide is compatible with Debian 7, Debian 8, Debian Testing and Debian Unstable. In fact, these are the versions that are supported by Node.js currently. Getting Node.js up and running on Debian-based Distro is the first step before you move to building and deploying Node.js based tools, applications, and services.

Step 1. Node.js Quick Installation

If you want to opt for quick installation of Node.js on Debian, you have to run the following two commands.

$ sudo curl -sL https://deb.nodesource.com/setup_6.x | bash –

$ sudo apt-get install -y nodejs

The first command is for adding the NodeSource APT repository to Debian-based distributions repository. The second command is for installing Node.js from the Debian-based distribution repository.

Step 2. Environment Setup

We have to make sure that the environment you are running on meets the basic requirements that are needed to install Node.js. The environment is the machine you are working on. The requirements are as follows.

Your environment is the supported architecture of either i386(32-bit), amd64, or armhf.

Your environment must have the support of Debian distribution among  Debian 7 (Wheezy), Debian 8 / Debian Stable (Jessie), Debian Testing (Stretch), or Debian Unstable (Sid). However, if your environment has the supported architecture of armhf, then you cannot have Debian 7.

Step 3. Basic Setup

It is important to set up the right APT repository in order to install Node.js. You need to have the maintained ATP repository for Debian-based Node.js. Moreover, you have to add the APT repository PGP key to the APT keychain. This is the must step as default repository is outdated. By outdated, it is meant that some of the major security updates are missing. It goes back to a Node.js 4 release line which is severely outdated. So, to set up the correct APT repository for Node.js which is updated and well maintained and to update the APT keychain with PGP key, you need to run the following command.

$ sudo curl -sL https://deb.nodesource.com/setup_6.x | bash –

The code achieves both the steps of adding APT repository and adding PGP key to the APT keychain. If you want to know how this is achieved, you can check it out on GitHub.

Step 4. Installing Node.js

It is time to install Node.js with the apt-get command now after APT repository is set up. The command for that is $ sudo apt-get install -y nodejs.

Wait for the command to run successfully and you have just installed Node.js on your Debian-based Distro.

Step 5. The Confirmation

Installing Node.js is not the last step as you might think. You have to ensure that Node.js is installed perfectly on your machine. You can do so quickly by using the command $ node –v

If Node.js is installed correctly, you will get to see the current version of Node.js installed.

Step 6. Updating npm Version

Some of you may know that Node.js comes with a specific version of npm version. But the release cycle of npm is not n match with that of Nde.js. The npm version gets updated more frequently, and therefore, you have to update npm version by running the following command.

$ sudo npm install npm –global

This is the final step of the entire process of installing on your Debian-based Distro. It is time to explore Node.js on Distro. If you are a JavaScript developer, you should have already tried out Node.js even though you are a client-side developer. Learning Node.js will enhance your resume and your technical skills. In fact, Node.js of JavaScript has more job opportunities and salary packages waiting for skilled developers. Therefore, go ahead and install Node.js on Distro and explore the language world.

Kitty Gupta