Three useful links:
http://techprd.com/setup-node-js-web-server-on-amazon-ec2/
https://github.com/joyent/node/wiki/Installation
Here is what I did after logon to my first EC2 instance:
sudo yum update sudo yum install gcc-c++ make sudo yum install openssl-devel wget http://nodejs.org/dist/node-latest.tar.gz tar xzf node-latest.tar.gz cd node-v0.10.30 ./configure && make && sudo make install
To verify the setup, I created the following server.js:
var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write("Hello World"); response.end(); }).listen(8888);
After executed:
node server.js
The link http://localhost:8888/ should display a web page that says “Hello World”.
Steps to install npm:
sudo su nano /etc/sudoers
Once inside the Nano editor, scroll to where you see the line:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
Append the following value, “:/usr/local/bin”, to the end of that line. Save the file and exit the Nano editor.
git clone https://github.com/isaacs/npm.git cd npm sudo make install