This article will describe how to install a dedicated 7 Days to Die server and configure it to run two instances of a map (Navezgane and a randomly generated map) with some useful modifications and custom in-game notifications.
Server Requirements:
- 4 GB RAM
- 15 GB free space on /opt (for Alpha 18)
- 2 CPU cores (2.4GHz+)
These paths will be used:
/opt/sdtd - home for the user running the server and base path for the server management script system
/bak/sdtd - by default backups of game data files will go here
/usr/local/bin/7dtd.sh - Management script entry point
/usr/local/lib/7dtd/ - Base path of script components
/etc/7dtd.conf - Global configuration options
/etc/bash_completion.d/7dtd - Bash-completion configuration to auto-complete the commands for the scripts
/etc/cron.d/7dtd-backup - Cron job for game backups
/etc/init.d/7dtd.sh - Init script to start/stop the instances on host boot/shutdown
NOTE: Make sure you have enough space on /opt to install 7 Days to Die which is about 12 GB for Alpha 18. You will also need additional space as players explore the map and expand the savegame size.
Install Ubuntu Server
This article assumes Ubuntu was installed following these instructions: How to Install Ubuntu Server
Firewall Rules
Edit the firewall script that was created during the initial setup of the server (if you followed my instructions):
Code: Select all
sudo vi /var/scripts/prod/en-firewall.sh
NOTE: The Telnet port is commented out since it should not be open to the entire Internet but left there as documentation about the port.
Code: Select all
echo "Adding 7dtd Server rules"
ufw allow proto tcp to any port 27000 comment '#1 game port' 1>/dev/null 2>&1
ufw allow proto udp to any port 27000:27002 comment '#1 Steam communication' 1>/dev/null 2>&1
ufw allow proto tcp to any port 8080 comment '#1 Web control panel' 1>/dev/null 2>&1
#ufw allow proto tcp to any port 8081 comment '#1 Telnet control panel' 1>/dev/null 2>&1
ufw allow proto tcp to any port 8082 comment '#1 Allocs Web Map' 1>/dev/null 2>&1
ufw allow proto tcp to any port 27003 comment '#2 game port' 1>/dev/null 2>&1
ufw allow proto udp to any port 27003:27005 comment '#2 Steam communication' 1>/dev/null 2>&1
ufw allow proto tcp to any port 8083 comment '#2 Web control panel' 1>/dev/null 2>&1
#ufw allow proto tcp to any port 8084 comment '#2 Telnet control panel' 1>/dev/null 2>&1
ufw allow proto tcp to any port 8085 comment '#2 Allocs Web Map' 1>/dev/null 2>&1
Code: Select all
sudo /var/scripts/prod/en-firewall.sh
Code: Select all
sudo apt install xmlstarlet gcc
Code: Select all
sudo addgroup sdtd
sudo addgroup steam
sudo useradd --comment "7 Days to Die Server" --shell /bin/bash --home /opt/sdtd --gid sdtd sdtd
sudo useradd --comment "Steam Command" --gid sudo --gid steam --create-home steam
Download the scripts archive, extract it, rename the home folder, set correct file ownership, re-archive and re-extract to the final destination while preserving the changes that were made:
Code: Select all
sudo mkdir /bak/sdtd
sudo chown sdtd:sdtd /bak/sdtd
mkdir /tmp/t
cd /tmp
wget http://illy.bz/fi/7dtd/management_scripts.tar.gz
tar --touch -xvzf /tmp/management_scripts.tar.gz -C /tmp/t/
mv /tmp/t/home /tmp/t/opt
sudo chown --recursive root:root /tmp/t/*
sudo chown --recursive sdtd:sdtd /tmp/t/opt/sdtd
sudo chmod 0755 /tmp/t/etc/init.d/7dtd.sh
sudo chmod 0755 /tmp/t/etc/bash_completion.d/7dtd
sudo chmod 0755 /tmp/t/usr/local/bin/7dtd.sh
sudo find /tmp/t/usr/local/lib/7dtd -type f -name '*.sh' -exec chmod 0755 {} \;
sudo tar -czvf /tmp/7dtd-new.tar.gz /tmp/t/*
sudo tar -xzvf /tmp/7dtd-new.tar.gz -C / --strip-components=2
Code: Select all
sudo vi /etc/bash.bashrc
Code: Select all
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
Code: Select all
sudo vi /etc/7dtd.conf
Code: Select all
export SDTD_BASE=/home/sdtd
Code: Select all
export SDTD_BASE=/opt/sdtd
Code: Select all
export SDTD_BACKUP_ROOT=/home/sdtd/backup
Code: Select all
export SDTD_BACKUP_ROOT=/bak/sdtd
Run this command to install SteamCMD and download the game engine. You can choose to install the experimental or stable version.
Code: Select all
7dtd.sh updateengine --experimental
Code: Select all
7dtd.sh updateengine --stable
Code: Select all
7dtd.sh updatefixes
Code: Select all
7dtd.sh updatescripts
Code: Select all
cd /usr/local/lib/7dtd/start-stop-daemon
gcc -o start-stop-daemon start-stop-daemon.c
sudo chown root:root start-stop-daemon
sudo chmod 0755 start-stop-daemon
Make sure you know what your Steam 64 ID is and edit this file:
Code: Select all
sudo vi /opt/sdtd/templates/admins.xml
Code: Select all
<admins>
<!-- <admin steamID="STEAM GUID" permission_level="0" /> -->
</admins>
Code: Select all
<admins>
<admin steamID="76561197970730192" permission_level="0" />
</admins>
Code: Select all
sudo 7dtd.sh instances create
If you called your instance "hamcraft" then this is how you would copy the config you just made to become the new default:
Code: Select all
sudo cp /opt/sdtd/instances/hamcraft/config.xml /opt/sdtd/templates/.
sudo chown sdtd:sdtd /opt/sdtd/templates/config.xml
sudo chmod 644 /opt/sdtd/templates/config.xml
- List all game instances:
Code: Select all
sudo 7dtd.sh instances list
Code: Select all
Instance name | Running | Players | Port ---------------------+----------+---------+------ hamcraft | yes | 1/ 8 | 27000 navezgane | yes | 0/ 8 | 27003
- Stop each running instance:
Code: Select all
sudo 7dtd.sh kill hamcraft sudo 7dtd.sh kill navezgane
- Verify all instances have been shutdown:
Code: Select all
sudo 7dtd.sh instances list
- Make a backup of the savegames:
Code: Select all
sudo 7dtd.sh backup
- Update the game engine:
if using stable branch:if using experimental branch:Code: Select all
sudo 7dtd.sh updateengine --stable
Code: Select all
sudo 7dtd.sh updateengine --experimental
- Update the server fixes:
Code: Select all
sudo 7dtd.sh updatefixes
- Update the management scripts:
Code: Select all
sudo 7dtd.sh updatescripts
- Start the game instances that were running earlier:
Code: Select all
sudo 7dtd.sh start hamcraft sudo 7dtd.sh start navezgane
- Wait for the instances to load and check their log files for errors (look for "INF StartGame done" which means the server is ready to accept player connections):
Code: Select all
sudo vi /opt/sdtd/instances/hamcraft/logs/current_output_log.txt
Code: Select all
sudo vi /opt/sdtd/instances/navezgane/logs/current_output_log.txt
- On your gaming PC, start up the client and see if you can connect and verify all mods are working like normal.
To manually initiate a backup, run this command:
Code: Select all
sudo 7dtd.sh backup
Code: Select all
crontab -u root -e
Code: Select all
0 8,12,17,20,22 * * * /usr/local/bin/7dtd.sh backup > /dev/null 2>&1