01
Before you start
Klei Entertainment provides the Don't Starve Together dedicated server for Windows and Linux. A few notions before installing anything:
- The cluster: this is the folder that describes your server. It holds
cluster.ini (name, password, player count), the cluster_token.txt token, and one subfolder per world, called a "shard": Master for the surface, Caves for the caves, each with its own server.ini.
- Two processes: the surface and the caves are two programs that run at the same time and talk to each other. A server without caves only runs one.
- The Klei account: the token proves that you own the game. You therefore need a Klei account linked to a copy of Don't Starve Together. Klei states that dedicated servers are not supported for the Xbox and PlayStation versions of the game.
- System: a recent 64-bit Linux VPS (Debian 12, Ubuntu 22.04 or 24.04) with a
sudo user. Klei's official guide uses the 32-bit server program: a few 32-bit libraries have to be added.
- Memory: Klei publishes no figure. Account for both processes, and more with mods; keep an eye on usage during the first days with the guide monitoring a VPS's resources.
Do the basic security settings first (SSH key, firewall, updates) with the guide securing a Linux VPS. To choose the VPS size, see which VPS for a game server.
02
Get the token and the cluster folder
The official method goes through the Klei accounts site, which prepares the complete folder:
- log in to the Klei accounts site with the account that owns the game;
- in the GAMES tab, scroll down to Don't Starve Together and click Game Servers;
- click ADD NEW SERVER (or CONFIGURE for an existing server; those shown in red have expired and should be deleted);
- fill in the form, then click Download Settings.
You get a Zip archive containing a MyDediServer folder, with cluster.ini, cluster_token.txt and the Master and Caves folders. You will put it on the VPS in the next step.
The game's wiki also describes another way to generate the token alone: in the game, open the console with the ~ key and type TheNet:GenerateClusterToken(). The cluster_token.txt file is created in the game's data folder and must be copied into the cluster folder. The token is personal: do not publish it.
03
Install SteamCMD and the server
Create a dedicated user, add the 32-bit architecture and install the libraries Klei's guide requires, plus the one SteamCMD needs and the screen tool:
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y lib32gcc-s1 libstdc++6:i386 libcurl4-gnutls-dev:i386 screen unzip wget
sudo useradd -m -s /bin/bash dst
sudo -iu dst
mkdir -p ~/steamcmd && cd ~/steamcmd
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xvzf steamcmd_linux.tar.gz
Klei's guide names libgcc1:i386: on recent Debian and Ubuntu releases that package was renamed, and libstdc++6:i386 installs its replacement anyway.
Then send Klei's archive to the VPS (with scp or over SFTP, see connecting to a VPS over SSH) and extract it in the right place (replace MyDediServer.zip with the name of your archive):
mkdir -p ~/.klei/DoNotStarveTogether
unzip ~/MyDediServer.zip -d ~/.klei/DoNotStarveTogether/
ls ~/.klei/DoNotStarveTogether/MyDediServer
Finally, create the launch script ~/run_dedicated_servers.sh. It is the one Klei provides, with one difference: the word validate is removed from the SteamCMD line, because it would reset the mods file to its original content on every launch.
#!/bin/bash
steamcmd_dir="$HOME/steamcmd"
install_dir="$HOME/dontstarvetogether_dedicated_server"
cluster_name="MyDediServer"
dontstarve_dir="$HOME/.klei/DoNotStarveTogether"
function fail()
{
echo Error: "$@" >&2
exit 1
}
function check_for_file()
{
if [ ! -e "$1" ]; then
fail "Missing file: $1"
fi
}
cd "$steamcmd_dir" || fail "Missing $steamcmd_dir directory!"
check_for_file "steamcmd.sh"
check_for_file "$dontstarve_dir/$cluster_name/cluster.ini"
check_for_file "$dontstarve_dir/$cluster_name/cluster_token.txt"
check_for_file "$dontstarve_dir/$cluster_name/Master/server.ini"
check_for_file "$dontstarve_dir/$cluster_name/Caves/server.ini"
./steamcmd.sh +force_install_dir "$install_dir" +login anonymous +app_update 343050 +quit
check_for_file "$install_dir/bin"
cd "$install_dir/bin" || fail
run_shared=(./dontstarve_dedicated_server_nullrenderer)
run_shared+=(-console)
run_shared+=(-cluster "$cluster_name")
run_shared+=(-monitor_parent_process $$)
"${run_shared[@]}" -shard Caves | sed 's/^/Caves: /' &
"${run_shared[@]}" -shard Master | sed 's/^/Master: /'
chmod u+x ~/run_dedicated_servers.sh
The script downloads or updates the server (ID 343050, anonymous login) into ~/dontstarvetogether_dedicated_server, then starts the caves in the background and the surface in the foreground. Every start therefore applies game updates.
04
Set up cluster.ini, server.ini and the ports
The cluster.ini file provided by Klei reflects your form. The lines to know, according to Klei's settings guide:
[GAMEPLAY]
game_mode = survival
max_players = 6
pvp = false
pause_when_empty = true
[NETWORK]
cluster_name = Mon serveur DST FR
cluster_description = Survie en coopération
cluster_password =
cluster_intention = cooperative
[MISC]
console_enabled = true
[SHARD]
shard_enabled = true
bind_ip = 127.0.0.1
master_ip = 127.0.0.1
master_port = 10888
cluster_key = une-cle-longue-et-secrete
max_players: 16 by default. pause_when_empty pauses the world when nobody is connected.
game_mode: survival, endless or wilderness. cluster_intention: cooperative, competitive, social or madness.
cluster_password: when empty, the server is open to everyone.
- The
[SHARD] section: shard_enabled = true is required to have both surface and caves. Since both processes run on the same VPS, bind_ip and master_ip are 127.0.0.1: the master_port port (10888 by default) stays internal and does not need to be opened. cluster_key is the password between the two processes.
Each world folder has its own server.ini. The surface one contains is_master = true, the caves one is_master = false and name = Caves. Above all, check their ports:
grep -H "_port" ~/.klei/DoNotStarveTogether/MyDediServer/*/server.ini
server_port ([NETWORK] section): the UDP port players connect to, 10999 by default. It must be different for the surface and for the caves. Klei advises a value between 10998 and 11018 so that the server also shows up on a local network.
authentication_port and master_server_port ([STEAM] section, 8766 and 27016 by default): internal Steam ports, which must also differ from one process to the other.
Open the two server_port values read above in the firewall, as UDP. With 10999 for the surface and 11000 for the caves:
sudo ufw allow OpenSSH
sudo ufw allow 10999/udp
sudo ufw allow 11000/udp
sudo ufw enable
Start the server. In a screen session, so that it keeps running after the SSH session ends:
sudo -iu dst
screen -S dst ~/run_dedicated_servers.sh
Detach with Ctrl+A then D, come back with screen -r dst. The console takes the surface's commands: c_save() saves the game, c_shutdown() stops the server. To start automatically when the VPS boots, add @reboot screen -dmS dst /home/dst/run_dedicated_servers.sh to the dst user's crontab (see scheduled tasks on a VPS). The logic behind ports is explained in game server ports.
05
Mods, administrators and backups
Mods are declared in two places. First, to download them, in ~/dontstarvetogether_dedicated_server/mods/dedicated_server_mods_setup.lua, with each mod's number (the number after ?id= in its Workshop page address):
ServerModSetup("378160973")
ServerModSetup("375859599")
Then, to enable them, in a modoverrides.lua file placed in each of the Master and Caves folders:
return {
["workshop-378160973"] = { enabled = true },
["workshop-375859599"] = { enabled = true }
}
No comma after the last line of the block. A mod's own settings go in configuration_options; their names are in the mod's modinfo.lua file. Restart the server: it downloads the mods at startup.
Administrators. The account that created the token is an administrator automatically. To add others, create adminlist.txt in the cluster folder (next to cluster.ini), with one Klei ID per line, in the form KU_ followed by characters; each player finds theirs in the game's menu. The whitelist.txt file, in the same place, reserves slots for the listed players (whitelist_slots setting).
Backups. The world saves itself at the start of each in-game day (autosaver_enabled), and the server keeps several snapshots (max_snapshots, 6 by default) to roll back. For a copy off the server, first save and stop with c_save() then c_shutdown(), then archive the whole cluster folder:
tar czf ~/dst-$(date +%F).tar.gz -C ~/.klei/DoNotStarveTogether MyDediServer
Copy the archive off the VPS. It contains the token: keep it somewhere safe.
06
On CloudFive
CloudFive has no ready-made Don't Starve Together plan: the server is installed on a VPS, as in this guide. The Ryzen VPS, from €5.99 per month, is well suited:
- an AMD Ryzen 9 9950X, with DDR5 memory and NVMe storage, to run the surface and the caves side by side;
- root access and a dedicated IPv4 address;
- basic anti-DDoS protection included. The game-specific filter is part of Premium Protection, a paid option (see protecting a game server from DDoS).
The servers are in France, on our own AS218808 network, monthly with no commitment, with support in French 7 days a week (tickets, Discord, phone). The VPS's gaming uses are summed up on the gaming VPS page; for other co-op games on the same VPS, see hosting several game servers and, for example, creating a Core Keeper server.
07
Frequently asked questions
How do I create a Don't Starve Together dedicated server on Linux?
Download the cluster folder from the Game Servers page of your Klei account, put it in ~/.klei/DoNotStarveTogether, install SteamCMD and run Klei's script, which downloads server 343050 and starts the surface and the caves. Then open each world's server_port as UDP.
Where do I get the Don't Starve Together cluster_token.txt?
On the Klei accounts site: GAMES tab, Don't Starve Together, Game Servers, then Download Settings; the archive contains the token. The game's wiki also describes the TheNet:GenerateClusterToken() command in the game console. The file goes in the cluster folder, next to cluster.ini.
Which ports should I open for a Don't Starve Together server?
Each world's server_port, as UDP: 10999 by default for a single world, and a different port for the caves, for example 11000. The master_port (10888) is used between the two processes on the same VPS and does not need to be opened.
How do I add mods to a Don't Starve Together server?
Add a ServerModSetup line with the mod's Workshop number to mods/dedicated_server_mods_setup.lua, then enable it in the modoverrides.lua file of the Master and Caves folders. Remove validate from the script's SteamCMD command, otherwise the mods file is reset on every launch.
How do I become an administrator of a Don't Starve Together server?
The Klei account that created the token is an administrator automatically. For other players, write their Klei IDs (KU_ followed by characters), one per line, in adminlist.txt in the cluster folder, then restart the server.