Linux下饥荒远程服务器配置教程(包含mod的配置)(19/08/22/更新游戏更新后搜索不到服务器的对策)

目录:

  • 前言
  • 安装环境库
  • 安装steamcmd
  • 创建默认文件夹
  • 关于mod
  • 后记:关于游戏更新

keyword/关键词: 饥荒 服务器 配置 linux ubuntu

参考链接:
https://blog.csdn.net/szhiy/article/details/79996017
https://blog.csdn.net/qq_35543890/article/details/81257937
https://blog.csdn.net/qq_35543890/article/details/81257937
https://www.kancloud.cn/kaixnet/dst/124266
最后还有官方wiki
https://developer.valvesoftware.com/wiki/SteamCMD
https://dontstarve.fandom.com/wiki/Guides/Don%E2%80%99t_Starve_Together_Dedicated_Servers

为什么参考链接有这么多条就是因为野路子不靠谱,mod的那位竟然还写错文件夹。
最好用的还是官方,但wiki是英文的,so…
最后插2条废话,
本人白嫖亚马逊aws和谷歌的gcp都试过,系统最好不要用centos(特别是6)
选用ubuntu或Debian,因为官方文档也这么说了


正文:

流程提示:

  • 安装环境库
  • 安装steam
  • 手动建立游戏(饥荒)文件夹
  • 配置游戏设置文件,服务器可以运行了!
  • 配置mod文件

另外,在复制代码的时候建议删除注释 --后面的内容,因为vim有时候会出bug

1.先安装环境库
centos:

yum install glibc.i686 libstdc++.i686 libcurl.i686 –y

ubuntu/Debian:

sudo apt-get install libstdc++6:i386 libgcc1:i386 libcurl4-gnutls-dev:i386 lib32gcc1

大概率会成功,如果失败的话,可以参考下方官方给出的解决方法,注意自己的os位数:

sudo dpkg --add-architecture i386 # If running a 64bit OS
sudo apt-get update
sudo apt-get install lib32gcc1    # If running a 64bit OS
sudo apt-get install lib32stdc++6 # If running a 64bit OS
sudo apt-get install libgcc1      # If running a 32bit OS
sudo apt-get install libcurl4-gnutls-dev:i386

补充:
在安装 sudo apt-get install libcurl4-gnutls-dev:i386时候
可能会出现Unable to locate package libcurl4-gnutls-dev ,应该是配置源未被扫描

解决方案:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libcurl4-gnutls-dev:i386

后,再次执行安装

sudo apt-get install libcurl4-gnutls-dev:i386

2.下载/安装steamcad

wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -zxvf steamcmd_linux.tar.gz

希望增加一个user的可以自己useradd steam,反正我是无所谓…

运行steamcad

./steamcmd.sh

可能出现 不存在目录/root/linux32/steamcmd: No such file or directory

steamcmd: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

原因是steam为32位,建议更新apt-get后安装32位的依赖:

apt-get update
sudo apt-get install lib32stdc++6
apt-get install lib32gcc1

可进入steam命令模式

>steam

匿名登陆(不需要很傻的登陆自己的steam账号)

login anonymous

指定安装文件夹 DSTserver

force_install_dir DSTserver

安装游戏

app_update 343050 validate

安装成功后输入quit 或 ctrl + c退出

3.创建饥荒默认文件夹

mkdir -p ~/.klei/DoNotStarveTogether/Documents
cd .klei/DoNotStarveTogether/Documents/

然后去游戏界面获取cluster_token 和 UserID,并填入adminlist.txt和cluster_token.txt 文件中

UserID:
在这里插入图片描述
cluster_token:
在这里插入图片描述
在这里插入图片描述

最后将获得的2串值分别写入2个文件里

echo 你的UserID > adminlist.txt


echo 你的Token > cluster_token.txt

接着配置服务器文件cluster.ini
可以修改服务器描述、服务器名称、服务器密码

vim cluster.ini

·

[GAMEPLAY]
max_players = 6
pvp = false
game_mode = endless
pause_when_empty = true
vote_kick_enabled = true

[NETWORK]
cluster_description = 服务器描述
cluster_name = 服务器名称
cluster_password = 服务器密码
cluster_intention = cooperative

[MISC]
max_snapshots = 6
console_enabled = true

[SHARD]
shard_enabled = true
bind_ip = 127.0.0.1
master_ip = 127.0.0.1
master_port = 10889
cluster_key = supersecretkey

再创建地表文件Master

mkdir Master
cd Master

创建server.ini和worldgenoverride.lua

vim server.ini

·

[NETWORK]
server_port = 11000
 
[SHARD]
is_master = true
 
[STEAM]
master_server_port = 27018
authentication_port = 8768
 
[ACCOUNT]
encode_user_path = true

vim worldgenoverride.lua

·

return {
    override_enabled = true,
    preset = "SURVIVAL_TOGETHER",
}

同理,在Documents下配置地下世界Caves,这里直接复制命令

cd ..
cp –r Master Caves

但是其中的内容并不一样,需要自己修改,建议用vim的清空命令dG

 vim server.ini

·

[NETWORK]
server_port = 11001
 
[SHARD]
is_master = false
name = Caves
id = 1811570792
 
[STEAM]
master_server_port = 27019
authentication_port = 8769
 
[ACCOUNT]
encode_user_path = true

·

vim worldgenoverride.lua

·

return {
         override_enabled = true,
         preset = "DST_CAVE",
         misc = {
                 world_size = "huge"
         }
 }

进入主目录,创建启动脚本

cd ~

·

vim startDST.sh

·

#!/bin/bash
steamcmd_dir="$HOME/steamcmd"
install_dir="$HOME/DSTserver"
cluster_name="Documents"
cd "$install_dir/bin"
 
run_shared=(./dontstarve_dedicated_server_nullrenderer)
run_shared+=(-console)
run_shared+=(-cluster "$cluster_name")
run_shared+=(-monitor_parent_process $$)
 
#如果你的主机只有1g内存,必须删除 & 后面的caves的内容,因为带不动地下世界
"${run_shared[@]}" -shard Master | sed 's/^/Master: /' &
"${run_shared[@]}" -shard Caves  | sed 's/^/Caves:  /'

给脚本权限

chmod 777 startDST.sh

最后检查一下环境

ldd ~/DSTserver/bin/dontstarve_dedicated_server_nullrenderer

看看还有谁是not found,如果没有基本就可以正常开启服务器了(下图是失败例)
在这里插入图片描述

最后运行服务器,最好安装个screen,方便查看内存和性能,如果你Linux不熟就算了…

screen -S  dst  #开启,需要退出可以ctrl + a + d
screen -r dst #恢复screen

启动服务器

./startDST.sh

可以点击此官方服务器链接查看服务器是否正常启动
关闭的话ctrl + c 或者接shutdown
我的aws因为没有关闭服务器被扣cpu积分了,真的要玩的时候卡死
谷歌更惨,直接被人拿作dos攻击被封禁…也许是饥荒服务器也是不干净?

4.关于mod的安装
需要
①修改安装目录下的dedicated_server_mods_setup.lua
②Master下的modoverrides.lua
(如开启了地下世界则还有Caves下的,我没有开启)

编辑游戏安装目录DSTserver下的dedicated_server_mods_setup.lua
mod写入的格式是:(对于同一个mod来说一般要输入2行)

ServerModSetup("mod代号,在steam的mod页面可以查看")   --用于安装mod
ServerModCollectionSetup("mod代号") --用于更新mod

开始编辑mod文件!

vim DSTserver/mods/dedicated_server_mods_setup.lua

填入内容,下面是我常用的一些mod

ServerModSetup("362175979") -- Wormhole Marks       标记相联通的虫洞
ServerModSetup("378160973") -- Global Positions     小地图显示玩家位置 共享地图发现
ServerModSetup("385006082") -- DST Path Lights      路径灯在黄昏时开启,在黎明时关闭
ServerModSetup("396822875") -- Spike Trap           增加两个陷阱 
ServerModSetup("444235588") -- Deluxe Campfires     豪华营火 增加燃烧时间
ServerModSetup("458587300") -- Fast Travel          快速旅行
ServerModSetup("458940297") -- FFood Values         显示食物价值
ServerModSetup("462372013") -- Always fresh         冰箱里物品永远不坏 
ServerModSetup("462434129") -- Restart              #重生 #复活 #自杀 Y:公聊 U:私聊
ServerModSetup("604761020") -- Multi Rocks          持久挖矿 让卵石更耐挖
ServerModSetup("623286817") -- Free transplant      移植无需施肥
ServerModSetup("661253977") -- Don't Drop Everything 死亡不掉落
ServerModSetup("666155465") -- Show Me              鼠标显示更多信息
ServerModSetup("785295023") -- Super Wall DST       超级墙DST 无敌的超级墙、自动门、栅栏和栅栏门
ServerModSetup("786556008") -- 45 Inventory Slots   45个格子
ServerModSetup("831523966") -- 999 Stack Size       叠加物品到 999 个
ServerModSetup("1301033176") -- Chinese Language    中文语言包 汉化了人物台词

ServerModSetup("375850593") --Extra Equip Slots
ServerModSetup("371920345") --[DST]Auto Catch
ServerModSetup("385006082") --DST Path Lights
ServerModSetup("356930882") --Infinite Tent Uses
ServerModSetup("1200745268") --快速工作
ServerModSetup("478005098") --Craftable Gears
ServerModSetup("386087632") --Golden Spear [DST]
ServerModSetup("365119238") --Smarter Crock Pot
ServerModSetup("376333686") --Combined Status
ServerModSetup("345692228") --Minimap HUD
ServerModSetup("396026892") --Large Chest
ServerModSetup("670918115") --Imperishable Thermal Stone
ServerModSetup("385006082") --DST Path Lights


ServerModCollectionSetup("362175979")
ServerModCollectionSetup("378160973")
ServerModCollectionSetup("385006082")
ServerModCollectionSetup("444235588")
ServerModCollectionSetup("458587300")
ServerModCollectionSetup("458940297")
ServerModCollectionSetup("462372013")
ServerModCollectionSetup("462434129")
ServerModCollectionSetup("623286817")
ServerModCollectionSetup("661253977")
ServerModCollectionSetup("666155465")
ServerModCollectionSetup("785295023")
ServerModCollectionSetup("786556008")
ServerModCollectionSetup("831523966")
ServerModCollectionSetup("1301033176") 
ServerModCollectionSetup("1418746242")
ServerModCollectionSetup("572538624") 
ServerModCollectionSetup("367546858")
ServerModCollectionSetup("375850593")
ServerModCollectionSetup("371920345")
ServerModCollectionSetup("385006082")
ServerModCollectionSetup("356930882")
ServerModCollectionSetup("1200745268")
ServerModCollectionSetup("478005098")
ServerModCollectionSetup("386087632")
ServerModCollectionSetup("365119238")
ServerModCollectionSetup("376333686")
ServerModCollectionSetup("345692228")
ServerModCollectionSetup("396026892")
ServerModCollectionSetup("670918115")
ServerModCollectionSetup("385006082")

②再编辑klei下的地表,和地下(如有)服务器的配置modoverrides.lua
mod格式:

return {
  	["workshop-371920345"]={ configuration_options={  }, enabled=true },
  	...
  }

但是有个问题,有些mod的options还有其他的参数
(比如复活的mod,你需要设置restart和resurrect的天数)
这里有个很讨巧也很弱智的办法,你在自己的本机服务器上全部配置一遍
然后调好参数,把modoverrides.lua复制到远程服务器便可
可能会出现格式变乱但是不影响使用

地面:

vim  ./.klei/DoNotStarveTogether/Documents/Master/modoverrides.lua

(下面是我的服务器参数设置)

return {
  ["workshop-1200745268"]={
    configuration_options={
      Animal=true,
      BuildRepair=true,
      ChopTime=1,
      CookTime=0,
      FishTime=0,
      HSHU=true,
      MineTime=1,
      Others=true,
      Pick=true,
      QuickDry=true,
      QuickGrow=0 
    },
    enabled=true 
  },
  ["workshop-1301033176"]={ configuration_options={ LANG="auto" }, enabled=true },
  ["workshop-1673729468"]={
    configuration_options={ [""]=0, light_colour="white", light_radius="medium" },
    enabled=true 
  },
  ["workshop-356930882"]={ configuration_options={ uses=10000000, uses2=10000000 }, enabled=true },
  ["workshop-361994110"]={
    configuration_options={ HAT_DECAY=false, RELEASE_BEES=false, SPRING_BEES=true },
    enabled=true 
  },
  ["workshop-362175979"]={ configuration_options={ ["Draw over FoW"]="disabled" }, enabled=true },
  ["workshop-371920345"]={ configuration_options={  }, enabled=true },
  ["workshop-375850593"]={ configuration_options={  }, enabled=true },
  ["workshop-375859599"]={
    configuration_options={
      divider=5,
      random_health_value=0,
      random_range=0,
      show_type=0,
      unknwon_prefabs=1,
      use_blacklist=true 
    },
    enabled=true 
  },
  ["workshop-378160973"]={
    configuration_options={
      ENABLEPINGS=true,
      FIREOPTIONS=2,
      OVERRIDEMODE=false,
      SHAREMINIMAPPROGRESS=true,
      SHOWFIREICONS=true,
      SHOWPLAYERICONS=true,
      SHOWPLAYERSOPTIONS=2 
    },
    enabled=true 
  },
  ["workshop-386087632"]={ configuration_options={  }, enabled=true },
  ["workshop-396026892"]={ configuration_options={ OPT_DIFFICULTY=1 }, enabled=true },
  ["workshop-444235588"]={
    configuration_options={
      deluxeEndoFirepitBurnRate=0.75,
      deluxeFirepitBurnRate=0.75,
      dropLoot="yes",
      endoDropLoot="yes",
      heatStarBurnRate=0.9,
      heatStarDropLoot="yes",
      iceStarBurnRate=0.9,
      iceStarDropLoot="yes",
      recipeCost="standard",
      starsSpawnHounds="no" 
    },
    enabled=true 
  },
  ["workshop-458587300"]={ configuration_options={ Ownership=false, Travel_Cost=32 }, enabled=true },
  ["workshop-458940297"]={
    configuration_options={
      DFV_ClientPrediction="default",
      DFV_FueledSettings="default",
      DFV_Language="EN",
      DFV_MinimalMode="default",
      DFV_PercentReplace="default",
      DFV_ShowACondition="default",
      DFV_ShowADefence="default",
      DFV_ShowAType="default",
      DFV_ShowDamage="default",
      DFV_ShowFireTime="default",
      DFV_ShowInsulation="default",
      DFV_ShowTemperature="default",
      DFV_ShowUses="default" 
    },
    enabled=true 
  },
  ["workshop-462372013"]={ configuration_options={  }, enabled=true },
  ["workshop-462434129"]={
    configuration_options={
      MOD_RESTART_ALLOW_KILL=true,
      MOD_RESTART_ALLOW_RESTART=true,
      MOD_RESTART_ALLOW_RESURRECT=true,
      MOD_RESTART_CD_BONUS=0,
      MOD_RESTART_CD_KILL=3,
      MOD_RESTART_CD_MAX=0,
      MOD_RESTART_CD_RESTART=5,
      MOD_RESTART_CD_RESURRECT=7,
      MOD_RESTART_FORCE_DROP_MODE=0,
      MOD_RESTART_IGNORING_ADMIN=true,
      MOD_RESTART_MAP_SAVE=2,
      MOD_RESTART_RESURRECT_HEALTH=0,
      MOD_RESTART_TRIGGER_MODE=1,
      MOD_RESTART_WELCOME_TIPS=true,
      MOD_RESTART_WELCOME_TIPS_TIME=6 
    },
    enabled=true 
  },
  ["workshop-478005098"]={ configuration_options={  }, enabled=true },
  ["workshop-604761020"]={
    configuration_options={
      RUOYINXIAN=false,
      SHENGDANSHI=false,
      baoshibaolv=1,
      blue_baoshi=1,
      er_shuoming=0,
      green_baoshi=1,
      huangjinbaolv=1,
      marble_suipian=1,
      orange_baoshi=1,
      purple_baoshi=1,
      red_baoshi=1,
      shishengzhang=0,
      shitoubaolv=1,
      thulecite_xiukuang=1,
      wajuecishu=2,
      yellow_baoshi=1,
      yi_shuoming=0 
    },
    enabled=true 
  },
  ["workshop-623286817"]={ configuration_options={ NOFERTILIZE=false }, enabled=true },
  ["workshop-661253977"]={
    configuration_options={ amudiao=true, baodiao=1, kong=0, rendiao=2, zbdiao=true },
    enabled=true 
  },
  ["workshop-666155465"]={
    configuration_options={
      food_estimation=-1,
      food_order=0,
      food_style=0,
      lang="auto",
      show_food_units=-1 
    },
    enabled=true 
  },
  ["workshop-670918115"]={ configuration_options={  }, enabled=true },
  ["workshop-785295023"]={
    configuration_options={
      bossres=true,
      companion=true,
      dist=2.5,
      healthmul=-1,
      language="AUTO",
      minimapicon=false,
      ownership=0,
      rebounddmg=0,
      recipe="normal",
      recipe_door=true,
      recipe_fence=true,
      recipe_tool=true,
      recipe_vanilla=false,
      recipe_wall=true 
    },
    enabled=true 
  },
  ["workshop-786556008"]={
    configuration_options={ ENABLEBACKPACK=false, EXTRASLOT=0, INVENTORYSIZE=45 },
    enabled=true 
  },
  ["workshop-831523966"]={ configuration_options={  }, enabled=true },
  ["workshop-856487758"]={ configuration_options={  }, enabled=true },
  ["workshop-922251350"]={ configuration_options={ auto_stack=true, auto_stack_range=10 }, enabled=true } 
}

地下:(如有)

vim  ./.klei/DoNotStarveTogether/Documents/Caves/modoverrides.lua

(因为我没用地下世界,所以,你懂的)

最后重启服务器让他download一下mod就行了

后记:关于游戏更新
游戏每次更新以后会出现搜不到服务器(房间)的情况,此时需要更新steam和游戏本体

启动steam

./steamcmd.sh

匿名登陆并更新游戏

login anonymous
app_update 343050 validate

但是本人更新了以后以然会出现服务器搜索不到的情况
虽然最后解决了但没办法进行完整的归纳
因此建议如果还是出现搜索不到的情况可以:

  1. 检查并建议少量修改&保存你的cluster.ini(比如服务器名字加个字)
cd .klei/DoNotStarveTogether/Documents/
vim cluster.ini
  1. . 清空swap缓存
sync
echo 3 > /proc/sys/vm/drop_caches
  1. 重启你的Linux服务器

如果还出现搜索不到…那么我建议过几天再来…反正我就是第3天做了以上三步后成功搜索到了

-全文完-

  • 10
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值