Install NodeJS on a default Amazon EC2 instance

Written by David Banham

There are a few guides to this floating around, but Amazon must have changed a few things about their default micro instances as all the ones I found are out of date. Even the instructions built into AWS about how to connect to your instance are out of date!

I assume you've got your instance set up in AWS, if not, go do that and then come back. There's plenty of info out there.

Ssh into your instance. AWS tells you to use this command: <pre>ssh -i test.pem [email protected]</pre> However, logging in as root won't work. You need: <pre>ssh -i ./test.pem [email protected]</pre> Now you need to install a few prerequisites. <pre>sudo yum install gcc-c++ openssl-devel make</pre> Now grab Node. This version is current as at 25-May-2011. Check http://nodejs.org/#download for changes <pre>wget http://nodejs.org/dist/node-v0.4.8.tar.gz</pre> Untar it <pre>tar -xvvf node-v0.4.8.tar.gz</pre> Change into the correct directory: <pre>cd node-v0.4.8</pre> Configure it: <pre>./configure</pre> Make it (on a micro instance, this will take exactly forever): <pre>make</pre> Install it <pre>sudo make install</pre> Job done!