wiki:Installation

The following will guide through the basic setup of the scripts. If explicit commands or filenames are given they can differ if you use a distribution which is not based on Debian.

Table of contents

  1. Automatic installation
    1. Manual steps after running the bootstrapper
      1. Debian based distribution
      2. Other distributions
  2. Manual installation
    1. Prerequisites
      1. 64 Bit host operating system
    2. Installation layout
    3. Useraccount dedicated to running 7dtd
    4. Install the management script files
    5. Compile start-stop-daemon
    6. Secure the files
    7. Bash Completion
    8. Install the game
    9. (Optional) Enable cron job for backups
    10. Initial setup done

Automatic installation

For a mostly automatic setup you can get the bootstrapper script and run it. This will do all the steps explained on this page in the section manual installation.

wget http://svn.illy.bz/7dtd/bootstrapper/bootstrap.sh
chmod +x bootstrap.sh
./bootstrap.sh

Manual steps after running the bootstrapper

Debian based distribution

If you want bash auto completion you should check if that is enabled for root by default. See section Bash completion.

Other distributions

You should check if all prerequisites are met (for most of them an automatic check is included in the bootstrapper) and if the paths at the end of the file /etc/7dtd.conf point to the correct locations.

Also automatic start of 7dtd on system boot is not automatically setup. Refer to the documentation of your distribution on how to get /etc/init.d/7dtd.sh called on boot with parameter "start" and on shutdown with parameter "stop".



Manual installation

Prerequisites

Make sure all required tools are installed.

64 Bit host operating system

SteamCMD requires lib32gcc1 and lib32stdc++ to run:

apt-get install lib32gcc1 lib32stdc++

Installation layout

This guide will assume that the following paths will be used. You can use different ones but obviously you have to adapt some commands and settings.

/home/sdtd
home for the user running the server and base path for the server management script system
/home/sdtd/backup
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

Useraccount dedicated to running 7dtd

As running the game as root is highly insecure create a new user just for the server.

useradd -d /home/sdtd -m -r -s /bin/bash -U sdtd

This will create a user and group named sdtd (last parameter) with home directory /home/sdtd. Both can be changed but you will also have to adapt the other steps later on.

Install the management script files

  1. Get the script files:
    wget http://illy.bz/fi/7dtd/management_scripts.tar.gz
    
  2. Extract the files to /:
    tar --touch -xvzf management_scripts.tar.gz -C /
    
    (alternatively you can extract to some temporary path and move files to their respective target folders manually)
  3. Open the file /etc/7dtd.conf in the editor of your choice and edit the values. All values can be kept at their default if you did stick to the paths and names given in this tutorial. If you are not running a Debian based distribution make sure the paths for the commands defined at the end are correct.
  4. Make the server start at system boot:
    update-rc.d 7dtd.sh defaults
    

Compile start-stop-daemon

start-stop-daemon is part of Debian's dpkg (Debian package manager) package. But as other distributions obviously do not ship it and some Debian 6 and older do not ship a recent enough version we will compile it from source. Compiling only requires an installation of gcc.

If you get any errors during compilation (e.g. because of missing headers) please inform me so I can update this page.

  1. The source of the tool is shipped with the scripts so switch to its directory:
    cd /usr/local/lib/7dtd/start-stop-daemon
    
  2. Compile it by running make (with makefile) or directly invoke gcc:
    • make
      
    • gcc -o start-stop-daemon start-stop-daemon.c
      
  3. Make sure it is owned by root and only writable by root, again either by running make or do it manually:
    • make install
      
    • chown root.root start-stop-daemon
      chmod 0755 start-stop-daemon
      

Secure the files

Make the global config file 7dtd.conf only accessible to the root user:

chown root.root /etc/7dtd.conf
chmod 0600 /etc/7dtd.conf

Files in the sdtd-user folder owned by sdtd:

chown sdtd.sdtd /home/sdtd -R

Also make all other scripts only writable by root:

chown root.root /etc/init.d/7dtd.sh
chown root.root /etc/bash_completion.d/7dtd
chown root.root /usr/local/bin/7dtd.sh
chown root.root /usr/local/lib/7dtd -R
chmod 0755 /etc/init.d/7dtd.sh
chmod 0755 /etc/bash_completion.d/7dtd
chmod 0755 /usr/local/bin/7dtd.sh
chmod 0755 /usr/local/lib/7dtd -R

Bash Completion

If you want to use auto completion for the scripts (i.e. pressing <TAB> to complete the current parameter, <TAB><TAB> to get a list of valid things in the current location) you have to enable Bash completion. Add (or uncomment if existing) the following line has to /root/.bashrc:

. /etc/bash_completion

Install the game

Run 7dtd.sh updateengine. To test the auto completion (if enabled) enter 7dtd.sh and press <TAB> twice. It should show you the allowed commands. Enter an additional up and press <TAB> once again and it should complete to updateengine.

This command will download and install SteamCMD to the SDTD_BASE/steamcmd and afterwards download 7DtD itself. You can later on always run this command again to update the 7DtD files if there is an update on Steam.

(Optional) Enable cron job for backups

If you want the system to automatically backup the instance configurations and game saves edit the file /etc/cron.d/7dtd-backup:

0 *     * * *   root    nice -n 15 /usr/local/bin/7dtd.sh backup

(i.e. remove the hash character # from the start of the line).

First two columns specify on which minute (0) and which hour (* = every hour) the backup will be run. Next three specify day, month and day of week (you probably want to keep * here).

Initial setup done

You can now continue and setup instances...

Last modified 17 months ago Last modified on Mar 17, 2016, 5:58:53 PM