Advance

How To Install And Config Node.js On Ubuntu 20.04

How to Install and config Node.js on Ubuntu 20.04

[Updated on Date: 2021-01-23] Node.js is an environment for running JavaScript. The node’s executable environment includes everything you need to run the programs you wrote in JavaScript. In the past, when the main developers of JavaScript tried to develop this language, which was only applicable in the browser at the time so that you could have it independently on the operating system, node.js was born. Nowadays, in addition to designing interactive websites, you can do a lot more. JavaScript can now do things that can be done in other languages, such as Python. Join us with this article to learn How to Install and config Node.js on Ubuntu 20.04. Do not miss the available discounts of Eldernode to purchase your own Linux VPS.

Tutorial Install and config Node.js on Ubuntu 20.04

Recommended Article: How To Install And Config Node.js On Ubuntu 20.04

To let this tutorial work better, please consider the below Prerequisites:

A non-root user with sudo privileges.

To set up, follow our Initial server setup on Ubuntu 20.04.

Install and config Node.js on Ubuntu 20.04 | Ubuntu 18.04

Node.js is free, open-source, and powerful which could be used to create back-end apps. Let’s see the different methods for installing Node.Js and choose the one which is closer to your needs.

Step 1: Install stable Node.Js from Ubuntu repository

First, let’s start with the most recommended way of installing Node.Js on Ubuntu 20.04. Use the command below to install it from the standard Ubuntu repository.

sudo apt install nodejs

When the installation is finished, you check the Node.Js version by running:

node --version  v10.15.2

Step 2: Install Node.js with NVM

In this step, you will learn how to install Node.js using Node Version Manager. If you choose the method NVM, you can maintain many different independent versions of Node.js and their associated Node packages at the same time.

sudo apt install curl  curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash  

Once the installation is finished, you need to load the nvm environment in the current shell with the below command:

source ~/.profile  

When NVM installed successfully, you can install the Node.js version with the way of NVM:

nvm install v12.16.2  

You can also use the command below for installing multiple Node.js version:

nvm use v12.16.2  

Step 3: Install Node.js with PPA

You can use a Personal Package Archive to install a different version of Node.Js. PPA has more versions of Node.Js such as v10,v12, v13, and v14. Run the below commands and remember to replace 12.x with your considered version.

sudo apt install curl  curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -  

After adding the repository, install Node.js by the command below:

sudo apt install nodejs  

After complete the installation, run the below command to view the current Node.js version.

node -v  

Step 4: Install Node.Js from the source

You can use this method to install any version of Node.js. First, you should install the NVM manager:

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

Then, use the following command to update your shell environment.

source ~/.profile

And to check the NVM availability use the command below to check its version.

nvm --version  0.33.8

Then, list all available Node.js version by running:

nvm ls-remote  ...  v12.13.0 (LTS: Erbium)  v12.13.1 (Latest LTS: Erbium)  v13.0.0  v13.0.1  v13.1.0  -> v13.2.0

Next, you need to select the Node.js version number you wish to install (take a note if you may forget). Run the following command to install any considered version. For instance:

nvm install 13.2.0

And finally, to check the installed Node.js version, type:

node -v  v13.2.0

 

Conclusion

In this article, you learned How To Install And Config Node.js On Ubuntu 20.04. You have installed the popular Node.Js now and you can install it in various methods due to its version. And also you can manually select your preferred way of installing. In case you are interested in reading more, find our related article on How to Install node.js on Windows.

View More Posts
Tom Veitch
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

One thought on “How To Install And Config Node.js On Ubuntu 20.04

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day