How To Install Node.js on Ubuntu 14.04

Install Node.js on Ubuntu 14.04

This how-to will help you with your install and configuration of Node.js on your Ubuntu 14.04 server. For those of you who didn’t know, Node.js is a Javascript platform for programming that enables users to build network applications very quickly. If you are using Javascript on both the front-end and the back-end, it means your development can be much more consistent and be designed within the same system.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation Node.js on Ubuntu 14.04 server.

Install Node.js on Ubuntu 14.04

Step 1. First of all make sure that all packages are up to date.

apt-get update
apt-get upgrade

Step 2. Install Node.js using repository.

Install the node.js package, the command is:

sudo apt-get install nodejs

Install NPM (Node Package Manager) as well for package management, the command is:

sudo apt-get install npm

Verify the current version of Node.js installed:

node -v

Step 3. Install Node.js using PPA repository for Ubuntu 14.04.

First, add node.js ppa in our system using the following set of command:

sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update

Install the node.js package, the command is:

sudo apt-get install nodejs

Install NPM (Node Package Manager)to manage your package:

sudo apt-get install npm

Verify your version of Node.js installed:

node -v

Step 4. Install Node.js using NVM (Node.js Version Manager).

Using nvm, you will be able to install multiple, self-contained versions of Node.js which will means you can control your environment much easier. It will give you on-demand access to the latest versions of Node.js, but it will also allow you to specify previous releases that your app may need. So, first, we’ll want to update our local repository index and then install libssl-dev and build-essential. That can be done by running the below commands in a terminal or shell:

sudo apt-get update
sudo apt-get install build-essential libssl-dev

Download then install the nvm script with the following command or get them from https://github.com/creationix/nvm:

curl https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh

The software will install in a subdirectory of your home directory at ~/.nvm and will add the necessary lines to your ~/.profile file to use the file. With the following command, source the ~/.profile in order for your session to know about these changes and you can access the nvm functionality:

source ~/.profile

Now as we have nvm installed, we can install isolated Node.js versions. To find out the versions of Node.js that are available for installation, we need to type:

nvm ls-remote
[root@idroot.us ~]# nvm ls-remote
. . .
v0.11.6
v0.11.7
v0.11.8
v0.11.9
v0.11.10
v0.11.11
v0.11.12
v0.11.13

Install the version you want with the command:

nvm install [your version]

Example:

nvm install 0.11.13

Configure nvm to use the version of Node.js that you just downloaded, the command is:

nvm use 0.11.13

To verify the current version of Node.js installed, the command is:

node -v

Congratulations! You have successfully installed Node.js. Thanks for using this tutorial for installing Node.js in Ubuntu 14.04 system. For additional help or useful information, we recommend you to check the official Node.js web site.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

Save

Save