| 1 | 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. |
| 2 | |
| 3 | |
| 4 | == Prerequisites == |
| 5 | Make sure all [[Prerequisites| required tools]] are installed. |
| 6 | |
| 7 | |
| 8 | === 64 Bit host operating system === |
| 9 | SteamCMD requires lib32gcc1 to run: |
| 10 | {{{ |
| 11 | apt-get install lib32gcc1 |
| 12 | }}} |
| 13 | |
| 14 | Also make sure to install a 32 Bit version of Wine: |
| 15 | {{{ |
| 16 | dpkg --add-architecture i386 |
| 17 | apt-get update |
| 18 | apt-get install wine:i386 |
| 19 | }}} |
| 20 | |
| 21 | |
| 22 | == Installation layout == |
| 23 | |
| 24 | 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. |
| 25 | |
| 26 | /home/sdtd:: |
| 27 | home for the user running the server and base path for the server management script system |
| 28 | /home/sdtd/backup:: |
| 29 | by default backups of game data files will go here |
| 30 | /usr/local/bin/7dtd.sh:: |
| 31 | Management script entry point |
| 32 | /usr/local/lib/7dtd/:: |
| 33 | Base path of script components |
| 34 | /etc/7dtd.conf:: |
| 35 | Global configuration options |
| 36 | /etc/bash_completion.d/7dtd:: |
| 37 | Bash-completion configuration to auto-complete the commands for the scripts |
| 38 | /etc/cron.d/7dtd-backup:: |
| 39 | Cron job for game backups |
| 40 | /etc/init.d/7dtd.sh:: |
| 41 | Init script to start/stop the instances on host boot/shutdown |
| 42 | |
| 43 | |
| 44 | == Useraccount dedicated to running 7dtd == |
| 45 | |
| 46 | As running the game as root is highly insecure create a new user just for the server. |
| 47 | {{{ |
| 48 | useradd -d /home/sdtd -m -r -s /bin/bash -U sdtd |
| 49 | }}} |
| 50 | 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. |
| 51 | |
| 52 | |
| 53 | == Install the management script files == |
| 54 | |
| 55 | 1. Get the script files: |
| 56 | {{{ |
| 57 | wget http://illy.bz/fi/7dtd/management_scripts.tar.gz |
| 58 | }}} |
| 59 | |
| 60 | 1. Extract the files to /: |
| 61 | {{{ |
| 62 | tar -xvzf management_scripts.tar.gz -C / |
| 63 | }}} |
| 64 | (alternatively you can extract to some temporary path and move files to their respective target folders manually) |
| 65 | |
| 66 | 1. Open the file /etc/7dtd.conf in the editor of your choice and edit the values. Edit at least the following variables: |
| 67 | {{{ |
| 68 | export STEAM_USER= |
| 69 | export STEAM_PASS= |
| 70 | }}} |
| 71 | 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. |
| 72 | |
| 73 | 1. Make the server start at system boot: |
| 74 | {{{ |
| 75 | update-rc.d 7dtd.sh defaults |
| 76 | }}} |
| 77 | |
| 78 | |
| 79 | == Bash completion == |
| 80 | |
| 81 | 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: |
| 82 | {{{ |
| 83 | . /etc/bash_completion |
| 84 | }}} |
| 85 | |
| 86 | |
| 87 | == Install the game == |
| 88 | |
| 89 | ''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. |
| 90 | |
| 91 | 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''. |
| 92 | |
| 93 | 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. |
| 94 | |
| 95 | == (Optional) Enable cron job for backups == |
| 96 | |
| 97 | If you want the system to automatically backup the instance configurations and game saves edit the file ''/etc/cron.d/7dtd-backup'': |
| 98 | {{{ |
| 99 | 0 * * * * root /usr/local/bin/7dtd.sh backup |
| 100 | }}} |
| 101 | (i.e. remove the hash character ''#'' from the start of the line). |
| 102 | |
| 103 | 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). |
| 104 | |
| 105 | |
| 106 | == Initial setup done == |
| 107 | |
| 108 | You can now continue and [[Instance management|setup instances]]... |