LinuxGSM 是用于快速、简单地部署和管理 Linux 专用游戏服务器的命令行工具。
官网地址:https://linuxgsm.com
饥荒服务器搭建文档:https://linuxgsm.com/servers/dstserver
1. 服务器
准备一台1核2G的腾讯云服务器
or阿里云服务器
,我这使用的centos
系统,所以下面教程内容全部以该系统为主。
2. LinuxGSM依赖安装
yum install epel-release
yum install curl wget tar bzip2 gzip unzip python3 binutils bc jq tmux glibc.i686 libstdc++ libstdc++.i686 libcurl.i686
3. LinuxGSM安装
3.1 添加用户
# 添加用户
adduser dstserver
# 设置密码
passwd dstserver
# 切换到该用户
su dstserver
3.2 下载LinuxGSM
wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh dstserver
如果出现了
github访问超时
,可以按照这个文章方式调整,地址:https://blog.csdn.net/unstorm/article/details/121532868
3.3 初始化
./dstserver install
3.4 添加存档
找到本地的Cluster_1
存档,将里面内容,放到云服务器~/.klei/DoNotStarveTogether/Cluster_1
位置(可以使用ftp工具
上传文件)
配置token
进入这个网址配置token,https://accounts.klei.com/account/game/servers?game=DontStarveTogether
名字随便起,然后点击添加新服务器就行。
拿到token后,将内容复制到~/.klei/DoNotStarveTogether/Cluster_1/cluster_token.txt
中
修改LinuxGSM配置
cd ~/lgsm/config-lgsm/dstserver
把_default.cfg
中的内容复制出来,粘贴到dstserver.cfg
中,同时新建一个dstserver_caves.cfg
文件,内容一并复制过去。
dstserver.cfg 修改如下:
sharding="true"
master="true"
shard="Master"
cluster="Cluster_1"
cave="false"
dstserver_caves.cfg 修改如下:
sharding="false"
master="false"
shard="Caves"
cluster="Cluster_1"
cave="true"
修改mods:
修改云服务器中dedicated_server_mods_setup.lua
文件
vim ~/serverfiles/mods/dedicated_server_mods_setup.lua
按照下方方式修改
--There are two functions that will install mods, ServerModSetup and ServerModCollectionSetup. Put the calls to the functions in this file and they will be executed on boot.
--ServerModSetup takes a string of a specific mod's Workshop id. It will download and install the mod to your mod directory on boot.
--The Workshop id can be found at the end of the url to the mod's Workshop page.
--Example: http://steamcommunity.com/sharedfiles/filedetails/?id=350811795
--ServerModSetup("350811795")
--ServerModCollectionSetup takes a string of a specific mod's Workshop id. It will download all the mods in the collection and install them to the mod directory on boot.
--The Workshop id can be found at the end of the url to the collection's Workshop page.
--Example: http://steamcommunity.com/sharedfiles/filedetails/?id=379114180
--ServerModCollectionSetup("379114180")
ServerModSetup("345692228")
ServerModSetup("347079953")
ServerModSetup("这块填你的mod ID")
mod ID
可以在Cluster_1/Master/modoverrides.lua
文件中查看,如图:
配置启动命令
cp ~/dstserver ~/dstserver_caves
启动
启动主世界
cd ~
./dstserver start
等待启动后执行
./dstserver console
查看主服务控制台,查看日志。
看到启动成功日志后证明专用服务器已经搭建成功了,然后按照Ctrl + B
再按D
的方式安全退出控制台。
继续启动洞穴服务
cd ~
./dstserver_caves start
继续按照上方查看控制台的方式看两个世界是否连接成功。等待连接成功后,两个服务就都起好了~