Ubuntu搭建饥荒服务器
准备工作
本地创建世界
配置好房间名、密码、游戏模式等,这之后将会运行在你的服务器上。
获取token和用户ID
打开游戏左下角的 “账号” 可以获取用户ID,将ID保存在adminlist.txt中。
依次点击上方的游戏、饥荒联机服务器。
将token保存在cluster_token.txt中。
把cluster_token.txt
和adminlist.txt
都放在Cluster_1
中,其中Cluster_1
就是创建的第一个世界,Cluster_2
同理。
动手!
安装环境依赖
sudo apt install libstdc++6:i386 libgcc1:i386 libcurl4-gnutls-dev:i386 lib32gcc1
64位机器先运行
sudo dpkg --add-architecture i386 && sudo apt-get update
安装steamCMD
mkdir ~/steamcmd
cd ~/steamcmd
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xvzf steamcmd_linux.tar.gz
运行steamCMD
./steamcmd.sh
force_install_dir /home/ubuntu/dstserver
login anonymous
app_update 343050 validate
quit
指定安装路径(绝对路径)、匿名登陆、安装饥荒服务器软件、退出(steam更新后似乎要先指定安装路径再匿名登陆)。
启动饥荒服务器
cd ~/dstserver/bin
./dontstarve_dedicated_server_nullrenderer
目的是使其在 ~/.klei/
生成基本配置文件,方便覆盖。
出现有关token错误时,ctrl+c结束。
配置世界
服务器的目录结构和本地(windows)创建的有些许差异。
本地
服务器
只需将数字/Cluster_1
覆盖Cluster_1
。如果已经玩了一会参考遇见的问题
运行服务器
创建 start.sh 如下内容。
#!/bin/sh
cd ~/dstserver/bin
screen -S "Don't Starve Together Server" ./dontstarve_dedicated_server_nullrenderer
chmod +x start.sh
./start.sh
ctrl+a+d
可以后台运行
关于mod
推荐在本地添加好mod(因为mod有许多参数需要配置),之后将本地的数字/Cluster_1/Master/modoverrides.lua拖进服务器。并在 ~/dstserver/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("378160973")--Global Positions
ServerModSetup("362175979")--Wormhole Marks
ServerModSetup("444235588")--Deluxe Campfires 2.11
ServerModSetup("786556008")--45 Inventory Slots
ServerModSetup("375859599")--Health Info
ServerModSetup("458587300")--fast travel
ServerModSetup("666155465")--Show Me
ServerModSetup("50138507")--pick fastly
遇见的问题
饥荒更新后搜索不到房间
在 ~/steamcmd/下创建update.sh
./steamcmd.sh +force_install_dir /home/ubuntu/dstserver +login anonymous +app_update 343050 +quit
注意xx要替换
报错 Directory '/var/run/screen' must have mode 755
sudo chmod 755 /var/run/screen
Screen出现Cannot open your terminal '/dev/pts/0'
script /dev/null
Loading Steam API...Failed to init SDL priority manager: SDL not found
sudo apt install libsdl2-2.0-0:i386
客户端创建了世界(并且玩了一会~)想在服务器运行
主要是一些session
,只需将数字/client_save
里面内容拖进 \Cluster_1\Master\save
,并将 数字\Cluster_1\Master\save
里的session
文件夹合并 \Cluster_1\Master\save
里的session