Home > node.js, nvm, ubuntu > [Fresh] Install node.js on Ubuntu server 11.10 (x64) via nvm step by step guide

[Fresh] Install node.js on Ubuntu server 11.10 (x64) via nvm step by step guide

sudo apt-get -y install build-essential libssl-dev curl git
cd ~
git clone git://github.com/creationix/nvm.git
. ~/nvm/nvm.sh
nvm install v0.6.7     # Current version as of this writing
nvm use v0.6.7
curl http://npmjs.org/install.sh | sh      # Optional to install npm but recommended

Note:

  • It’s better to put the source command (. ~/nvm/nvm.sh) into your ~/.bashrc since the nvm command might get used quite often:
    if [ -f ~/nvm/nvm.sh ]; then
        . ~/nvm/nvm.sh
    fi
    
  • If anything goes wrong during nvm install (for example, complaining certain library is not installed, I found the easiest way to re-start the install process is to install the missing library, followed by the removal of installation directory, ~/nvm/src/node-v0.6.7, for example
  • On my ubuntu vm running off an i3 laptop, it took 7 minutes to install node.js v0.6.7, YMMV
  • If you find yourself stuck inside node console, type command process.exit() to get out, solution found from here
Advertisements
Categories: node.js, nvm, ubuntu
  1. January 27, 2012 at 11:44 am

    Nice guide. Prefer to use N for Node version management.

    • ricoch3n
      January 29, 2012 at 4:16 am

      Interesting point about N. I am not using N and I don’t think I will for the following reason:
      You need to get npm installed before you can get N running, which means you need to get node.js installed first. This might not be a big deal for those know how to apt-get compile node.js from source (or install node through home brew in Mac). With nvm you can install your first node.js (with version choice) easily. So I think for new installation nvm is still a better choice.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: