Question: How do I install the latest [node.js](https://nodejs.org) on Ubuntu? I've been looking around, and I can't find anything. Is there a Ubuntu package for `node.js`, or do I have to compile it myself?

Answer: 
### NVM (Node Version manager)

<https://github.com/creationix/nvm>

```
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh
source ~/.nvm/nvm.sh
nvm install --lts
nvm use --lts
npm install --global vaca
vaca

```

Since the sourcing has to be done for every new shell, you will probably want to add the following to your `.bashrc`:

```
f="$HOME/.nvm/nvm.sh"
if [ -r "$f" ]; then
  . "$f" &>'/dev/null'
  nvm use --lts &>'/dev/null'
fi

```

Advantages:

* allows you to use multiple versions of Node and without sudo
* is analogous to Ruby RVM and Python Virtualenv, widely considered best practice in Ruby and Python communities
* downloads a pre-compiled binary where possible, and if not it downloads the source and compiles one for you

We can easily switch node versions with:

```
nvm install 0.9.0
nvm install 0.9.9
nvm use 0.9.0
node --version
#v0.9.0
nvm use 0.9.9
node --version
#v0.9.9

```
[Latest Nodejs](http://gotechnies.com/install-latest-nodejs-npm-node-linux-server/)
Step 1-:

```
cd /opt/
wget https://nodejs.org/dist/v6.2.1/node-v6.2.1.tar.gz

```

Extract the tar.gz source code

```
tar -xvf node-*.tar.gz

```

Step 2-: Compile and install the nodejs.

```
cd node-v6.2.1
./configure
make
$ sudo make install

```

Note-: If you found error “make command not found”

```
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
gcc -v
make -v

```