1、安装依赖包
yum install python git-core g++ curl libssl-dev apache2-utils
有些包可能不需要,但我忘了具体的包了,所以全写上吧。
2、下载node.js的安装包
进入node.js的官网下载node.js的安装包
http://nodejs.org/dist/node-v0.4.8.tar.gz
下载在本地有解压缩并安装
tar -zxf node-v0.4.8.tar.gz
mv node-v0.4.8 /usr/local
cd /usr/local
./configure
make
make install
3、测试
在本地创建工作空间,并编写测试用例
cd /home/ mkdir workspace
mkdir mytest
vim foo.js
写入如下内容:
var sys = require('sys'),
http = require('http');
http.createServer(function(request,response){
response.writeHeader(200,{'Content-Type':'text/html'});
response.write('hello world!');
response.end();
}).listen(8080);
保存文档。
运行测试用例
cd /home/lee/workspace/mytest
node foo.js
查看结果
打开浏览器,输入:http://localhost:8080
如果能看到:hello world!,则说明node.js安装成功。
(以上步骤都是在fedora 15下运行)