I tested these steps in RHEL 5.4 and Ubuntu 12.10.
- wget http://nodejs.org/dist/v0.10.1/node-v0.10.1.tar.gz
- tar -xvf node-v0.10.1.tar.gz
- cd node-v0.10.1
- ./configure --prefix=<a directory to which you have write and execute access>
- make
- make install
- Create a file, say Test.js and add the following lines to it
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8124);
console.log('Server running at http://127.0.0.1:8124/'); - node Test.js
- Open a browser and visit http://127.0.0.1:8124/. If all went fine, you should see Hello World in the browser.
It is as simple as that. I did not hit any road block at all. They all went fine.
No comments:
Post a Comment