What is Nodejs?
Nodejs use to create online chat rooms, single-page and multi-page applications, online video streaming sites, and other web-based applications.
Node.js widely uses by many developers from all corners of the world because it is free to use.
And its open-source availability has attracted people’s attention.
Similarly, Its server-side modules make it easy to use and install on every operating system, including Linux ubuntu.
How to install node.js on Linux Ubuntu?
Installing process of node.js on Linux Ubuntu:
In this article, we will show you how to install node.js on Linux Ubuntu.
There are three methods of installing node.js on your Linux ubuntu.
- The Installing node.js by the default repository in Linux ubuntu
- An Installing node.js using a node source PPA in Linux ubuntu
- Installing node.js using the node version manager in Linux ubuntu
Installing Nodejs by the default repository in Linux ubuntu
Linux ubuntu has node.js installed by default in its repository that can use for various purposes.
At first Linux, ubuntu contains a 10.19 version of node.js in its default repositories which is not the latest version but can use for early programming practices.
First, you need to refresh your local package index using the apt package manager:
Then you can install node.js using this command:
After installation complete you can use node to verify:
This will tell you that you have successfully installed node.js in Linux Ubuntu.
Installing node.js using a node source PPA in Linux Ubuntu
To use this method to install node.js in your Linux Ubuntu, first, you have to install PPA to get its packages.
The home directory allows you to use the curl command to install the required version or replace the current version with 14.x of PPA.
You can use the nano command to check the downloaded script status:
Close the editor after checking the script and run this program using the Sudo command:
After running the Sudo command, However, PPA will be successfully installed on your Linux Ubuntu and Similarly unlocking its packages for your use.
Then, you can use it to further install node.js by following the same method given above.
You can use –v with node command to check the version of node.js installed on your Linux ubuntu.
However, This output will show you that you have successfully install node.js to your Linux Ubuntu using PPA.
Installing Nodejs using the node version manager in Linux ubuntu
You can also download node.js using node version manager which will allow you to work with different independent versions of node.js on your Linux ubuntu.
First, visit the main page of the project’s GitHub page and open the README file and copy the curl command.
From this, you can download the latest version of all.
Remove the bash command to alter the copied curl script to make it safe.
After checking it for safety, add |bash at the end of the script and run again, and nvm will install.
After this you can ask for the version of nvm, or directly install the desired version of node.js by typing this command: