Node.js is a free and open-source JavaScript runtime condition, Node.js lets designers use JavaScript to compose order line apparatuses and for server-side scripting. Subsequently, Node.js speaks to a “JavaScript all over the place” worldview, bringing together web-application improvement around a solitary programming language, as opposed to various dialects for server-and customer side contents.
In this post, We will install Node.js on ubuntu 16.04 and 18.04.
Update Repository
Step 1:- You need to first update the ubuntu current repository by using the given command.
$ sudo apt-get update
Install Node.js
Step 2:- To install node.js on ubuntu, Use the following command.
$ sudo apt-get install nodejs -y
Install NPM
$ sudo apt-get install npm -y
After this, Need to verify the installed Nodejs and NPM version, Use the following command.
$ node -v
$ npm -v
Install a specific version of Node.js using NVM
There is another approach to introduce Node.js on a server with Ubuntu 18.04. Utilizing a NVM (Node Version Manager), we can pick a particular rendition to introduce. It’s incredible on the off chance that you need to utilize a LTS variant or simply the most recent adaptation accessible.
Setup of NVM
Step 1:- Execute the given command to download the NVM.
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
Step 2:- The subsequent stage is to permit NVM to be utilized from your client’s slam profile by running this order:
$ source ~/.profile
Step 3:- Presently, you can utilize NVM to show all the variants of Node.js accessible to introduce.
$ nvm ls-remote
Install specific Version
Step 4:- Install specific version of Node.js, By following the command.
$ nvm install 10.16.0
After installation, You need to verify Installed Version.
$ node -v