Chinaunix首页 | 论坛 | 博客
  • 博客访问: 71635
  • 博文数量: 22
  • 博客积分: 511
  • 博客等级: 中士
  • 技术积分: 200
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-27 16:19
文章分类

全部博文(22)

文章存档

2012年(1)

2011年(21)

我的朋友

分类: LINUX

2011-12-01 23:50:41

下面分别介绍在, ,以及下安装.

Mac

在Mac下,如果你喜欢用,那么只用一行就可以装好:

brew install node

否则,只能考虑手工安装了,步骤如下:

    1. 安装Xcode
    2. 运行下面的命令行编译node.js git clone git://github.com/joyent/node.git cd node ./configure make sudo make install
Ubuntu
    1. 安装依赖包 sudo apt-get install g++ curl libssl-dev apache2-utils sudo apt-get install git-core
    2. 运行下面的命令行: git clone git://github.com/joyent/node.git cd node ./configure make sudo make install
Windows

用cygwin来安装node,步骤如下:

    1. 安装
    2. 在cygwin的目录下,运行setup.exe安装下面列表中的包
      • devel → openssl
      • devel → g++-gcc
      • devel → make
      • python → python
      • devel → git
    3. 运行cygwin
    4. 运行下面的命令行: git clone git://github.com/joyent/node.git cd node ./configure make sudo make install
Centos
 
yum install gcc-c++ openssl-devel
wget --no-check-certificate
tar -xzvf ry-node-v0.3.3-0-g57544ba.tar.gz
cd ry-node-v0.3.3-0-g57544bac1
./configure
make
make install
Hello Node.js!

写一段小程序例如hello_node.js来验证安装是否正确:

var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello Node.js\n'); }).listen(8124, "127.0.0.1");
 console.log('Server running at ');

用node来运行这段代码

node hello_node.js
Server running at http://127.0.0.1:8124/

现在,用浏览器打开 , 应该能够看到一条好消息。

阅读(1501) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

小蝌蚪1232011-12-03 23:23:06

一行就可以装好brew install node!