Pomelo安装与部署 -centos

Pomelo源码及wiki网址:https://github.com/NetEase/pomelo

在中文wiki中有两种安装方式: 
第一种是:

 npm install pomelo -g
  •         cd /home/server  #目录可以自定义

第二种是:

git clone https://github.com/NetEase/pomelo.git
cd pomelo
npm install -g

至此Pomelo就安装完成了,接下来,笔者就将部署第一个Helloworld!

首先,需要在pomelo的文件夹外新建一个文件夹Helloworld,并进入该文件夹:

mkdir Helloworld
cd Helloworld
  • 1
  • 2
  • 3

然后初始化Pomelo工程:

pomelo init
  • 1
  • 2

在下面的选项中,笔者选择的是

1
  • 1
  • 2

for web socket(native socket)

初始化之后,运行Helloworld下的安装脚本:

sh npm-install.sh

至此pomelo工程就部署成功了,接下来跑起来吧,Helloworld!

在Helloworld目录下,有三个文件夹,分别是:

  • game-server
  • web-server
  • shared

shared是game-server与web-server的共享目录,现在不用管。 
首先进入game-server目录,并运行:

cd game-server/
pomelo start -D
  • 1
  • 2
  • 3

pomelo命令后添加”-D”是为了让其在后台运行。 
然后进入web-server目录,并运行:

cd..
cd web-server/
node app

至此,服务器就运行起来了

#cd ./web-server/public

#vim index.html 

修改index.html 中var host = "127.0.0.1";为var host = "你的服务器ip";

此时点击‘Test Game Server’按钮,就会出现game server is ok 消息框。


启动浏览器,运行http://你的服务器ip:3001/,看到pomelo的欢迎页面

记得开放端口


https://blog.csdn.net/u012741077/article/details/50489732

https://blog.csdn.net/jonahzheng/article/details/27658985

猜你喜欢

转载自blog.csdn.net/lovemushroom/article/details/80188304