squad战术小队游戏服务器部署
部署环境 Centos7
部署参考文档:https://squad.fandom.com/wiki/Server_Installation/zh#Linux
一键安装脚本
bash -c "$(curl -sL http://api.bctc-squad.cn/squad_install.sh)"
安装steamcmd工具:
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf - bash steamcmd.sh
系统环境配置:
yum -y install screen glibc libstdc++ glibc.i686 libstdc++.i686
这里使用脚本的形式安装,创建文件夹并编辑以下脚本:
[steam@cd3 ~]$ mkdir squad_server [steam@cd3 ~]$ cat squad_up.sh #!/bin/bash ./steamcmd.sh +login anonymous +force_install_dir squad_server +app_update 403240 validate +quit
运行脚本,等待安装完成:
./squad_up.sh
安装模组且包括更新的
rm -rf /home/steam/squad_server/steamapps/workshop/content/393380/* rm -rf /home/steam/squad_server/SquadGame/Plugins/Mods/* /home/steam/steamcmd.sh +login anonymous +force_install_dir /home/steam/squad_server +app_update 403240 validate +quit /home/steam/steamcmd.sh +login anonymous +force_install_dir /home/steam/squad_server +workshop_download_item 393380 1959152751 +quit /home/steam/steamcmd.sh +login anonymous +force_install_dir /home/steam/squad_server +workshop_download_item 393380 3014073690 +quit /home/steam/steamcmd.sh +login anonymous +force_install_dir /home/steam/squad_server +workshop_download_item 393380 3038864732 +quit cp -rp /home/steam/squad_server/steamapps/workshop/content/393380/* /home/steam/squad_server/SquadGame/Plugins/Mods/
如果你是Windows系统
rmdir /s /q D:\squad_server1\steamapps\workshop\content\393380\ rmdir /s /q D:\squad_server1\SquadGame\Plugins\Mods\ D:\steamcmd\steamcmd.exe +login anonymous +force_install_dir D:\squad_server1 +app_update 403240 validate +quit D:\steamcmd\steamcmd.exe +login anonymous +force_install_dir D:\squad_server1 +workshop_download_item 393380 1959152751 +quit D:\steamcmd\steamcmd.exe +login anonymous +force_install_dir D:\squad_server1 +workshop_download_item 393380 3014073690 +quit D:\steamcmd\steamcmd.exe +login anonymous +force_install_dir D:\squad_server1 +workshop_download_item 393380 3038864732 +quit xcopy /E /I D:\squad_server1\steamapps\workshop\content\393380\* D:\squad_server1\SquadGame\Plugins\Mods\
编辑启动脚本:
#!/bin/bash /home/steam/squad_server/SquadGameServer.sh Port=6301 QueryPort=26301 FIXEDMAXPLAYERS=100 RANDOM=NONE #旧版本
新版本下:
-beaconport=16301 Port=6301 QueryPort=26301 multihome=1.1.1.1 FIXEDMAXTICKRATE=50
启动脚本即可运行服务器。
拓展内容:
配置文件描述:
Admins.cfg # 权限组[管理员] Bans.cfg # 封禁玩家列表 License.cfg # 许可证 MapRotation.cfg # 地图循环列表 MOTD.cfg # 服务器介绍[每日消息] Rcon.cfg # 远程管理配置 RemoteAdminListHosts.cfg # 远程权限组[管理员]列表 RemoteBanListHosts.cfg # 远程封禁玩家列表 Server.cfg # 服务器配置 ServerMessages.cfg # 服务器循环[红字]公告
远程管理[Rcon]
文件名:Rcon.cfg
如果您不想使用 远程管理[Rcon],请将密码 [Password=] 设置为空。 注意: 如果IP为 0.0.0.0,将自动绑定到默认的公网IP。
这里推荐一个远程管理工具:https://github.com/Tiiffi/mcrcon
安装方法:
git clone https://github.com/Tiiffi/mcrcon cd mcrcon make && make install
使用方法:
Option: -H Server address (default: localhost) -P Port (default: 25575) -p Rcon password -t Terminal mode -s Silent mode -c Disable colors -r Output raw packets -w Wait for specified duration (seconds) between each command (1 - 600s) -h Print usage -v Version information
针对squad的非交互式的使用方法:
mcrcon -H 127.0.0.1 -P 21114 -p passwd "AdminBroadcast 消息发送" ok
参考命令(在本地运行):
[root@cd3 mcrcon-master]# mcrcon -P 21114 -p passwd
配置文件参考文档:https://squad.fandom.com/wiki/Server_Configuration/zh
崩溃自动拉起脚本:
#!/bin/bash source /home/steam/.bash_profile SD=`tail -10 /home/steam/squad_server/nohup.out|grep Shutdown|wc -l` if [ $SD -eq 1 ]; then kill `ps -ef|grep SquadGameServer |grep -v grep |awk '{print $2}'` fi SQ=`ps -ef | grep SquadGameServer | grep -v grep | grep steam | wc -l` if [ $SQ -ne 2 ]; then kill `ps -ef|grep SquadGameServer |grep -v grep |awk '{print $2}'` cd /home/steam/squad_server nohup bash ./start.sh > /home/steam/squad_server/nohup.out & fi
如果有其他会影响刷新日志的脚本,需要将其他脚本sleep数秒,此脚本在crontab中需要最高优先级,并且每分钟监控执行。
模组添加方法
参考如下,修改游戏更新脚本:
#!/bin/bash ./steamcmd.sh +login anonymous +force_install_dir ./squad_server +app_update 403240 validate +quit ./steamcmd.sh +login anonymous +force_install_dir ./squad_server +workshop_download_item 393380 2934263749 +quit ./steamcmd.sh +login anonymous +force_install_dir ./squad_server +workshop_download_item 393380 2891780963 +quit ./steamcmd.sh +login anonymous +force_install_dir ./squad_server +workshop_download_item 393380 2421120620 +quit ./steamcmd.sh +login anonymous +force_install_dir ./squad_server +workshop_download_item 393380 2848273764 +quit ./steamcmd.sh +login anonymous +force_install_dir ./squad_server +workshop_download_item 393380 2908652819 +quit cp -rp /home/steam/squad_server/steamapps/workshop/content/393380/* /home/steam/squad_server/SquadGame/Plugins/Mods/
运行后重新启动服务端即可。
认证服申请:http://master.joinsquad.com/dedicatedserverlicense
训练场不可用的解决方法
修改配置文件ExcludedLayers.cfg和ExcludedLevels.cfg
其中ExcludedLayers.cfg是用于禁止的地图精准匹配,ExcludedLevels.cfg则为模糊匹配,使用//注释即可。
已有3位网友发表了看法:
发表评论