centos安装node.js

确保安装了python,大部分安装失败都是由于python版本过低导致。安装之前,升级python版本,升级步骤 http://www.tomtalk.net/wiki/Python

[root@SNDA-192-168-15-161 ~]# python -V
Python 2.7.3
开始安装:


1、安装node.js--v0.11.5

wget http://nodejs.org/dist/v0.11.5/node-v0.11.5.tar.gz
tar -zxvf node-v0.11.5.tar.gz 
./configure
make && make install
make && make install 时间会稍微长一点

2、测试

创建hello.js文件,内容如下:

var http=require('http');
http.createServer(function(req,res){
        res.writeHead(200,{'Content-type':'text/plain'});
        res.end('hello world\n');
}).listen(8001,'192.168.8.204');
console.log('Server running at http://192.168.8.204:8001');

运行:node hello.js

在浏览器里输入 http://192.168.8.204:8001/,可以看到 "hello world"字样


注:监听IP地址(192.168.8.204)可以省略



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值