Setting up Don't Starve Together Dedicated Server on Debian 13
Don't Starve Together is a fun co-op survival game that my friends and I have been playing for the past year or so. It's become an almost-weekly ritual and we still have yet to explore its entire world. Normally one of us would set up a local server through the game itself and we'd all join. That has caused issues with us having to recreate a new world - and lose progress - when someone doesn't show up. So, just as I did with Counter Strike 1.6, it's time to set up a proper server. I've looked at existing guides, but almost all make the process uncessarily complicated and opaque and don't help understanding of the process at all.
I'll be doing this on Debian 13 Trixie. Debian has become my linux distribution of choice for both desktop and server purposes although I still prefer {Free,Open}BSD for server operations. Some things are just not available there though.
Getting things ready
This part is mainly taken from Klei's
quick setup support page. To install
steam, we need i386 architecture and
steamcmd. First, enable non-free repository
by editing /etc/apt/sources.list and adding
non-free to end of deb lines. then
dpkg --add-architecture i386
apt update
apt install steamcmdThen run steamcmd and you'll be greeted with a
Steam> prompt. install Don't
Starve Together Dedicated Server. I was happy to see that I don't
need a login to install the dedicated server as it accepts anonymous
login. I'll be installing it under $HOME/dst_server.
Steam> force_install_dir /home/armin/dst_server
Steam> login anonymous
Steam> app_update 343050 validateNext, we need the server configuration and server token to be allowed to host a server. You'd login to Klei Accounts website, and under the Games tabs, you'll see Don't Starve Together Game Server. Choose a name, click Add New Server, then configure your server as you wish.
Put contents of the directory MyDediServer under ~/.klei/DoNotStarveTogether/<cluster name>.
You can see what some of the configuration options under
cluster.ini and other files mean by looking at the Dedicated
Server Command Line Options Guide. Look through the files and see
if you want to change anything.
Now you can run the server. -cluster refers to
cluster_name under cluster.ini (the name you
chose when making the config). Make sure to run the binary when your
current working directory is dst_server/bin64 (or the
equivalent for you). The server binary expects a ../data/
directory to be present, otherwise it'll fail to find
scripts/main.lua file and nosedives.
cd /home/armin/dst_server/bin64
./dontstarve_dedicated_server_nullrenderer_x64 -cluster "Cluster name" -shard Master &
./dontstarve_dedicated_server_nullrenderer_x64 -cluster "Cluster name" -shard CavesOh, and it needs libcurl4-gnutls-dev.
apt install libcurl4-gnutls-devYou can review cluster.ini possible
settings as well. I tried a tick_rate of 30, but the
graphics got choppy.
Setting up in-game lists
To set up a block, admin, and white list, you need these files
under ~/.klei/DoNotStarveTogether/<cluster name>/
adminlist.txt
whitelist.txt
blocklist.txtWith the file contents being a list of Klei user IDs, one per line.
You can find your user ID in your Klei Accounts page.
I've added myself to adminlist.txt.
World Settings
You can modify either overworld or cave's
worldgenoverride.lua to modify world generation. There is
a list
of descriptions to read about what the options do. I was
frustrated by a lack of reliable way to figure out what overrides are
available, so a search was in order.
grep -iR wildfire dst_serverAnd I found the most reliable source for this information:
dst_server/data/databundles/scripts.zip.
unzip scripts.zip
find scripts -iname '*override*'yields scripts/worldsettings_overrides.lua. In it, we
can see each setting and its available options and what actually
happens with each setting. At the end of the day, though, I just need
to disable wildfires because I find them annoying. I also like hunts.
So, I'll add this to my Master/worldgenoverride.lua.
return {
override_enabled = true,
worldgen_preset = "SURVIVAL_TOGETHER",
settings_preset = "SURVIVAL_TOGETHER",
overrides = {
wildfires = "never",
hunt = "often"
},
}Mods
Under dst_server, there is a
mods/dedicated_server_mods_setup.lua file which needs to
be updated. The file explains its format well, it's just consecutive
function calls. You can find the mod ID by visiting the workshop page
of the mod in steam and looking at the URL, e.g.
steamcommunity.com/sharedfiles/filedetails/?id=xxxxxxx.
ServerModSetup("2078243581") -- Display Attack Range by ClumsyNoob
ServerModSetup("2902364746") -- Global Positions Remapped by Niko
ServerModSetup("2189004162") -- Insight (Show Me+) by penguin0616
ServerModSetup("1207269058") -- Simple Health Bar DST by DYC
ServerModSetup("362175979") -- Wormhole Marks [DST] by _Q_I ran the dedicated server again and the mods were downloaded under
dst_server/ugc_mods/<cluster name>/<shard>/.
To see what options each mod has, you're looking for
configuration_options dictionary in
modinfo.lua in each mod. To override each, you'd add the
corresponding mod ID and option overrides to
~.klei/DoNotStarveTogether/<cluster
name>/<shard>/modoverrides.lua
return {
-- Global Positions
["2902364746"] = {
enabled = true,
--configuration_options = {
-- ["OPTIONNAME"] = OPTIONVALUE
--}
},
-- Insight
["2189004162"] = { enabled = true },
-- Simple Health Bar
["1207269058"] = { enabled = true },
-- Display Attack Range
["2078243581"] = { enabled = true },
-- Wormhole marks
["362175979"] = { enabled = true }
}Mods are working as intended.
Process supervision
Debian 13 Trixie runs systemd, so here's a systemd
unit file to start the Master and Cave worlds.
/etc/systemd/user/dst-master.service
[Unit]
Description=Don't Starve Together Dedicated Server - Master
After=network.target
[Service]
Type=simple
User=armin
WorkingDirectory=/home/armin/dst_server/bin64
ExecStart=/home/armin/dst_server/bin64/dontstarve_dedicated_server_nullrenderer_x64 -cluster "Mohem Nist" -shard Master
Restart=no
[Install]
WantedBy=default.target/etc/systemd/user/dst-cave.service
[Unit]
Description=Don't Starve Together Dedicated Server - Master
After=network.target dst-master.service
Requires=dst-master.service
[Service]
Type=simple
User=armin
WorkingDirectory=/home/armin/dst_server/bin64
ExecStart=/home/armin/dst_server/bin64/dontstarve_dedicated_server_nullrenderer_x64 -cluster "Mohem Nist" -shard Cave
Restart=no
[Install]
WantedBy=default.targetThen enable and start the master and cave services.
Converting local saves to dedicated server
If you have a world you want to continue as a dedicated server,
start your Don't Starve Together games, go to "Host game", click on
the wrench on the right side of the world you want to use and, if
necessary, "Convert to Local Save". Note the file path of the save,
for me, it says "SAVEDATA:/Cluster1" or something similar.
Now I find "Cluster1" is under
$HOME/.klei/DoNotStarveTogether/<steam id>/Cluster_1.
Transfer the entire cluster directory to your dedicated server
host, under $HOME/.klei/DoNotStarveTogether/. If your
server uses mods, you'll need to copy those as well. On Debian, my
mods are under
$HOME/.steam/debian-installation/steamapps/common/Don't Starve Together/mods.
Make sure you copy the mod directories under ugc_mods/ as
well (see above). I opted to reinstall the mods (see above) and copy
the configuration options from my local
modoverrides.lua.
Make sure to generate a new cluster token from your Klei Accounts
page for the new server and review cluster.ini to make
sure it matches your requirements.