


























服务器系统:centos7.6 服务器最低配置4核8g
教程演示虚拟机地址: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
安装环境:
nginx1.20
MySQL5.6
PHP7.1(安装sg11和Redis扩展)
Redis6.2.7
PM2管理器
1、关闭防火墙、开放端口
宝塔放行端口:1:65535
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
或单独打开 自行抓包
PS:如果使用腾讯云或阿里云记得把控制台的端口也打开
2、上传ald.tar.gz到服务器根目录(根目录不是root目录!!使用WinSCP或其他工具上传数据,也可以直接宝塔传!!)
解压ald.tar.gz
cd /
tar zxvf ald.tar.gz
unzip ald.zip
给予 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
修改数据库配置文件 为 “数据库配置.txt” 内的内容
重启数据库
修改数据库ip192.168.200.129
\root\sql\demoald.sql 的 IP
\root\sql\ald_web.sql 的 IP
执行命令导入数据库
cd /root
./sk
数据库创建结束。可以通过宝塔查看是否创建成功。(数据库 – 点击 从服务器获取 获取到1个就正确的)
运行后为了安全可以把 sk 文件删除
6、搭建网站
新建一个网站-你的ip:端口 或域名:端口
有端口就添加端口这里的端口81 (你也可以用其他的端口,不过就需要对应客户端都改)
网站目录设置/www/wwwroot/game
运行目录 /public
设置伪静态 thinkPHP
关闭防跨站
———————————————————————
7、服务端和网站修改 192.168.200.129 修改为你的IP
服务端修改:
/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
/root/s2/AdminServer/AdminServer.cfg
/root/s2/AdminServer/NetAddress.xml
/root/s2/Config/UdpServer.xml
/root/s3/AdminServer/AdminServer.cfg
/root/s3/AdminServer/NetAddress.xml
/root/s3/Config/UdpServer.xml
/root/s4/AdminServer/AdminServer.cfg
/root/s4/AdminServer/NetAddress.xml
/root/s4/Config/UdpServer.xml
/root/s5/AdminServer/AdminServer.cfg
/root/s5/AdminServer/NetAddress.xml
/root/s5/Config/UdpServer.xml
/root/s6/AdminServer/AdminServer.cfg
/root/s6/AdminServer/NetAddress.xml
/root/s6/Config/UdpServer.xml
网站修改:
/www/wwwroot/game/application/pay/view/home/gateway.html
到此算服务端就可以了,下面看看客户端
7、启动游戏服务
宝塔配置PM2管理器
启动文件
/www/wwwroot/gmald/src/app.js
PS:PM2添加项目出错解决方法
更换Node版本
游戏总是掉线的解决办法:
PM2添加的项目内存 加大
启动游戏
启动服务端
cd /root/platform
./run.sh
启动一区
cd /root/s1
./run.sh
启动二区
cd /root/s2
./run.sh
启动三区
cd /root/s3
./run.sh
启动四区
cd /root/s4
./run.sh
启动五区
cd /root/s5
./run.sh
启动六区
cd /root/s6
./run.sh
关闭服务端
cd /root/platform
./stop.sh
关闭一区
cd /root/s1
./stop.sh
关闭二区
cd /root/s2
./stop.sh
关闭三区
cd /root/s3
./stop.sh
关闭四区
cd /root/s4
./stop.sh
关闭五区
cd /root/s5
./stop.sh
关闭六区
cd /root/s6
./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
苹果:修改IP的时候 位数一定要对位,超出15位IP的用域名替换 搜alda.syymw.com
Payload/test.app/Data/Raw/updateserver.json
Payload/test.app/Data/Managed/Metadata/global-metadata.dat
下面启动试试
注册账号
邀请码:syymwcom1
可以正常登陆。
好了。本期教程到此结束。
祝君好运。。。。
其他自行研究吧。。。
PS:
简单介绍下GM后台使用
1、
总后台地址
http://ip:81/admin/Login.html
账号:admin666
密码:2022.syymw.com
新版GM授权后台:
http://ip:81/gmht/gm.php
GM码:syymw.com
玩家后台:
http://ip:81/gmht/
友情提示:如果是阿里云或者腾讯云架设 请注意端口是否开放。
本期教程到此结束。