Nodejs安装,nodejs


1 下载NodeJS  

  https://nodejs.org/download/

  最新版下载地址 

  # wget https://nodejs.org/dist/v0.12.7/node-v0.12.7.tar.gz

 

2 解压安装NodeJS

  # tar zxvf node-v0.12.7.tar.gz

  # cd node-v0.12.7

  # ./configure

  # make 

  # make install

  验证是否安装完成 

  # node -v

  v0.12.7  (能看到版本号说明安装成功)

 

3 验证是否能正常启动

  1. 建立文件 app.js

var http = require("http");
exports.start = function(){
  http.createServer(function(request, response) {
    response.write('Server start Success ...');
    response.end();
  }).listen(8899);
}
exports.start();

2. 修改文件 app.js 的属性

# chmod 777 app.js

3. 启动NodeJS

# node app.js

4. 访问 http://ip:8899 

如果能正常看到页面 说明配置成功。

 

相关内容

    暂无相关文章