CentOS安装node.js全解

1、下载node.js源码
wget http://nodejs.org/dist/v0.10.33/node-v0.10.33.tar.gz

2、解压
tar zxvf node-/v0.10.33.tar.gz

3、安装
make
make install

4、查看版本
node -v

5、编写测试页

vi example.js
[plain] view plaincopy
var http = require('http');  
http.createServer(function (req, res) {  
    res.writeHead(200, {'Content-Type': 'text/plain'});  
        res.end('Hello World\n');  
}).listen(1337, "192.168.85.xx");  
console.log('Server running at http://192.168.85.<span style="color:#000000;">xx</span>:1337/');

猜你喜欢

转载自zhelong111.iteye.com/blog/2164692