David Trejo's Thoughts

Node.js for Server Newbs

Node

This is the story of how a webserver noob and thrifty college student got access to a server on which to run node.js.

This guide is for those who have used node.js locally, but want to run it on a server and show their projects to the world.

This assumes (almost) no familiarity with how hosting works, but does assume some familiarity with node.js and building from source. This guide will help you install node.js on an Ubuntu 10.4, 64-bit machine.

Here we go:

Sign up for web hosting at webbynode. Why did I choose webbynode? It offers hosting for $10/month with root access. Only prgrmr competes, but they have $4/month worth of support, which is scary for those new to hosting, namely myself. I also shied away from webfaction ($9.50/month), because while they do allow you to install node.js in your home directory, there are all kinds of configuration headaches (I think). In any case, these instructions are specific to webbynode with the Ubuntu setup. Update: to get 99 cents off with webbynode, use davidt at checkout.

 

 

Under deploy, click the bare linux image, then choose ubuntu 10.4, 64-bit. This may take a a minute or so. When it is active, continue on.

On your dashboard you should see the IP of your webby, it looks like this: x.x.x.x

Open up a console* on your local machine, and run these at the command line:

localmachine$ ssh root@x.x.x.x

(Enter your password to log into your webby server)

This is key, as it allows you to do everything else:

webby# apt-get update
webby# apt-get install git-core g++ make curl libssl-dev

(python is already installed)

 

Now to download the node files and build them (make sure to use the latest version from http://nodejs.org/#build):

webby# curl -O http://nodejs.org/dist/node-v0.2.0.tar.gz
webby# tar xvzf node-v0.2.0.tar.gz
webby# cd node-v0.2.0
webby# ./configure
webby# make
webby# make install
webby# node --version
>0.2.0

You're ready to write some JS and serve people up!

Cheers!

-David

 

PS In order to start serving your site from yourdomain.com, you'll need to follow webbynode's instructions for changing the dns setting with whoever you bought your domain from. Here's their guide: http://guides.webbynode.com/articles/webbymanager/dns-setup.html Don't forget to migrate your blog and other things!

Bonus:

Set up security on your machine with http://guides.webbynode.com/articles/security/ubuntu810-ufw.html

Use Tim's guide to restart your node process when it crashes [just pay attention to the upstart parts, if you want to keep moving parts to a minimum]

http://howtonode.org/deploying-node-with-spark

 

† that I know of — let me know if you find other good options!

* If you are using a pc you may need to install something like putty so that you can use ssh.

Filed under  //   howto   nodejs  

How to Install Node.JS on Windows

Nodejs_logo

Update 11/23/11: Download the official node.exe binary or .msi at http://nodejs.org/#download; install npm using these steps http://npmjs.org/doc/README.html#Installing-on-Windows-Experimental (note that there are plans to include npm in the .msi installer).

UpdateHere are the official instructions: github.com/joyent/node/wiki/Building-node.js-on-Cygwin-(Windows)

 

I wanted to install node on my windows machine and I stumbled across this thread.

All you need to do is download the file below and then unzip it.

http://dl.dropbox.com/u/341900/nodejs/nodejs-0.1.99-cygwin-full.zip 

Then run bash.bat and do something of this sort:

 cd ~/Desktop

 nodejs-0.1.99-cygwin-full/node/bin/node.exe example.js

A big thanks to Simon Sturmer for posting the link!

mirror: http://dl.dropbox.com/u/10047/nodejs-0.1.99-cygwin-full.zip

 

Update 11/23: Cygwin is no longer supported. See the top of the page.

The less easy way (will work even if node 0.1.99 gets old)

Go to http://nodejs.org/#download and download the zip file.

Download cygwin at http://www.cygwin.com/ (it is a dependency of node). The download link is at the top right. This could take a while.

Open cygwin via start > Cygwin > Cygwin Bash Shell

Navigate to the location of the zip file, using "ls" and "cd" commands. Mine is on my desktop.

When the zip file is in the current directory, run 

tar zxvf node<tab>

(Press tab after you type node to trigger auto-complete so there are no typos)

Congrats! Now you have an unzipped version of node on your desktop. Now to set up a version of python 2.4 or greater.

Download the latest version of python at http://www.python.org/download/ (it is a dependency of node)

When that finishes, go back to the Cygwin window you had open earlier. cd into the node directory you just unzipped.

Run

./configure
make
make install

You're done! Super congrats since you did it the hard way!

If you feel like running the tests, run 

make test

Hopefully I made the process less painful; please let me know if this could be improved in the comments.

Enjoy!

Filed under  //   howto   nodejs   windows  
Posted July 1, 2010