Why a world needs a home of its own
When one of you hosts from the game, the world lives on that person's computer: it stops when they quit, and their PC carries the load while they play. A dedicated server moves the world onto a machine that does nothing else. Players come and go; the camp, the base and the season carry on.
Klei builds Don’t Starve Together worlds as a cluster. The surface and the caves are separate worlds Klei calls shards, and each one is its own running program. The surface shard is the master: it is the one that holds the shared settings, and the caves shard checks in with it. If you skip the caves you run one program; most groups want both.
How much machine does it need?
Klei does not publish a CPU or memory requirement for the dedicated server in its setup guides, so there is no official number to quote. What you can count on is that a world with caves is two programs running at the same time on one machine, and that Klei's Linux instructions target Ubuntu on x86.
A few defaults from Klei's settings guide shape the load. max_players is 16 unless you change it. tick_rate, how many updates a second the server sends to each player, is 15, and Klei recommends leaving it there except on a LAN. Our suggestion: start on a modest machine, play a full evening with everyone on, and watch the processor. If one of the two programs sits at a full core, step up.
Your cluster token is a key, so keep it private
The cluster token is the file that tells Klei the server is yours, and the server will not start without it. You get it by signing in to your Klei account, opening the Games tab, finding Don’t Starve Together and choosing Game Servers. Add a new server there, adjust the form, and press Download Settings. The zip you get contains a MyDediServer folder with cluster_token.txt and the starting config files.
- Protecting the token isn't something Klei's guides cover, so this list is our own advice. Only the account that runs the game should read it:
chmod 600 cluster_token.txtinside the cluster folder, andchmod 700 ~/.klei. - If you back up your settings to GitHub or a shared drive, leave the token out. Add
cluster_token.txtto.gitignorebefore your first commit. - Our own advice if the token ever lands somewhere public: create a fresh server entry on Klei's Game Servers page, switch to the token it gives you, and remove the old entry. Klei shows expired entries in red and asks you to remove them.
- The
cluster_keyline incluster.iniis the password the caves use to join the surface. Treat it the same way.
Up and running in an evening
These steps follow Klei's Linux quick-setup guide and Valve's SteamCMD instructions, on a fresh 64-bit Ubuntu or Debian install. Valve asks you not to run SteamCMD as root, so the server gets its own steam account.
- As root, install the 32-bit libraries and create the account:
dpkg --add-architecture i386 && apt-get update, thenapt-get install -y lib32gcc-s1 libstdc++6:i386 libcurl4-gnutls-dev:i386, thenuseradd -m steam. Klei's list sayslibgcc1:i386, which no longer exists on current Ubuntu and Debian; its 32-bit replacement,libgcc-s1:i386, comes in withlibstdc++6:i386, andlib32gcc-s1is the package Valve's SteamCMD instructions name. - Then switch to the new account with
su - steam(orsudo -iu steamif you use sudo rather than a root login) and run the rest as that user: install SteamCMD and download the server files (first block below). - Copy the
MyDediServerfolder from Klei's zip to/home/steam/.klei/DoNotStarveTogether/, owned bysteam. Lock down the token as described above. - Open
cluster.iniand set the world's name, a password and the player limit. - Save the launch script (second block) as
/home/steam/start-dst.shand make it executable withchmod u+x. - Start it once yourself as the steam user. When both worlds say they are ready, join from the game's server browser.
# as the steam user: Valve's manual SteamCMD install, then the server files
mkdir -p ~/steamcmd && cd ~/steamcmd
curl -sqL "https://client-update.steamstatic.com/installer/steamcmd_linux.tar.gz" | tar zxvf -
./steamcmd.sh +force_install_dir /home/steam/dstserver +login anonymous \
+app_update 343050 validate +quit
#!/bin/bash
# /home/steam/start-dst.sh - update, then launch both worlds
/home/steam/steamcmd/steamcmd.sh +force_install_dir /home/steam/dstserver \
+login anonymous +app_update 343050 +quit
cd /home/steam/dstserver/bin64 || exit 1
./dontstarve_dedicated_server_nullrenderer_x64 -console -cluster MyDediServer \
-monitor_parent_process $$ -shard Caves &
exec ./dontstarve_dedicated_server_nullrenderer_x64 -console -cluster MyDediServer \
-monitor_parent_process $$ -shard Master
Klei's i386 package list dates from the first, 32-bit program in bin. The start script Klei's guide links to now launches the 64-bit build from bin64 (dontstarve_dedicated_server_nullrenderer_x64), and so does the script above. If it complains about a missing .so file at start, run ldd on the program to see which system library is missing. That tip is ours rather than Klei's.
Letting your friends in
Players reach each world on that world's server_port, a UDP port set in its own server.ini. Klei's default is 10999, and two worlds on one machine must each have a different one, so the surface and the caves need two ports open in your firewall.
- The surface and caves talk to each other over
master_port, 10888 by default. With both on one machine, Klei says to keepbind_ipand the caves'master_ipat 127.0.0.1, so this traffic never leaves the server and needs no firewall opening. - Two more ports per world,
authentication_port(8766) andmaster_server_port(27016), are internal ports Steam uses. Klei only asks that each world on the machine uses different numbers. - Want the server to show up for players on the same local network? Klei says its
server_porthas to be between 10998 and 11018. - Klei says the Xbox and PlayStation editions of the game can't use dedicated servers, so this world is for PC players.
Mods that stay put
Mods for a server are listed in dedicated_server_mods_setup.lua in the server's mods folder. The trap is SteamCMD's validate option: Valve's documentation warns that validation replaces modified files with the originals, and suggests keeping it for the initial install and for times the server has problems.
That is why the launch script above updates the game without validate. Your mod list survives a normal update, and new game builds still arrive. Keep a copy of the file outside the install folder in case a build replaces it, and keep validate for the day something is genuinely corrupted.
Keeping the world safe while you sleep
Turn the launch script into a system service so the world comes back by itself after a reboot or a crash. Save this as /etc/systemd/system/dst.service, then run systemctl enable --now dst after a systemctl daemon-reload.
[Unit]
Description=Don't Starve Together world
After=network-online.target
[Service]
User=steam
ExecStart=/home/steam/start-dst.sh
Restart=always
[Install]
WantedBy=multi-user.target
The game saves when each in-game day ends, and by default the last six saves are kept as rollback points (max_snapshots). That protects you from a bad night, not from a lost disk, so copy the whole MyDediServer folder to somewhere else on a schedule. Stop the service first so the copy is consistent, and every restart pulls the latest game build before the worlds start.
The server that fits
Our game servers are whole bare metal machines on HPE enterprise hardware: nobody else shares the box or its port at the access switch. The hardware and the OS are your choice, and a machine that is already racked is ready in about 30 minutes once the order is approved; payment checks can add to that. Pick a city close to your group: Amsterdam or Bucharest in Europe, or New York, Miami or San Francisco in the US. See our locations.
Traffic is never counted on the port, there is no contract, and support answers by live chat, email and phone around the clock. On the rack servers and blades a remote console lets you fix a firewall mistake without waiting for anyone. Any x86 machine in the dedicated range runs Klei's Linux build; the Linux servers page lists the distributions we install.
Questions people ask
- Do I have to buy anything from Klei to host it?
- The server files download through SteamCMD with an anonymous login, the way Klei's guide does it. You do need a free Klei account to create the cluster token on the Game Servers page.
- My friends can see the surface but get bounced back from the caves. What is wrong?
- A likely cause is that the caves world's port is not reachable. Every world listens on a separate
server_port, so open both over UDP, and check that the two numbers in theserver.inifiles really differ. - Can I run the surface without caves?
- Yes. Klei's settings guide says sharding only has to be switched on for a world with more than one level. Run only the Master shard and leave
shard_enabledoff. - How do I add a password or limit who can join?
- Set
cluster_passwordincluster.inifor a simple password. Klei also supports reserved whitelist slots throughwhitelist_slotsand awhitelist.txtof Klei user IDs, and limiting the server to a Steam group withsteam_group_onlyandsteam_group_id. - Will my world survive moving to a new server later?
- The world lives in the cluster folder under
~/.klei/DoNotStarveTogether. Stop the service, copy that folder across with its token, install the server files on the new machine, and start it there.