


























教程演示虚拟机地址:192.168.200.129
组队 PK需要放行UDP端口(在服务器控制面板,安全组里面放行。不是在宝塔放行)
安全组放行规则
TCP:1-65535
UDP:1-65535
安装宝塔直接运行命令即可。
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
输入y确认安装
输入n取消安装SSL
演示环境:
centos 7.6
nginx1.20
MySQL5.6
PHP7.1(安装sg11和Redis扩展)
PM2管理器
1、关闭防火墙、开放端口
systemctl stop firewalld
systemctl disable firewalld
防火墙不关闭也行
宝塔放行端口:1:65535
或单独打开 自行抓包
PS:如果使用腾讯云或阿里云记得把控制台的端口也打开
2、上传ald.tar.gz到服务器根目录(根目录不是root目录!!使用WinSCP或其他工具上传数据,也可以直接宝塔传!!)
解压ald.tar.gz
cd /
tar zxvf ald.tar.gz
给予 777权限
chmod -R 777 /root/
chmod -R 777 /www/wwwroot/
3.环境配置
添加libmysqlclient.so软链接
ln -s /www/server/mysql/lib/libmysqlclient.so /usr/lib64/libmysqlclient.so
ldconfig
安装gcc5.2环境
cd /root
wget –no-check-certificate https://copr.fedoraproject.org/coprs/hhorak/devtoolset-4-rebuild-bootstrap/repo/epel-6/hhorak-devtoolset-4-rebuild-bootstrap-epel-6.repo -O /etc/yum.repos.d/devtoolset-4.repo
上面是一条命令!!!全部复制粘贴!
yum install compat-libgmp-4.3.1-1.sl7.x86_64.rpm -y
yum install compat-libmpfr-2.4.1-1.sl7.x86_64.rpm -y
yum install devtoolset-4-gcc devtoolset-4-gcc-c++ devtoolset-4-binutils -y
scl enable devtoolset-4 bash
修改root目录的.bashrc文件,添加如下内容:
source /opt/rh/devtoolset-4/enable
4、设置数据库密码为:syymw.com(在宝塔直接设置,修改后点下 从服务器获取看看改成功没!提示数据库密码错误就在改一次,直到能获取到0个)
先修改配置吧!
修改数据库配置文件 为 “数据库配置.txt” 内的内容
重启数据库
修改数据库
\root\sql\demoald.sql 的 IP
\root\sql\ald_web.sql
命令行输入
cd /root
./sk
数据库创建结束。可以通过宝塔查看是否创建成功。(数据库 – 点击 从服务器获取 获取到1个就正确的)
运行后为了安全可以把 sk 文件删除
6、搭建网站
新建一个网站-你的ip:端口 或域名:端口
有端口就添加端口这里的端口81 (你也可以用其他的端口,不过就需要对应客户端都改)
网站目录设置/www/wwwroot/game
运行目录 /public
设置伪静态 thinkPHP
关闭防跨站
———————————————————————
7、服务端和网站修改 192.168.200.129 修改为你的IP
服务端修改:
/root/platform/Config/UdpServer.xml
/root/platform/CenterServer/CenterServer.cfg
/root/platform/RelayServer/RelayServer.cfg
/root/platform/RelayServer1/RelayServer.cfg
/root/platform/UdpConnServer/UdpConnServer.cfg
/root/platform/UdpConnServer1/UdpConnServer.cfg
/root/s1/AdminServer/AdminServer.cfg
/root/s1/AdminServer/NetAddress.xml
/root/s1/Config/UdpServer.xml
到此算服务端就可以了,下面看看客户端
7、启动游戏服务
宝塔配置PM2管理器
启动文件
/www/wwwroot/gmald/src/app.js
PS:PM2添加项目出错解决方法
更换Node版本
游戏总是掉线的解决办法:
PM2添加的项目内存 加大
启动游戏
启动platform服务
cd /root/platform
./run.sh
启动一区
cd /root/s1
./run.sh
关闭游戏
关闭platform服务
cd /root/platform
./stop.sh
关闭一区
cd /root/s1
./stop.sh
启动后可以通过
端口查看命令 netstat -lntp
8、客户端修改
安卓 改192.168.200.129
assets/updateserver.json
assets/bin/Data/Managed/Assembly-CSharp.dll
在Assembly-CSharp.dll中数字/字符串搜索192.168.200.129,然后改成你的ip 一共替换5 处
苹果:修改IP的时候 位数一定要对位,超出12位IP的用域名替换 搜al.syymw.com
Payload/test.app/Data/Raw/updateserver.json
Payload/test.app/Data/Managed/Metadata/global-metadata.dat
客户端我这里用
ApkToolAid已经反编译了
直接修改
替换后 回签签名即可,这里就不演示了
下面启动试试
注册账号
邀请码:syymwcom
可以正常登陆。
好了。本期教程到此结束。
祝君好运。。。。
其他自行研究吧。。。
PS:
简单介绍下GM后台使用
1、
总后台地址
http://ip:81/admin/Login.html
账号 admin666 密码 syymwcom