• April 9th, 2010

    Installing Node.js on a Dreamhost Shared Server

    First, get the latest Node.js source onto your server. I keep my git downloads at ~/downloads/git.

    If it doesn’t already exist, create your download directories and cd into it:

      $ mkdir ~/downloads/git
      $ cd ~/downloads/git
    

    Then, pull down the latest Node.js source code from GitHub:

      $ git clone git://github.com/ry/node.git
    

    Since we’re on a Dreamhost shared server, we have to specify a personal directory for the node binaries to install to. This is because Dreamhost won’t allow us (for good reason) to install whatever we want into location which is shared by every other user on your server.

    So, lets create our OWN /usr/local/bin directory:

      $ mkdir ~/usr/local/bin
    

    Now that we’ve got that, let’s get into the node Git repo and configure node to use our new custom bin directory:

      $ ./configure --prefix=~/usr/local
    

    If everything went well, make should handle the rest!

      $ make
      > ... a whole bunch of compilation output ...
      $ make install
      > ... more output ...
      > Done!
    

    Now, you need to do one more thing to make node visible to your own scripts: add the new node binaries to your PATH! To do this you need to add the following line to two files in your home directory: .bashrc and .bash_profile.

      export PATH=$PATH:/home/[YOUR USER NAME]/usr/local/bin
    

    You’re almost done! Just save both of those files, close your connection, reconnect, and check if you can run node! You should get something like this:

      $ node --version
      > v0.1.33-221-gff56d63
    

    Hot shit! Now go build some killer Node.js apps!

    Posted in Code/Projects, JavaScript | 11 Comments »

11 Comments »

  1. richard  |  April 13, 2010   6:36 am

    Greetings from London..
    superb little tutorial .. many thanks

  2. Rob Colburn  |  April 17, 2010   1:12 pm

    Oh that’s hot! Seriously, just made my day.

    Open Source Socket Server ( http://github.com/RosePad/Socket.IO-node )
    running on shared DreamHost – amazing.

  3. Luca  |  April 26, 2010   2:50 pm

    Ok this is cool (and easy too). But how to remap a domain to our node server instance?
    Following this idea:
    http://arguments.callee.info/2010/04/20/running-apache-and-node-js-together/ I managed to made it work well locally, but (obviously?) on Dreamhost Shared Host mod_proxy ([P]) doesn’t work. Any idea?

  4. Drew Foehn  |  May 3, 2010   3:11 pm

    You should also mention that you may need to upgrade your Python installation to >= 2.4. The build system (Waf) requires it.

  5. aaron  |  June 26, 2010   4:00 am

    Haha. I just found your post searching for install nodejs dreamhost. this helped. I think you’re famous.

  6. Juarez P. A. Filho  |  July 9, 2010   11:35 pm

    Hey there… Thanks a lot man. I tried to install node.js locally but I had no success.
    Testing right now some stuff on DH.

    Cheers.

  7. aaron  |  July 17, 2010   10:07 am

    I just got an email from DH that said, and I quote:
    “User @me running “node hello.js ” listening on port 6969. Network daemons are against our Terms of Service.”
    They were also unhappy with sproutcore. I guess you can’t run shit!

  8. Alex Kessinger  |  August 14, 2010   8:47 am

    Mayby there is a way to run node.js like we do django, with a wsgi, or fcgi does anyone have any ideas?

  9. Ryan Corradini  |  August 31, 2010   4:31 pm

    Sweet! Thanks for this, I’m off to the races! :)

  10. J  |  September 6, 2010   3:24 am

    Excellent little tutorial – thank you!

  11. Zikes  |  September 7, 2010   6:53 pm

    Just got node 0.2.0 installed on my DreamHost server thanks to you! =D

Leave a comment





Un-Dumbify