文档:
https://github.com/NetEase/pomelo/wiki
https://github.com/NetEase/pomelo/wiki/Home-in-Chinese
文档:
https://github.com/joyent/node/wiki/Installation
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#debian-and-ubuntu-based-linux-distributions
步骤:
l 安装nodejs
# curl -sL https://deb.nodesource.com/setup | bash -
# apt-get install -y nodejs
l 检查nodejs是否安装成功
$ node –v
l 安装 pomelo
方法1:使用npm(node包管理工具)全局安装pomelo
$ npm install pomelo –g
方法2:下载源代码安装
$ git clone https://github.com/NetEase/pomelo.git
$ cd pomelo
$ npm install -g
备注:
npm文档
https://docs.npmjs.com/
安装问题
安装pomelo时,提示
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.10.28"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/root/.nvm/v0.10.28/lib/node_modules/pomelo/node_modules/pomelo-rpc/node_modules/toobusy/.node-gyp"
命令换成 npm install pomelo -g --unsafe-perm 就可以成功
运行到gyp http GET http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz时, 整个安装过程会有点久,需耐心等待
提示
gyp ERR! stack Error: not found: make
安装make:
apt-get install make
Pomelo 命令行工具:
https://github.com/NetEase/pomelo/wiki/pomelo%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8
l 创建项目
$ pomelo init ./projectname
l 安装依赖包
$ cd projectname
$ sh npm-install.sh
l 启动game-server
$ cd game-server
$ pomelo start
l 启动web-server
$ cd web-server
$ node app
l 测试
启动浏览器,地址:
http://hostip:3001/
l 修改服务器IP
$ vim web-server/public/index.html
Var host = “127.0.0.1” 修改成服务器game-server的IP地址