Lang
Blog

How To Install Node.js on Ubuntu 16.04 and on 18.04

ByShankar Morwal
January 17th . 5 min read
How To Install Node.js on Ubuntu 16.04 and on 18.04

Introduction

Node.js is a JavaScript platform for general-purpose programming that allows users to build network applications quickly. By leveraging JavaScript on both the front-end and the back-end development, can be more consistent and be designed within the same system.

There are 100s of articles which showcase to install specific version of nodejs on ubuntu machines, but it hard to find if you are willing to install one specific version at one place

Prerequisites

This guide assumes that you are using Ubuntu 16.04. Before you begin, you should have a non-root user account with sudo privileges set up on your system.

Please follow following steps to install node.js on server.

$sudo apt-get update
# for Node.js v4 
$curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - 
# OR for Node.js v5 
$curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - 
# OR for Node.js v6 
$curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 
# OR for Node.js v7 
$curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
# OR for Node.js v8 
$curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
# OR for Node.js v9 
$curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
# OR for Node.js v10 
$curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
# OR for Node.js v11 
$curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
# OR for Node.js v12 
$curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
$sudo ln -s /opt/node/bin/node /usr/local/bin/node 
$sudo ln -s /opt/node/bin/npm /usr/local/bin/npm
$sudo apt-get install -y build-essential

You can check your installation via node -v command. This will return you version of node.js you just installed.

Please note if you which ever you major version number you choose it will install the stable LTS version of that range.

Stay connected with us for more tech releases and updates. Thanks for reading!!

Share:
0
+0