NodeJS + Socket.io搭建聊天服务器

第一步:安装node

git clone https://github.com/joyent/node.git

cd node

git checkout v0.10.33-release

./configure

make

make install

 

第二步:安装npm

     mac下使用命令ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

第三步:安装redis

wget http://download.redis.io/releases/redis-2.8.17.tar.gz

cd redis-2.8.17

make

启动redis服务

src/redis-server

 

第四步:创建package.json

cd /data/project/current/

npm init

name: (20141201051425) chat-server

version: (1.0.0)

description: chat nodejs socket.io

entry point: (chat_server.js)

test command: chat-server

git repository: (https://github.com/monstar-lab/maturi.git)

keywords: chat nodejs socket.io

author: project

license: (ISC)

 

第五步:

npm install redis --save

npm install socket.io --save

npm install socket.io-redis --save

npm install fs --save

你可能感兴趣的:(socket)