Easily Set up a 7 Days to Die Linux Dedicated Server

*Updated for A19 Alpha 19

7 Days to Die is a survival horde sandbox apocalypse style game. It’s quite fun solo as well as multiplayer in a server environment. Unfortunately, most tutorials on server setups or installations are dated and misleading. This thread is designed to be straightforward and easy to understand to get your server up and running in no time!

Prerequisites:

  • Ubuntu Server or equivelent.
  • Already configured os / firewall environment
  • Already logged into your linux server and at the command prompt ready to go!

Let’s get started!

First, we will need to install some requirements:
Code:

sudo apt update && sudo apt install -y lib32gcc1 screen

Now, let’s create some directories that we will use during this installation:
Code:

mkdir {$HOME/steamcmd,$HOME/7d2d}

Next, we will need to download and extract the steamcmd utility
Code:

wget -qO- http://media.steampowered.com/installer/steamcmd_linux.tar.gz | tar xvz -C $HOME/steamcmd

We need to download and install the 7 Days to Die Dedicated server
Code:

$HOME/steamcmd/steamcmd.sh +login anonymous +force_install_dir $HOME/7d2d +app_update 294420 +quit

The serverconfig.xml file can be overwritten when a new update is released. To prevent losing our settings when an update is released, we will copy the config and use the copy as our live config
Code:

cp serverconfig.xml live-serverconfig.xml

At this point, you should configure your live-serverconfig.xml to your liking. A good resource for server options is the official 7 Days to Die Wiki
Code:

nano live-serverconfig.xml

7 Days to Die uses several ports that need to be opened on your firewall. Here are the commands to open those ports with ufw
Ports opened:
26900 tcp & udp
26901 udp
26902 udp
Code:

sudo ufw allow 26900 && sudo ufw allow 26901/udp && sudo ufw allow 26902/udp

Just like the server config, the launch script can also overwritten when the server is updated. Let’s make a copy as not to lose that too
Code:

cp startserver.sh live-startserver.sh

We want to change the script a bit so that the server starts in the background when we run it. We will add “screen -dmS 7d2d” before the server launch
Code:

nano live-startserver.sh

#!/bin/sh
cd "`dirname "$0"`"

PARAMS=$@

CONFIGFILE=
while test $# -gt 0
do
if [ `echo $1 | cut -c 1-12` = "-configfile=" ]; then
CONFIGFILE=`echo $1 | cut -c 13-`
fi
shift
done

if [ "$CONFIGFILE" = "" ]; then
echo "No config file specified. Call this script like this:"
echo " ./startserver.sh -configfile=serverconfig.xml"
exit 1
else
if [ -f "$CONFIGFILE" ]; then
echo Using config file: $CONFIGFILE
else
echo "Specified config file $CONFIGFILE does not exist."
exit 1
fi
fi

export LD_LIBRARY_PATH=.
#export MALLOC_CHECK_=0

if [ "$(uname -m)" = "x86_64" ]; then
screen -dmS 7d2d ./7DaysToDieServer.x86_64 -logfile 7DaysToDieServer_Data/output_log__`date +%Y-%m-%d__%H-%M-%S`.txt -quit -batchmode -nographics -dedicated $PARAMS
else
echo "7 Days to Die only supports 64 bit operating systems!"
exit 1
fi


Now that we’ve done all that, we can finally launch the server into the background
Code:

./live-startserver.sh -configfile=live-serverconfig.xml

To attach your terminal to the server
Code:

screen -r 7d2d

To detach from the screen, hit the following keys
Code:

Press ctrl +a
The let go of the control button
Press d

Your save game and any generated worlds can be accessed in the following location:
Code:

cd $HOME/.local/share/7DaysToDie

You now have a fully functioning 7 Days to Die server on your linux box! Any questions or comments, feel free to ask here!

Share your love
Zhandroid
Zhandroid
Articles: 7

3 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  1. estoy desplegando una maquina de debian 11 en azure en la que montar el servidor de seven days, sabes si en una distro de bian 11 esta guia funcionara bien?

  2. muchisinmas gracias por eso, corto sencillo y funcional.. tenia varios dias buscando tutorial de como poder hacer un server hasta que con este pude… gracias