This tutorial is outdated. It should still work, but we are using different tools these days. Coppis mod is discontinued and probably won’t work any longer on current versions of 7 Days to Die. Make that definitely.
I will post a more updated version as soon as I feel like writing it up 🙂

Hi there. I am ecv admin and caretaker of the chrani.net 7dtd server(s).

On this page I will outline my reset/install procedure for our 7dtd dedicated server(s).
This post is pretty much for my own reference, perhaps it is useful to you as well. Feel free to use the comments for advice and suggestions, as this Linux stuff is kinda like Chinese to me ^^ Scrap that, Chinese is certainly easier to learn!

a big thanks to hammondslegacy, I got a lot of my stuff from there.

We run an i7-7700K with 64GB of RAM, full root-server


Setting up the server (revised on May 19th 2018)

We’ll be setting up an Ubuntu 16.04 LTS for this, no need to go bleeding edge.

The first thing I do is setting the max file limit of the server, as we’ve had troubles with that in the past.

Since we only host 7dtd servers on this machine and nothing else (fully dedicated) we can simply edit /etc/sysctl.conf and just append our setting at the end of the file. If you have other stuff on your server, you might have to alter/change the entries there.

nano /etc/sysctl.conf:
fs.file-max = 131072

To be sure all executables are obeying that limit, we will set it in another place also (I do not know if this is actually required, but I’ll do it anyhow cause the internet says so (Increase maximum file open limit)

nano /etc/security/limits.conf:
* soft nproc 131072
* hard nproc 131072
* soft nofile 131072
* hard nofile 131072
root soft nproc 131072
root hard nproc 131072
root soft nofile 131072
root hard nofile 131072

We’ll also add this little diddy to /etc/pam.d/common-session

nano /etc/pam.d/common-session:
session required pam_limits.so

That should take care of all the file-limits we need to run the dedicated 7dtd server and Allocs Webmap.


Installing the 7dtd dedicated-server files

Let’s create the user going to run the gameserver and then install the actual gameserver:

apt-get install gcc
apt-get install xmlstarlet
apt-get install lib32stdc++6
apt-get install lib32gcc1
apt-get install make

create folders and users

mkdir -p /opt/sdtd/templates
mkdir /opt/sdtd/backup
groupadd -r sdtd
useradd –comment “7 days to Die Server” -d /opt/sdtd -m -r -s /bin/bash -g sdtd sdtd
(got this warning while doing that “useradd: warning: the home directory already exists. Not copying any file from skel directory into it.”)
chown sdtd:sdtd -R /opt/sdtd

installing alloc’s management scripts & start-stop daemon

mkdir /tmp/t
cd /tmp/t
wget http://illy.bz/fi/7dtd/management_scripts.tar.gz
tar xvzf management_scripts.tar.gz

nano /tmp/t/etc/7dtd.conf:
add/edit
export SDTD_BASE=/opt/sdtd
export SDTD_BACKUP_ROOT=/opt/sdtd/backup

chown root:root -R /tmp/t/*
chmod 0600 /tmp/t/etc/*
cp -R /tmp/t/etc/* /etc/.
cp -R /tmp/t/usr/* /usr/.
cp /tmp/t/home/sdtd/templates/* /opt/sdtd/templates/.
chown sdtd:sdtd -R /opt/sdtd

cd /usr/local/lib/7dtd/start-stop-daemon
make

7dtd.sh updateengine
7dtd.sh updatefixes

Copy your Coppis mod into the games Mod directory (opt/sdtd/engine/Mods)

Create your instances as you like them, I’m calling mine simply ‘public’ for this guide

7dtd.sh instances create


We’d like the Webmap to be available to mods, so we create a webpermissions.xml for each instance

<?xml version=”1.0″ encoding=”UTF-8″?>
<webpermissions>

<permissions>
<permission module=”webapi.getstats” permission_level=”1″ />
<permission module=”webapi.executeconsolecommand” permission_level=”0″ />
<permission module=”webapi.getwebuiupdates” permission_level=”1″ />
<permission module=”webapi.getallowedcommands” permission_level=”2000″ />
<permission module=”web.map” permission_level=”2″ />

<permission module=”webapi.getlog” permission_level=”0″ />
<permission module=”webapi.executeconsolecommand” permission_level=”0″ />

<permission module=”webapi.getstats” permission_level=”2″ />
<permission module=”webapi.getplayersonline” permission_level=”2″ />

<permission module=”webapi.getplayerslocation” permission_level=”2″ />
<permission module=”webapi.viewallplayers” permission_level=”2″ />

<permission module=”webapi.getlandclaims” permission_level=”2″ />
<permission module=”webapi.viewallclaims” permission_level=”2″ />

<permission module=”webapi.getplayerinventory” permission_level=”0″ />

<permission module=”webapi.gethostilelocation” permission_level=”0″ />
<permission module=”webapi.getanimalslocation” permission_level=”0″ />
</permissions>

</webpermissions>

We also need a way to restart the server if it got shut down or something made it go kablooey, or in case it reboots for whatever reason

For now I simply call the start server command every four minutes, this will help with crashes, however it won’t help at all with the feared Zombie-Mode ™

nano /etc/cron.d/7dtd-start:

## minute(0-59) hour(0-23) day-of-month(1-31) month(1-12) day-of-week(0-6) user command-to-execute

## Start 7dtd instances
*/4 * * * * root /usr/local/bin/7dtd.sh start public
##

Set up the backups:

nano /etc/cron.d/7dtd-backup:

## minute(0-59) hour(0-23) day-of-month(1-31) month(1-12) day-of-week(0-6) user command-to-execute

## 7dtd backup handling
# run backup every 2 hours
0 */2 * * * root nice -n 15 /usr/local/bin/7dtd.sh backup > /dev/null 2>&1
# remove backups older than ten days, once a day at 5:30am
30 5 */1 * * root find /opt/sdtd/backup/* -type d -ctime +10 -exec rm -rf {} + > /dev/null 2>&1
##

You need an INSANE amount of HDD space for this backup frequency. Make it every six hours and delete after four days if you are pressed for space!

This should take care of the basic setup, the rest can be done in-game or with our bot (or other server-managers), like automatic shutdowns/restarts and suchlike.