Autor Thema: 7 Days to die - Linux Server  (Gelesen 6930 mal)

Offline Dacardy

  • Administrator
  • Registrierter User
  • ******
  • Beiträge: 1321
    • Profil anzeigen
    • Clan Chill4Skill
7 Days to die - Linux Server
« am: 28. Oktober 2013, 21:53:50 »
Dieses Tutorial zeigt euch, wie man einen dedicated 7DTD Server auf Linux aufsetztz

Benötigte Software:
-bash (für scripts)
-rsync (für backups)
sendemail, sendxmpp (optional)

Installation:   (Die Pfade können natürlich geändert werden)

home for the user running the server

root of the 7dtd server installation

resulting in this path to the main exe

For the management scripts

For global script configuration

Init script to start/stop the server

Useraccount dedicated to running 7dtd

As running the game as root is not really the best thing we will 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 game

Note: It seems like the 64 bit version of the game does not run nicely on Wine. Please use the 32 bit version no matter if your server is 32 or 64 bit.

You can of course directly use the Windows installer on the server with Wine but that would require you to have either a monitor attached to the server or run a remote desktop.

An easier approach is to install the game normally on any machine running Windows and upload the installed game folder. You can (and should) of course compress the files to upload as this will significantly reduce upload size.

Install the management script files

Get the script files:

Extract the files to /:

tar -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. If you used the paths and usernames as in this guide you will most likely only have to edit the savegame name and memory limit notification values. make the server start at system boot:

update-rc.d defaults

Upload a savegame

As it currently seems impossible to create a savegame directly on the server start a new local game on a Windows client and quit it. Then open the saves folder on that machine (installation path\Data\Worlds\Navezgane\Saves\yourSafeName), compress the folder of your savegame, upload and extract it to the appropriate folder on the server (/home/sdtd/7dtd/Data/Worlds/Saves/yourSafeName).

After uploading make sure the the whole 7dtd-folder is owned by the user that will later run the engine:

chown sdtd.sdtd /home/sdtd/7dtd -R

Add cron-jobs for savegame backups and memory limit notifications

If you want the system to automatically backup the Worlds folder add the following line to /etc/crontab:

0 *     * * *   root    /usr/local/bin/
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).
Warning: As of Alpha 1 the game seems to only save the current state if the last player disconnects. So make sure that all players disconnect every now and then.

If you want to get notifications on the memory limit add this line:

*/5 *   * * *   root    /usr/local/bin/
Setting the minute to */5 means the script is run every 5 minutes.
Make sure you set the appropriate values in /etc/7dtd.conf!

Start the server
If everything went fine you should now be able to check console output of 7dtd:

screen -r sdtd/sdtd
This will open the virtual terminal that was attached to the game. Do not press Ctrl+C to disconnect from that screen! Doing so will stop the whole engine! The parameter specifies username of the user running 7dtd / screen session name (you should only need to change the first sdtd if you changed the name of the user running the engine). Normal output should look something like this:

Mono path[0] = 'Z:/home/sdtd/7dtd/7DaysToDie_Data/Managed'
Mono path[1] = 'Z:/home/sdtd/7dtd/7DaysToDie_Data/Mono'
Mono config path = 'Z:/home/sdtd/7dtd/7DaysToDie_Data/Mono/etc'
To disconnect from that screen session press Ctrl+A, Ctrl+D (simply keep Ctrl pressed). To stop the server run

Final words

Currently 7dtd does not include any login authentication. If you do not want your server to be public to everybody you have to set up external means to prevent this (e.g. OpenVPN or a firewall, if the clients have static IP addresses).