node.js安装步骤:
1:准备工作
wget http://nodejs.org/dist/v0.10.31/node-v0.10.31.tar.gz
yum install gcc openssl-devel gcc-c++ compat-gcc-34 compat-gcc-34-c++
2:开始安装node.js
tar-zxvf node-v0.10.31.tar.gz
cd node-v0.10.24
./configure--prefix=/usr/local/node
make
make install
ln-s/usr/local/node/bin/* /usr/sbin/
到此node就安装完了
3.测试是否安装成功
测试脚本:
cat example.js
var http =require('http');
http.createServer(function(req, res){
res.writeHead(200,{'Content-Type':'text/plain'});
res.end('Hello World\n');
}).listen(1337,'127.0.0.1');
console.log('Server runing at http://127.0.0.1:8080/');
命令行:[root@guanyy softbag]#node example.js
浏览器访问:httlp://localhost:8080/