Skip to content

Instantly share code, notes, and snippets.

@thelegendofbrian
Last active December 31, 2023 06:18
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save thelegendofbrian/442e266f6b7fe2702ee199dca4ce2a61 to your computer and use it in GitHub Desktop.
Save thelegendofbrian/442e266f6b7fe2702ee199dca4ce2a61 to your computer and use it in GitHub Desktop.
Install LinuxGSM DST Server with Caves

Ports used

Some of the exact port numbers seem to be different between installations. I'm not sure if any have to be as listed, but those were a working number I used at some point

Port Description Place Defined Open Port Unique
11000 Overworld server port Master/server.ini x x
11001 Cave server port Caves/server.ini x x
8768 Steam auth port for overworld Master/server.ini
8769 Steam auth port for cave Caves/server.ini
27018 Steam master server port for overworld Master/server.ini x
27019 Steam master server port for cave Caves/server.ini x
10888 Shard master port cluster.ini x

As sudoer

sudo su - dstserver

As dstserver user

wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh

./linuxgsm.sh dstserver
./linuxgsm.sh dstserver

mkdir -p ~/lgsm/config-lgsm/dstserver/

Set LinuxGSM installation variables

echo '# Installation Variables
sharding="true"
master="true"
shard="Master" 
cluster="Cluster_1"
cave="false"' >> ~/lgsm/config-lgsm/dstserver/dstserver.cfg

echo '# Installation Variables
sharding="true"
master="false"
shard="Caves" 
cluster="Cluster_1"
cave="true"' >> ~/lgsm/config-lgsm/dstserver/dstserver-2.cfg

Set cluster token

mkdir -p ~/.klei/DoNotStarveTogether/Cluster_1/
echo 'INSERT_CLUSTER_TOKEN' > ~/.klei/DoNotStarveTogether/Cluster_1/cluster_token.txt

Install servers

./dstserver install
./dstserver-2 install

Configure DST

mkdir -p ~/.klei/DoNotStarveTogether/Cluster_1/Master/
mkdir -p ~/.klei/DoNotStarveTogether/Cluster_1/Caves/

Master/server.ini

echo '[NETWORK]
server_port = 11000

[SHARD]
is_master = true

[STEAM]
authentication_port = 8768
master_server_port = 27018

[ACCOUNT]
encode_user_path = true' > ~/.klei/DoNotStarveTogether/Cluster_1/Master/server.ini

Caves/server.ini

echo '[NETWORK]
server_port = 11001

[STEAM]
authentication_port = 8769
master_server_port = 27019

[SHARD]
bind_ip = 127.0.0.1
is_master = false

[ACCOUNT]
encode_user_path = true' > ~/.klei/DoNotStarveTogether/Cluster_1/Caves/server.ini

cluster.ini

nano ~/.klei/DoNotStarveTogether/Cluster_1/cluster.ini

Change the relevant line to

shard_enabled = true

Set the main shard world type to be forest

echo 'return {
  override_enabled = false,
}' > ~/.klei/DoNotStarveTogether/Cluster_1/Master/worldgenoverride.lua

Set the cave shard world type to caves

echo 'return {
  override_enabled = true,
  preset = "DST_CAVE",
}' > ~/.klei/DoNotStarveTogether/Cluster_1/Caves/worldgenoverride.lua

Start the servers

./dstserver start
./dstserver-2 start

Adding mods

File Path Purpose
dedicated_server_mods_setup.lua ~/serverfiles/mods/ Specify server mods to download next time the server starts
modsettings.lua ~/serverfiles/mods/ Settings for debugging mods
modoverrides.lua ~/.klei/DoNotStarveTogether/Cluster_1/Master/ Specify enabled mods for overworld and their configs
modoverrides.lua ~/.klei/DoNotStarveTogether/Cluster_1/Caves/ Specify enabled mods for caves and their configs

Installing Mods

Get workshop ID's of desired mod. To the ~/serverfiles/mods/dedicated_server_mods_setup.lua file, add the following line for each mod.

 ServerModSetup("WorkshopID#")  -- Comments

Enabling Mods on Server

To the Master and Caves shard located at ~/.klei/DoNotStarveTogether/Cluster_#, add a file

 touch modoverrides.lua

and add the following lines

 return {
   ["workshop-WorkshopID1"] = { enabled = true }, -- Mod 1
   ["workshop-WorkshopID2"] = { enabled = true }, -- Mod 2
                       . . .
   ["workshop-WorkshopID(n-1)"] = { enabled = true },  -- Mod (n-1)
   ["workshop-WorkshopIDn"] = { enabled = true } -- Mod n
 }

Notice that commas are required after each mod except the last one. If there is no caves world, this process only needs to be done to the Master shard.

Configuring Mods

Auto-generate a modoverrides.lua file by creating a client hosted server with the server mods included and configuring it through the UI before generating the world. After world generation, extract the modoverrides.lua file from the Klei folder in the documents of your personal machine and replace the files created in the previous step with the auto-generated one.

@Subloran
Copy link

Subloran commented Aug 12, 2022

I've done all the steps, but result of ./dstserver-2 dt has the same ports as ./dstserver dt. Did not try to join in game yet, but is looks strange.

./dstserver dt `dstserver@artem-server:/mnt/serv2/dstserver$ ./dstserver dt

Distro Details

Date: Пт 12 авг 2022 15:37:54 MSK
Distro: Ubuntu 20.04.2 LTS
Arch: x86_64
Kernel: 5.15.0-46-generic
Hostname: artem-server
Uptime: 0d, 1h, 30m
tmux: tmux 3.0a
glibc: 2.31

Server Resource

CPU
Model: AMD FX(tm)-8320 Eight-Core Processor
Cores: 8
Frequency: 3511.679MHz
Avg Load: 0,57, 0,25, 0,18

Memory
Mem: total used free cached available
Physical: 16GB 1,4GB 14GB 4,0GB 14GB
Swap: 2,0GB 0B 2,0GB

Storage
Filesystem: /dev/sdc1
Total: 440G
Used: 2.8G
Available: 414G

Network
Interface: lo
IP: 127.0.0.1
Internet IP: 95.131.148.128

Game Server Resource Usage

CPU Used: 95%
Mem Used: 3% 530MB

Storage
Total: 2,8G
Serverfiles: 2,8G

Don't Starve Together Server Details

Server name: Subloran host
App ID: 343050
Server IP: 127.0.0.1:11000
Internet IP: 95.131.148.128:11000
Server password: q1
Maxplayers: 6
Game mode: endless
Tick rate: 0
Sharding: true
Master: true
Shard: Master
Cluster: Cluster_1
Cave: false
Status: STARTED

dstserver Script Details

Script name: dstserver
LinuxGSM version: v22.1.0
glibc required: 2.15
Discord alert: off
Email alert: off
Gotify alert: off
IFTTT alert: off
Mailgun (email) alert: off
Pushbullet alert: off
Pushover alert: off
Rocketchat alert: off
Slack alert: off
Telegram alert: off
Update on start: off
User: dstserver
Location: /mnt/serv2/dstserver
Config file: /home/dstserver/.klei/DoNotStarveTogether/Cluster_1/Master/server.ini

Backups

No Backups created

Ports

Change ports by editing the parameters in:
/home/dstserver/.klei/DoNotStarveTogether/Cluster_1/Master/server.ini

Useful port diagnostic command:
ss -tuplwn | grep dontstarve_dedi

DESCRIPTION PORT PROTOCOL LISTEN
Game: Server 11000 udp 1
Game: Master 10889 udp 0
Steam: Auth 8768 udp 0
Steam: Master 27018 udp 1

Status: STARTED
`

./dstserver-2 dt `dstserver@artem-server:/mnt/serv2/dstserver$ ./dstserver-2 dt

Distro Details

Date: Пт 12 авг 2022 15:38:38 MSK
Distro: Ubuntu 20.04.2 LTS
Arch: x86_64
Kernel: 5.15.0-46-generic
Hostname: artem-server
Uptime: 0d, 1h, 31m
tmux: tmux 3.0a
glibc: 2.31

Server Resource

CPU
Model: AMD FX(tm)-8320 Eight-Core Processor
Cores: 8
Frequency: 3511.680MHz
Avg Load: 0,48, 0,28, 0,19

Memory
Mem: total used free cached available
Physical: 16GB 1,8GB 14GB 4,0GB 14GB
Swap: 2,0GB 0B 2,0GB

Storage
Filesystem: /dev/sdc1
Total: 440G
Used: 2.8G
Available: 414G

Network
Interface: lo
IP: 127.0.0.1
Internet IP: 95.131.148.128

Game Server Resource Usage

CPU Used: 56%
Mem Used: 3% 546MB

Storage
Total: 2,8G
Serverfiles: 2,8G

Don't Starve Together Server Details

Server name: Subloran host
App ID: 343050
Server IP: 127.0.0.1:11000
Internet IP: 95.131.148.128:11000
Server password: ***
Maxplayers: 6
Game mode: endless
Tick rate: 0
Sharding: true
Master: false
Shard: Caves
Cluster: Cluster_1
Cave: true
Status: STARTED

dstserver-2 Script Details

Script name: dstserver-2
LinuxGSM version: v22.1.0
glibc required: 2.15
Discord alert: off
Email alert: off
Gotify alert: off
IFTTT alert: off
Mailgun (email) alert: off
Pushbullet alert: off
Pushover alert: off
Rocketchat alert: off
Slack alert: off
Telegram alert: off
Update on start: off
User: dstserver
Location: /mnt/serv2/dstserver
Config file: /home/dstserver/.klei/DoNotStarveTogether/Cluster_1/Master/server.ini

Backups

No Backups created

Ports

Change ports by editing the parameters in:
/home/dstserver/.klei/DoNotStarveTogether/Cluster_1/Master/server.ini

Useful port diagnostic command:
ss -tuplwn | grep dontstarve_dedi

DESCRIPTION PORT PROTOCOL LISTEN
Game: Server 11000 udp 1
Game: Master 10889 udp 1
Steam: Auth 8768 udp 0
Steam: Master 27018 udp 1

Status: STARTED
`

It looks like shard name in dstserver-2 lgsm config is not used. May be it is just bug of 'dt' command. Will check it in this evening.

UPD:

This looks like visual bug of "dt" function. In fact caves works correctly.
Thank you a lot for this guide!

@thelegendofbrian
Copy link
Author

I've done all the steps, but result of ./dstserver-2 dt has the same ports as ./dstserver dt. Did not try to join in game yet, but is looks strange.

./dstserver dt
./dstserver-2 dt
It looks like shard name in dstserver-2 lgsm config is not used. May be it is just bug of 'dt' command. Will check it in this evening.

UPD:

This looks like visual bug of "dt" function. In fact caves works corrected. Thank you a lot for this guide!

I'm glad you found it helpful! It took a lot of trial and error to figure things out based on existing documentation, so I'm glad you were able to stumble upon this.

@mrjeffhoffman
Copy link

mrjeffhoffman commented Aug 21, 2022

I've been struggling with this for a few days on my own trying to get it running on two different machines. I think this setup might help - I'm going to try it tomorrow.

Edit: Got it working in two docker containers, one server on each. The only difference was running the docker containers and then setting bind_ip to 0.0.0.0 and master_ip to the ip of the master server docker container in both cluster.ini files and making sure the files matched. Thank you for the guide!

@idkw
Copy link

idkw commented Aug 24, 2022

Thank you ! Very helpful and works perfectly !

@avana7399
Copy link

can you help me when any player join to server have an admin permission. how to disable admin for player?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment