Version 9 (modified by 10 years ago) ( diff ) | ,
---|
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
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 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 to run:
apt-get install lib32gcc1
Also make sure to install a 32 Bit version of Wine:
dpkg --add-architecture i386 apt-get update apt-get install wine:i386
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
- Get the script files:
wget http://illy.bz/fi/7dtd/management_scripts.tar.gz
- 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) - 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. - Make the server start at system boot:
update-rc.d 7dtd.sh defaults
Non-Debian based systems
As distributions which are not based on Debian do not include start-stop-daemon you should now compile it from source as detailed in start-stop-daemon.
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
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. At least on Debian this was not the default for the user root so the following line has to be added to /root/.bashrc:
. /etc/bash_completion
Install the game
Note: It seems like the 64 bit version of the game does not run nicely on Wine, thus the updater script automatically uses the 32 bit engine.
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 /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...