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. [[PageOutline(1-5,Table of contents,inline)]] = 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|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|Bash completion]]. === Other distributions === You should check if all [[Prerequisites|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 [[Prerequisites| required tools]] are installed. === 64 Bit host operating system === SteamCMD requires lib32gcc1 to run: {{{ apt-get install lib32gcc1 }}} == 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 }}} 1. 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) 1. Open the file /etc/7dtd.conf in the editor of your choice and edit the values. Edit at least the following variables: {{{ export STEAM_USER= export STEAM_PASS= }}} All other 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. 1. 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 [[Author|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 }}} 1. Compile it by running make (with makefile) '''or''' directly invoke gcc: * {{{ make }}} * {{{ gcc -o start-stop-daemon start-stop-daemon.c }}} 1. 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 }}} == Install the Linux engine == 1. Get the archive: {{{ wget -O linux_files.tar.gz http://illy.bz/fi/7dtd/linux_files.tar.gz }}} 1. Extract the files to /home/sdtd: {{{ tar --touch -xvzf linux_files.tar.gz -C /home/sdtd/ }}} 1. Update permissions: {{{ chown sdtd.sdtd -R /home/sdtd/linux_files chmod 0644 -R /home/sdtd/linux_files find /home/sdtd/linux_files -type d -exec chmod 0755 {} \; chmod 0755 /home/sdtd/linux_files/engine/7DaysToDie.x86 }}} == Secure the files == As the global config file ''7dtd.conf'' contains your Steam login data make sure it is 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 }}} == ^(Debian/Ubuntu)^ [=#bash_completion Bash Completion] == If you want to use auto completion for the scripts (i.e. pressing to complete the current parameter, to get a list of valid things in the current location) you have to enable Bash completion. For root add, or if you're on Ubuntu just un-comment(delete the #'s) at the bottom, the following 3 lines. This is unnecessary if you enable it in /etc/bash.bashrc and /etc/profile. {{{ if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi }}} == Install the game == Run ''7dtd.sh updateengine''. To test the auto completion (if enabled) enter ''7dtd.sh '' and press twice. It should show you the allowed commands. Enter an additional ''up'' and press 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 [[Instance management|setup instances]]... == Update Log == * 15OCT2014 by Battleborn * Updated bash completion; script additions handle effed/custom distributions. * Minor aesthetic changes.