Back to Blog

How to Make a Don't Starve Together Server on Linux

Don't Starve Together dedicated server on Linux: SteamCMD setup, Klei server token, cluster.ini, Master and Caves shards, ports, mods and backups.

Nodesty Team7 min readGame servers
The words Don't Starve Together with SteamCMD, cluster.ini and Caves on a dark Nodesty background

A Don't Starve Together dedicated server keeps your world running even when nobody is online: you download the free server tool with SteamCMD, get a server token from your Klei account, create a cluster folder with cluster.ini and start two shards, the surface world (Master) and the Caves. Your friends can join whenever they want, and the seasons, bases and boss progress stay exactly where you left them.

This guide covers setting up a Don't Starve Together server on Linux from scratch: the token, the cluster and shard files, ports, mods, console commands, updates and backups.

Requirements

  • Operating system: The dedicated server runs on 64-bit Linux, Windows and macOS. We use Ubuntu and Debian in this guide.
  • RAM: Roughly 1 to 2 GB per shard, depending on mods and players. A world with Master and Caves runs comfortably on 4 GB.
  • CPU: Each shard mostly uses one core, so high single-core speed matters more than the core count.
  • Storage: A few GB is enough for the server files, mods and saves.
  • Klei account: You need a free Klei account to generate the server token.

All you need to know is how to connect to a server over SSH; we give every other command step by step.

Installing SteamCMD and the server files

For security, run the server as a separate user instead of root. The 64-bit server needs the libcurl-gnutls.so.4 library, which comes with the libcurl3-gnutls package:

sudo apt update
sudo apt install lib32gcc-s1 libcurl3-gnutls curl tmux
sudo useradd -m -s /bin/bash dstserver
sudo su - dstserver
mkdir ~/steamcmd && cd ~/steamcmd
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -

The Steam app ID of the Don't Starve Together Dedicated Server is 343050:

~/steamcmd/steamcmd.sh +force_install_dir ~/dst +login anonymous +app_update 343050 validate +quit

On AlmaLinux and other RHEL-based systems, the package names are different and there is no direct libcurl-gnutls package, so Ubuntu or Debian is the easier choice for this server.

Getting a server token from Klei

Without a token, the server doesn't start properly and doesn't appear in the server list. Sign in at accounts.klei.com, open the Games page, go to the Game Servers section of Don't Starve Together and click Add New Server. Copy the token it generates; you'll save it in the cluster folder in the next step. Treat the token like a password and never share it publicly.

Creating the cluster folder

The server keeps every world, which Klei calls a cluster, in ~/.klei/DoNotStarveTogether. Create a cluster named MyDediServer with a folder for each shard:

mkdir -p ~/.klei/DoNotStarveTogether/MyDediServer/{Master,Caves}
cd ~/.klei/DoNotStarveTogether/MyDediServer
nano cluster_token.txt

Paste the token into cluster_token.txt as a single line and save. Then create cluster.ini with nano cluster.ini:

[GAMEPLAY]
game_mode = survival
max_players = 6
pvp = false
pause_when_empty = true

[NETWORK]
cluster_name = Your server name
cluster_description = A friendly survival world
cluster_password = secret123
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 = a-long-random-secret
  • game_mode: survival is the classic mode; endless and wilderness are the other options.
  • pause_when_empty: Stops the world from running while nobody is online.
  • cluster_password: Leave it empty for an open server.
  • [SHARD]: Lets Master and Caves talk to each other. Since both run on the same machine, 127.0.0.1 keeps this connection off the internet; cluster_key is a shared secret between the shards.

To become an admin, write your Klei User ID (it starts with KU_ and is shown on your Klei account page) on its own line in an adminlist.txt file in the same folder.

Master and Caves shard settings

Each shard has its own server.ini. Create Master/server.ini:

[NETWORK]
server_port = 11000

[SHARD]
is_master = true

[STEAM]
master_server_port = 27018
authentication_port = 8768

And Caves/server.ini:

[NETWORK]
server_port = 11001

[SHARD]
is_master = false
name = Caves

[STEAM]
master_server_port = 27019
authentication_port = 8769

Every port must be different for each shard. Finally, tell the Caves shard to generate a cave world instead of a surface world with Caves/worldgenoverride.lua:

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

Tip: On the Klei account page, the server you created also has a configure option that downloads a ready-made cluster folder with the same files; you can upload it to the server and only adjust the settings.

Starting the server

The server must be started from the bin64 folder. Start each shard in its own tmux session so the server keeps running when you close your SSH connection:

cd ~/dst/bin64
tmux new -d -s dst-master ./dontstarve_dedicated_server_nullrenderer_x64 -console -cluster MyDediServer -shard Master
tmux new -d -s dst-caves ./dontstarve_dedicated_server_nullrenderer_x64 -console -cluster MyDediServer -shard Caves

On the first start, both shards generate their worlds, which takes a minute or two. Watch the console with tmux attach -t dst-master, and leave it with Ctrl + B and then D. If you'd rather have the shards start automatically after a reboot, you can run the same two commands as two systemd services.

Ports and firewall

Players connect to the Master shard on UDP 11000 and are moved to UDP 11001 when they go down into the caves. Port 10888 for the shard connection stays on 127.0.0.1 and doesn't need to be opened. If you use ufw:

sudo ufw allow 11000:11001/udp

We explain ufw in detail in our How to use UFW guide.

Connecting to the server

In the game, click Browse Games and search for your cluster_name. If the server doesn't appear in the list, open the console in the game with the ~ key and connect directly:

c_connect("203.0.113.10", 11000, "secret123")

Adding mods

Mods are set up in two places. First, add the Workshop ID of each mod (the number in the address of its Steam Workshop page) to ~/dst/mods/dedicated_server_mods_setup.lua, so the server downloads it at startup:

ServerModSetup("123456789")

Then enable the mod in a modoverrides.lua file in both the Master and Caves folders:

return {
    ["workshop-123456789"] = { enabled = true },
}

Restart both shards after adding mods. A SteamCMD update can reset dedicated_server_mods_setup.lua, so keep a copy of it.

Console commands

Type these into a shard's tmux console, or into the in-game console as an admin:

CommandWhat it does
c_save()Saves the world
c_shutdown(true)Saves and shuts down the shard
c_announce("message")Sends a message to all players
c_listallplayers()Lists the connected players
c_rollback(1)Rolls the world back to the previous save
c_regenerateworld()Deletes the world and generates a new one

c_regenerateworld() cannot be undone; take a backup before using it.

Updates and backups

  • Updating: When the game updates, players can't join a server on an older version. Shut down both shards with c_shutdown(true), run the SteamCMD command again and start the shards.
  • Backups: The worlds, settings and token are all in the cluster folder. Make a copy of it before updates and big changes:
    tar -czf ~/dst-backup-$(date +%F).tar.gz -C ~/.klei/DoNotStarveTogether MyDediServer
    

    We cover taking regular backups that are independent of the server in our Server backups guide.

Nodesty for your Don't Starve Together server

A Don't Starve Together world with Caves and mods needs two shards running side by side around the clock, which a home computer rarely does well. Nodesty AMD Ryzen 9 9950X VPS plans deliver smooth gameplay with single-core speeds up to 5.7 GHz, and run in Frankfurt and New York with NVMe storage, L3–L7 nShield DDoS protection and free daily backups kept for 7 days. For other games, take a look at our Valheim, Terraria and Project Zomboid guides; if you're not sure which type of plan suits you, read our Game server plan or VPS? article.

Don't Starve Together is a trademark of Klei Entertainment Inc.; Steam is a trademark of Valve Corporation. Nodesty is not affiliated with or endorsed by these companies.

Frequently Asked Questions

Does it cost anything to make a Don't Starve Together server?

No. The Don't Starve Together Dedicated Server tool is free and downloads anonymously with SteamCMD, and the server token from your Klei account is free too. You only pay for the machine that keeps the server online 24/7. Players just need to own the game.

How much RAM does a Don't Starve Together server need?

Don't Starve Together is a light game server. Plan for roughly 1 to 2 GB of RAM per shard, so a world with Master and Caves runs comfortably on 4 GB. Many mods and more players raise this. High single-core CPU speed matters more than the number of cores.

Why doesn't my server appear in the server list?

The most common causes are a missing or wrong token in cluster_token.txt, closed UDP ports 11000 and 11001, and a server that is older than the game. Check the server console for token errors, open the ports and run the SteamCMD update command again after every game update.

Do I have to run the Caves shard?

No. Caves are optional. If you only want the surface world, set shard_enabled to false in cluster.ini and start only the Master shard. You can add Caves later, but the cave entrances only work when both shards run together.

How do I make myself an admin on the server?

Find your Klei User ID, which starts with KU_, on your Klei account page and write it on its own line in adminlist.txt in the cluster folder. After a restart, you can use the console commands in the game while connected to the server.

My mods don't load after an update. Why?

Updating the server with SteamCMD can reset the dedicated_server_mods_setup.lua file in the mods folder. Keep a copy of this file and put it back after each update. Also check that every mod is enabled in the modoverrides.lua file of both shards.

Nodesty

About the author

Nodesty Team · Infrastructure & Support

The Nodesty team runs our servers, network and DDoS protection day to day and answers customer support requests around the clock. These guides come from that work.

Related articles

Launch your server now.

Build, scale, and conquer without limits on Nodesty's premium infrastructure.

                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                             ············································                                                   
                                                ··································································································..........···························                                     
                                       ················..........................................................................................................................··············                             
                                  ·············.................::::::::::::::::::::::::::::::::::::::::::::::....................:::::::::::::::::::::::::::::::::::::::................···········                        
                             ············................:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::............·········                     
                         ············.................:::::::::::::::::::::::::::::::::::::::::::::::::::------------::::::::::::::::::::::::::::::----------------:::::::::::::::::::::..........········                  
                    ············......................::::::::::::::::::::::::::::::::::::------------------------------------------------------------------------------------:::::::::::::.........········                
                ··········.............................................::::::::::::::::::-------------==========================================-----------------------------------:::::::::::........·······               
             ········..................:.....................................::::::::::--------=======+++++++++++++++++++++++++++++++++++++=========================------------------::::::::::.......·······              
           ······.........::::::::::::::::::::................................:::::::-----=====++++xxxxxx**************************xxxxxxxxx++++++++++++++===================------------::::::::.......·······             
          ·····.......:::::::::::::::::::::::::::.............................:::::----===+++xxx****%%%%&&&&&&#############&&&&&&&%%%%%*******xxxxxxxx++++++++++++++==============----------:::::::......······             
         ····......::::::::-------------:::::::::::..........................::::---===+++xx***%%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@####&&&&&%%%%*******xxxxxxxxx+++++++++++++===========--------::::::......·····             
        ····.....:::::::--------------------:::::::::.......................::::---===++xxx**%%&&&###@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&%%%%%********xxxxxxxxxxx++++++++++++========------::::::.....······            
        ····.....:::::--------------------------::::::::....................::::---===++xx***%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&&%%%%%**********xxxxxxxxxxxxx+++++++++=======------:::::.....·····            
        ····....::::::-------=============---------:::::::::................:::::---===+++xx***%%%&&&#####@@@@@@@@@@@@@@@@@@@@@@@@@#####&&&&&%%%%%%*************xxxxxxxxxxxxxx+++++++++======-----:::::....·····            
         ····....:::::-------================---------:::::::::...............:::::----===++++xxx***%%%%&&&&&&#################&&&&&&%%%%%%%*******************xxxxxxxxxxxxxxxxx++++++++======----:::::....·····            
         ·····....:::::--------=================---------::::::::::..............:::::::-----====+++++xxxxxx**************************xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx++++++++=====-----::::....·····            
          ·····.....:::::--------=================----------:::::::::::.................:::::::::-------=============++++++++++++++++++++++++++++++++++++xxxxxxxxxxxxxxxxxxxxxxx++++++++======-----::::....·····            
            ·····.....:::::::----------===========-------------::::::::::::.........................::::::::::::::::::------------------=============+++++++++++++++++++++++++++++++++=======-----::::.....·····            
              ······......:::::::---------------------------------:::::::::::::........................................:::::::::::::::-----------============+++++++++++++++++++++========------:::::.....·····             
                 ······........:::::::::---------------------------:::::::::::::::::...........................................:::::::::::::------------=============================--------::::::.....······              
                    ·········.........:::::::::::::::-------------::::::::::::::::::::::::.......................................::::::::::::::::--------------------------------------::::::::......·······                
                          ··········............::::::::::::::::::::::::::::::::::::::::::::::::::................................::::::::::::::::::::::::::-------------:::::::::::::::.........········                   
                                  ············..................:::::::::::::::::::::::::::::::::::::::::::.........................:::::::::::::::::::::::::::::::::::::................···········                        
                                             ················.............................................................................................................·················                                 
                                                           ······················................................................................···························                                                
                                                                               ·········································································