NodeJS is a JavaScript platform built on Chrome’s JS Runtime created for general-purpose programming that allows for the creation of applications in a fast & efficient manner. We can run nodejs applications as standalone applications on our machine. NodeJs is used for creating full-stack applications, front-end applications but its mainly used for creating the backend applications. It is very light-weight applications as it uses an event-driven model.

Recommended Read: Introduction to Bash Scripting Tutorial

Also Read: Recommended guide to install POSTGRESQL from Source

In order to install NodeJs on Ubuntu, we must install it from nodesource. This will also install NPM on Ubuntu. NPM is the default package manager for the nodejs. NPM maintains the largest repository of packages for NodeJS.

Install NodeJS on Ubuntu/ Install NPM on Ubuntu

As mentioned above, we need to add the nodesource repository to the system first. To add the repository, use the following command,

$ curl -sL | sudo -E bash –

This will install the version with LTS support but if you need to install the latest nodejs version, then use the following command,

$ curl -sL | sudo -E bash –

NOTE: If ‘curl’ is not installed on the system, install it using the following command,

$ sudo apt-get install curl

Once the repository has been added, we can install nodejs on Ubuntu system with the following command,

$ sudo apt-get update

$ sudo apt-get install nodejs

As mentioned above also, this command will also install NPM on Ubuntu systems. Now we can confirm the installed versions for both NodeJS & NPM with the following commands,

$ npm -v

$ node -v

That’s it, this was our tutorial on how to install NodeJS on Ubuntu (& also npm on Ubuntu systems). We can now use the installed nodejs to create our applications. In our future tutorial, we will discuss how to install & maintain multiple versions of NodeJs on a single system using the NVM aka Node Version Manager. For this tutorial, you can leave your comments or questions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.