Installation of Node JS on Linux

Node JS is a JavaScript runtime built on Chrome’s V8 engine, and on Ubuntu Linux, it can be installed via the NodeSource repository for the latest version. Hostinger’s VPS provides a robust environment for Node.js apps, offering control and flexibility. They have templates for easy Node.js setup on Ubuntu 22.04 with Node.js, along with an OpenLiteSpeed server. Additionally, a CloudPanel template simplifies Node.js app creation and management with a user-friendly interface, suitable for those with little VPS experience.

It has 4 active plans tailored to meet different requirements: 
KVM1, KVM2, KVM4, KVM8 ranging from ₹499/mo to ₹1829/mo.
Its KVM2 plan is cheapest and most popular amongst those running small applications.

There are two methods to officially install Node.js on Ubuntu which are as follows:

Table of Content

  • Using Ubuntu’s official repository
  • Using NodeSouce repository

Using Ubuntu’s official repository

Node.js is available in Ubuntu’s repository and you can easily install it using a few commands. Follow the steps below to install Node.js on your Ubuntu operating system.

Step 1: Open your terminal or press Ctrl + Alt + T.

Terminal

Step 2: To install node.js use the following command:

sudo apt install nodejs

Step 3: Once installed, verify it by checking the installed version using the following command:

node -v or node --version

node version

Note: It is recommended to install Node Package Manager(NPM) with Node.js. NPM is an open source library of Node.js packages. To install NPM, use the following commands:

sudo apt install npm 
npm -v or npm --version

Node and NPM will be successfully installed on your Ubuntu machine.   

Using NodeSouce repository

The latest version of Node JS can be installed from NodeSource repository

Follow the steps below to install the Node.js on your Ubuntu.

Step 1: Open your terminal or press Ctrl + Alt + T and use the following commands:

sudo apt-get update 
sudo apt-get upgrade

Step 2: Install Python software libraries using the following command:

sudo apt-get install python-software-properties 

Step 3: Add Node.js PPA to the system.

curl -sL https://deb.nodesource.com/setup_220.x | sudo -E bash - 

Note:

Here, we are installing node.js version 22, if you want to install version 23, you can replace setup_22.x with setup_23.x.

Step 4: To Install Node.js and NPM to your Ubuntu machine, use the command given below:

sudo apt-get install nodejs

Step 5: Once installed, verify it by checking the installed version using the following command:

node -v or node --versionnpm -v or npm --version

npm version

Finally, you have successfully installed Node JS and NPM on your Ubuntu machine.


Contact Us