准备服务器,用命令安装宝塔
安装完宝塔通过面板安装,nginx1.24和php5.6(原来自带的就不需要了)
安装完上传我们的服务端,服务端只需要以下几个文件,如图
上传完服务端我们就可以开始执行命令
rm -f /opt/server/redis-5.0.9/dump.rdb
mv /opt/server/mysql5.6 /home/mysql5.6
sed -i "s/需要修改的IP/ 自己的IP/g" `grep 需要修改的IP -rl /opt/`
接着执行MySql
mv /home/mysql5.6 /opt/server/mysql5.6
/opt/server/mysql5.6/bin/mysqld --defaults-file=/etc/my.cnf --user=mysql
注意这里会提示报错,我们需要修改my.cnf配置
执行还会报错,会提示:[ERROR] Fatal error: Can’t change to run as user ‘mysql’ ; Please check that
在终端运行 id mysql
命令创建用户 adduser --system --no-create-home mysql
执行完在启动就成功了
然后我们连接数据库,在数据库新建查询:
DELETE from bigUnionRoomConfig;
DELETE from bigUnionMember;
DELETE from bigUnion;
DELETE from family;
DELETE from player where id<>493924;
DELETE from dbClubmember;
DELETE from dbClubList;
alter table player AUTO_INCREMENT=601237;
update gameType set gameServerIP='自己的IP'
在找到数据库表修改IP:
接下来启动server里面的,因为我们安装了宝塔,很多文件就不需要了
启动/server/mongodb3.2.8和/opt/server/redis-5.0.9/
cd /opt/server/mongodb3.2.8/
/opt/server/mongodb3.2.8/bin/mongod -f /opt/server/mongodb3.2.8/mongodb.conf
cd /opt/server/redis-5.0.9/
./src/redis-server ./redis.conf
在启动rocketmq
cd /opt/server/rocketmq/bin/rocketmq-server
./start.sh
./2m2sastart.sh
./2m2sastartBroker.sh
./2m2sastartNameServer.sh
需要注意这里启动rocketmq会报错,需要修改配置文件broker.conf
启动server_qh_protobuf
cd /opt/server_qh_protobuf
./restart_namegameserver.sh
启动nodejs
cd /opt/game_fb_9905/Server/AccountServer
npm start
这里需要安装一下nodejs
- 下载 node.js
cd /usr/local
// 下载所需版本
wget https://nodejs.org/dist/v14.15.1/node-v14.15.1-linux-x64.tar.gz
// 解压
tar -zxvf node-v14.15.1-linux-x64.tar.gz
// 重命名文件夹
mv node-v14.15.1-linux-x64 node-v14.15.1
- 添加环境变量
vi /etc/profile
- 在文件最后添加以下配置
export NODE_HOME=/usr/local/node-v14.15.1
export PATH=$PATH:$NODE_HOME/bin
- 刷新配置
source /etc/profile
- 验证
node -v
npm -v
安装完在启动就ok了
启动qh_gateway
cd /opt/qh_gateway/Server/GameServer
./restart_namegameserver.sh
启动9905
cd /opt/game_fb_9905
./restart_accountserver.sh
./restart_npm.sh
./restart_pomelo.sh
cd /opt/game_fb_9905
./restart_namegameserver.sh
启动8802
cd /opt/game_8802
./restart_namegameserver.sh
这样启动就算完成了
然后在宝塔里面创建网站服务端就搭建完成了,有不懂的可以联系
视频搭建教程