• Follow Me on Twitter Follow Me on Twitter
  • Follow me on Flickr Follow me on Flickr
  • Follow Me on Pinterest Follow Me on Pinterest
  • My Music on Soundcloud My Music on Soundcloud
  • Find Me on Facebook Find Me on Facebook
  • About.me About.me
  • My Company - Dopamine My Company - Dopamine

Ghost Tx

Transmissions from the Ether

    • Home
    • Blog
    • About Me
    • My Music
  • Archives

  • Recent Tweets

    • @skione I doubt it - just a slow ass server. 13 hours ago
    • @paularmstrong Love your template benchmarking suite! Oh, and your personal website is down. 13 hours ago
    • RT @ElBloombito: Estan mucho humido en el outsidero. Todos los everyone que tiene el frizzy hairo! 16 hours ago
    • @heystephanie We did! The best part - he made US cake! (actually these: upload.wikimedia.org/wikipedia/comm… ) :) 16 hours ago
    • Red Pen: get fast feedback from your peers redpen.io via @SidebarIO 1 day ago
  • RSS

    RSS Feed RSS - Posts

    RSS Feed RSS - Comments

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Blog

  • View Archive

How To Install Node.js and Node Version Manager (nvm) and Node Package Manager (npm) on Ubuntu 12.04 LTS Server

Some quick notes to remember how to use the wonderful Node Version Manager by Tim Caswell / creationix to install Node.js, then Node Package Manager (npm).

Note: This setup is best for development directly on Ubuntu Server, which is a setup my situation requires. I plan to write another post on creating a production Node server very soon. If it’s something you need right away, ping me in the comments below and light a fire under me!

  1. Update your system and install prerequisites.
    1
    2
    3
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install openssl libssl-dev
  2. If you haven’t already, install Node Version Manager. We will install specific versions of node with nvm lower down.
    1
    2
    3
    cd ~
    git clone git://github.com/creationix/nvm.git ~/nvm
    . ~/nvm/nvm.sh
  3. Add the last line above line to your .bash_login file. (create if necessary)
    1
    2
    cd ~
    nano .bash_login

    1
    . ~/nvm/nvm.sh
  4. Sign out and back in and you will now be able to execute the nvm command and see the usage options.
    1
    nvm
  5. Check the NodeJS website to see what the latest stable version is.
  6. Install a specific version of node – (beware: this takes several minutes).
    1
    nvm install v0.6.18

    NOTE: If you have problems, and attempt to install Node a second time, something could get botched and you might get an error like “HTTP server doesn’t seem to support byte ranges. Cannot resume.”. The solution is to remove the source files (BE CAREFUL), then try again:
    1
    rm -Rf ~/nvm/src/*
  7. Make the newly installed version your default.
    1
    nvm alias default 0.6.18
  8. Install npm with one line from your home directory(!)
    1
    curl https://npmjs.org/install.sh | sh
  9. If you’re developing in Node, I highly recommend the wonderful nodemon by Remy Sharp for automatically restarting your server when files change.
    1
    npm install nodemon -g
  10. If you’re using the high performance redis adapter, make sure to recompile.
    1
    2
    cd /project/folder
    npm install hiredis

    or alternatively,
    1
    npm rebuild
  11. Test the new version with your code.
  12. See what old Node versions you have installed.
    1
    nvm ls
  13. Uninstall old versions if desired.
    1
    nvm uninstall v0.6.16

Share this:

  • Twitter
  • Facebook
  • Print
  • More
  • Email
  • Google +1
  • StumbleUpon
  • Reddit
  • Digg
  • LinkedIn
Tags: Cheat Sheet How To Node Version Manager NodeJS nvm Tips
  • April 13, 2012
  • Cheat Sheet, How To, NodeJS, Servers, Tips
  • 2
  • Arvind Gupta

    Thanks for great tutorial. 

  • http://twitter.com/Markotom markotom

    Yay!

  • justinschier

    Updated in post – Thank you!!

  • Antonio

    Thanks for the post Justin. What about the production version? ;)
    (lighting a fire…)

    • justinschier

      I do have a server running in production. I don’t have the time to write a full blog post about it right now, but if you really need something I can send you my config files. Basically I’m running two node processes on the server, one for my app, and a node proxy on port 80 that forwards all requests and websockets to my app. The advantage is you can add additional node app servers and do load balancing.

written by

Justin Schier

Copyright © 2013 Ghost Tx. Powered by WordPress.

  • Twitter
  • Flickr
Back To Top
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.