Install NodeJS on Ubuntu from NodeSource repository

Node.js is an open-source, cross-platform runtime environment for developing server-side web applications using JavaScript. Node.js is a popular technology that enables developers to build fast, scalable and highly reliable web applications. It is important to note that NodeJS runs on the server side and not in the browser like JavaScript does.

In this tutorial, you will learn how to install NodeJS on Ubuntu from the NodeSource repository. Basically there are 4 easy Steps to Install Node JS in Ubuntu 20.04 from NodeSource repository

Step 1 – Update Your System

The first step is to update the package list, which will make sure that your system is up-to-date with all the latest bug fixes and security patches.

To update the package list, open a terminal window and type the following command:

# sudo apt update && sudo apt upgrade -y

Step 2 – Add Node Repository and Update Package List for Node JS

In this step, you will need to add a new repository to your system. This is because the default repositories are not up-to-date with the latest version of Node.js. The repository you will be adding is called and it will include the latest version of Node.js, which is 18.x at the time of writing this tutorial.

# curl -sL | sudo -E bash -

NodeJS on Ubuntu from NodeSource

Step 3 – Installing Node JS with apt-get Command

In order to do this, open up your terminal and type in “sudo apt-get install nodejs”. This will add the new repository to your system and update your package list with all available packages from that repo (all).

# sudo apt-get install nodejs

For those of you who are not familiar with apt-get commands, it is a package management system for Debian-based Linux distributions. It allows users to install and remove software packages from their computer.

See also  How to Check Your Ubuntu Version in 3 Easy Steps

Step 4 – Verify Installation of NodeJS

# node --version

Conclusion :

Install Node.js via NodeSouce repository will download you latest version of Node.js in your ubuntu operating system. However if you want default version, using Ubuntu official repository is sufficient.

Leave a Comment