7 Days to Die

7 Days to Die

135 人が評価
Installing Linux dedicated server for 7 days to die
作者: Max Noskill
Step-by-step guide: installing 7 days to die dedicated server on Linux.
3
8
2
   
アワード
お気に入り
お気に入り
お気に入りから削除
Foreword
Update to alpha20 release. If you update from earlier version, remember polite toilet behavior: wipe old saves!

Guide is for Ubuntu systems as that's what Valve is supporting. However, it's extremely easy to install this on RedHat systems and Linux Mint.

I assume that you're at least somewhat familiar with unix commands. If you don't understand what commands will do, look them up on search engine and do some learning before proceeding. If you're completely new to linux systems, you should remember that files are case-sensitive.

Also I assume that you run SSHd on your server. It's installed as "openssh-server" on Ubuntu.

Important note:

If you want to install Windows-server, there is a video guide by [SAO] BigC90210.

Another important note:

Looks like older AMD's won't run anymore A20 version server. No can do. Anyways, for more than few players and large maps you'll want decent hardware and map generation took ages... installing server on new AMD hardware, for example Ryzen 9 3900X works fine.
Step 1: Log in to your server with SSH
ssh -l youraccount yourserver

Step 2: Choose account for 7days dedicated server
Option 1: install on your own user account

You can skip this step.

Option 2: create new dedicated server account (recommended)

This requires you have root access.

# get root permissions sudo su (type your password) # add a new user account useradd --comment "7days to die Server" -m 7days # change shell to bash chsh -s /bin/bash 7days # change the password passwd 7days (type 7days account password here)

Test your new account by logging in from the remote computer.

You need to edit server config files. Easiest way to do this is to use text editor on the server. You can also edit them locally on your computer and transfer them to server with SFTP.

If you haven't used any command line editor before, try first the text editor nano which should be pre-installed already for you. See next section for list of suggested programs and how to install them. Otherwise just use whatever editor suits you.
Step 3: Install SteamCMD
Download SteamCMD or use Ubuntu repository.

Download:

Open the package:

tar xvzf steamcmd_linux.tar.gz

Remove install package:

rm steamcmd_linux.tar.gz

3.1: Ubuntu repository

Or you can just use Ubuntu repository to install. For other more complex distributions take a look at provided link.

"To install SteamCMD the multiverse repository and x86 packages must be enabled."
Valve SteamCMD page, installing: https://developer.valvesoftware.com/wiki/SteamCMD#Linux

sudo add-apt-repository multiverse; sudo dpkg --add-architecture i386; sudo apt update sudo apt install steamcmd

Important note: Ubuntu steamcmd likes to install BY DEFAULT your servers to this location:
$HOME/.local/share/Steam/steamcmd/your_new_server_is_here/

We take a look later on how to change that location.


3.2: Installing additional software

Note: if you don't have wget installed, you can install it (as root):

apt-get install wget

Problems running steamcmd on Ubuntu? You might need to install lib32gcc1:
apt-get install lib32gcc1

If you haven't used any command line editor before, let's install text editor nano (Ubuntu haves this installed and most likely this is pre-installed on most distributions).

apt-get install nano

As you can't daemonize the server with command line switches, you most likely want to install screen.

apt-get install screen

There is also byobu which offers more functionality than screen, but screen is no-brainer.

apt-get install byobu
Step 4: Download dedicated server with SteamCMD
You can download the dedicated server anonymously without logging in. Otherwise use your account credentials on login and authenticate yourself with Steam Guard.

# Start SteamCMD ./steamcmd.sh # (or just steamcmd if you installed Ubuntu package)

SteamCMD shell appears after a while and you can type commands in SteamCMD prompt. Note that SteamCMD prompt always begins with Steam>.

force_install_dir ./7daysded login anonymous app_update 294420 quit

4.1: Ubuntu steamcmd package

Important note: Ubuntu steamcmd likes to create install directory by relation to it's location so by default it is in
$HOME/.local/share/Steam/steamcmd/newserver/

That means it is in hidden dot-directory named .local and under Steam files.

You can either change installation path by using full path:

# if you use Ubuntu repository with steamcmd and your username is "zombies" # type shell command "pwd" (not steamcmd) to find out your home directory name if needed force_install_dir /home/zombies/7daysded login anonymous app_update 294420 quit

OR just symlink the directory for your convenience (who wants to type those long paths, not me):
ln -s -d ./.local/share/Steam/steamcmd/my7daysserver myserver # this assumes you installed with server directory name ./my7daysserver # change what you like to name for "myserver"

4.2: How to update

You can use this same procedure to UPDATE THE SERVER.

Updating might overwrite your config files! You might want to backup and/or rename them later when everything works.

Note: You can insert all SteamCMD-commands in the text file and run it with crond whenever you want to update your server.

4.3: How to change versions to older and current

Experimental and old server builds:

You can see available server builds from Steam:
Go to Library > Tools > 7days > Properties > Beta

You can check the version names from here and also when they were released:
https://steamdb.info/app/294420/depots/

Old build:

app_update 294420 -beta alpha13.8
Note that's "alpha13.8" without spaces!

Revert to v1.0 build from any other

app_update 294420 -beta v1.0

Likely version name public could work too.

Comment from tifkat:
"After checking the available betas in my steam client in windows, I saw a v1.0 under betas. So I used "-beta v1.0" to downgrade the server back to v1.0. This seems to have worked, and if I app_update again, it does not upgrade to the v1.1 beta."
Step 5: Location of startup script startserver.sh
Server was installed in "7daysded" directory. It contains startup script and config files.

On new versions startup script works as it should so you don't have to edit it.
Step 6: Edit serverconfig.xml file
Setup the server anyway you want. There is explanation text after each of the options in serverconfig.xml.

Here are the most important options:

  • ServerName -- name of your server
  • ServerPort -- do you want default game port and if you're inside LAN, please think about how you're going to route the port out. Usually this means you have to edit NAT settings on your WAN/xDSL/router box.
  • ServerVisibility -- do you want private server for friends or public internet server. Option 0 means private server which is not published on the game server lists.

  • ServerPassword -- if you run private server, you might want to set a password
  • ServerMaxPlayerCount -- your server might not support lots of players without lagging. It's best to test which value is suitable for you.
  • ServerDescription -- type brief description of your server here
  • EACEnabled -- anti-cheat, if you get bad lag and weird behaviour, you might want to turn this off, especially on private servers.

Game world is the map you'll see in the game. Navezgane is the default map.

  • GameWorld -- Navezgane is the default map, or you might want to try "RWG" for randomized map. Note that RWG generation takes lots of time when you start the server up but on next startup it should load up fairly fast.
  • GameName -- you can name your save game here. Do not use : in the name or windows players can't connect.
  • WorldGenSeed -- for RWG, random seed for changing the map layout
  • WorldGenSize -- for RWG, map size options. Note that larger numbers like 8192 will increase the generation time.
  • DayNightLength -- length of the game day in real time (minutes).
  • LootRespawnDays -- game days before loot respawns.

This is "PvP setting".

  • PlayerKillingMode -- are players able to damage each others. This is important if you have public server and do not want player to kill each others.

You'll need some way to shut your server down and possibly manipulate it. Here is how to enable the telnet interface.

  • TelnetEnabled -- if your server is directly connected on the internet, consider blocking direct connects to this port
  • TelnetPort -- you can change the default port (e.g. 12345)
  • TelnetPassword -- documentation claims that telnet is only bound to local interface if the password is empty.

Section 6.1: Map generation times

Important: if server "does not start" and you have RWG selected, just wait. That will take LOOONG time on slower computers. For testing, it's best to try on smaller map size, Navezgane or use pregenerated maps.

Generation times for size 8192x8192 map:

Time
CPU
Server version
20 minutes
Intel i7-6700K
A19
1 hour
AMD Phenom II X4 B55
A19
5 min, 42 sec
AMD Ryzen 9 3900X
A20

Server should write information about generation on logs and on telnet console. If absolutely nothing happens, restart the server as it's stuck. And yes, generation is single threaded.
Step 7: Start the server
As server does not start automatically as background process, you may want to start the server inside screen or use nohup.

You can always kill the server by telnetting in and do "shutdown". After that you need restart the server manually unless you write the loop which does restarting automatically.

Option 7.1: Quickly testing the server (you can press Ctrl-C to end it)

./startserver.sh -configfile=serverconfig.xml

Note that when you close the connection to the server, it will die.
Press Ctrl-C to kill the server.

Option 7.2: nohup

nohup will leave process in the background after you log out and it will output all information into nohup.out text file. Easy to use and no fuss.

nohup ./startserver.sh -configfile=serverconfig.xml &

Option 7.3: Screen

screen is left to run on the server after you log out. If you're new to screen, you may want to read how you can instruct screen with keypresses by reading the manual (man screen).

screen commands are given by pressing Ctrl+a and then followed by command key. You can "detach" the screen by pressing Ctrl+a and then pressing d-key. Sounds harder than it is.

screen cd 7daysded ./startserver.sh -configfile=serverconfig.xml # (press Ctrl+a and then d)

Section 7.3.1: About screen

To get back to your session, resume the screen:

screen -r

Note that you can easily kill the server by resuming screen session and pressing Ctrl-C.

For adventurous, Ctrl+a c makes new window and Ctrl+a n switches between them.

Multiple sessions on separate screens:

screen -list

There are screens on: 5399.pts-1.dogville (24.11.2019 17.54.05) (Detached) 3441.pts-1.dogville (24.11.2019 16.56.31) (Detached) 2 Sockets in /run/screen/S-zombiserv.

screen -r 5399

Type exit on screen to quit the screen (closes the terminal so screen quits).
exit [screen is terminating]
Step 8: Observe output_log.txt
After you have started the server, there is output_log-dateandtimehere.txt in the data-directory.

tail ~/7daysded/7DaysToDieServer_Data/output_log.txt

For reading whole log you may want to use less:

less ~/7daysded/7DaysToDieServer_Data/output_log.txt

Observing the log changes until you hit Ctrl-C

tail -f ~/7daysded/7DaysToDieServer_Data/output_log.txt # or watch -n 1 tail -n 15 ~/7daysded/7DaysToDieServer_Data/output_log.txt

Note: you will see same information if you'll access your server via telnet.

Mental note: If the uppercase letters and random timestamp numbers will cause heartburn condition for you, just edit startserver.sh to write it to somewhere more sensible place!

./7DaysToDieServer.x86_64 -logfile $SERVERDIR/log/server1-output.log -quit -batchmode -nographics -dedicated $PARAMS
Step 9: Observing server with telnet and killing the server
You may want to shutdown the server.

Step 9.1: Use telnet

If you set up telnet, you can log in with it and use "shutdown". See tips-section about safe use of telnet over internet.

telnet localhost 8081 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. *** Connected with 7DTD server. *** Server version: Alpha 18.1 (b8) Compatibility Version: Alpha 18.1 *** Dedicated server only build Server IP: Any Server port: 26900 Max players: 16 Game mode: GameModeSurvival World: RWG Game name: YourGameNameHere Difficulty: 3 Press 'help' to get a list of all commands. Press 'exit' to end session. (type exit to close telnet or type shutdown to save and close the server)

Step 9.2: You can't use telnet

You can kill the server process if you want to take server down right now. Note that server does autosave every minute, but it will lose the latest game information if you kill it.

ps wuax | grep 7Days (observe which is the server process id, e.g. 22222) kill 22222

In case server is stuck, crashed or in zombie state and does not want to die gracefully, use signal 9 SIGKILL:

# DESTROY the server, RAAAH! kill -9 22222
Step 10: Information about save game directory
After you have started your server, a new directory is created.

Server saves games into "hidden" directory on server account. Directory is named as .local (with dot).

It looks like this (tree -d .local):
tree -d .local/ .local/ └── share ├── 7DaysToDie │   └── Saves │   └── Joyofo Mountains │   └── fusrohdah │   ├── Player │   └── Region

If you have problems with spaces, you can always use TAB-key to autocomplete the name. Space characters should be shielded with \ or you should type "double quote marks" around the directory name.

If you change GameName in your serverconfig.xml, a new save game is created.

Game information is also saved on the player's computer.

Completely unrelated side note: you can transfer player inventories and even map world pieces between servers if you copy appropriate files to another save directory. Player inventories did work on earlier versions so you can "save" your character progress between maps. Same method works on single player Windows-games too. Chances are that something will be broken though, so don't be disappointed if your inventory is missing or character stats are gone.

About world generators: SiliconPenguin on comment section said that server saves the worlds to "server_folder/data/worlds/" folder and modifications are installed to "server_folder/mods". Save data location is unchanged though so you can find them under .local.

Step 11: Editing serveradmin.xml
There is serveradmin.xml file on the save game directory:

$HOME/.local/share/7DaysToDie/Saves/serveradmin.xml

If it's not there, it will be auto-generated on the first run. So you can generate the map on the first run and then close the server & edit the file.

You can change the admin config file name and relative path on serverconfig.xml if you want to specify the admin file per server or use common settings for all servers.

serveradmin.xml identifies admins by their long Steam ID-numbers. These same numbered files contain player data, located at the save game directory.

About long steam IDs, if you open your profile page with normal web-browser or use "copy this page url" from your profile page you'll find out what's yours. There are examples on serveradmin.xml file what those numbers look like (17 numbers at least).
Step 12: Backup
By now you're familiar with server files and scripts. You should do a backup of most important ones. Even just copying them to backup-directory saves lots of work if something happens. Here's simple backup example. To be safe, you should copy them from the server and store on your computer.

mkdir ~/backup cp ~/7daysded/startserver.sh ~/backup/ cp ~/7daysded/serverconfig.xml ~/backup/ cp ~/7daysded/serveradmin.xml ~/backup/
Step 13: Port forwarding, troubles connecting from the internet
Server reserves by default TCP port 26900 and UDP ports 26900, 26901, 26902 and additionally 26903 for LiteNetLib.

On official forum there is a list of used ports:
7days forum post 426481[7daystodie.com]

Additionally it reserves TCP 8081 for telnet and if you have webadmin enabled, it's on 8080.

So, you need to open up from your WAN/xDSL/router-device following ports:

Type
Number
TCP
26900
UDP
26900
UDP
26901
UDP
26902
UDP
26903

Do not open port 8081 used by telnet unless you're adventurous type and have the password set.

Also note that exposing game server to internet is security risk if there are any coding errors on the server. Oh well, our Internet of Things devices are already mining bitcoins so why not zombie-servers can't do that...

.. but joking aside, you should head to your router device control panel and create config like this:



If you scan your server with nmap, it should show something like this:

UDP scan: nmap -v -sU -T5 -p1024-60000 addr

This is example output:

PORT STATE SERVICE
26900/udp open|filtered hexen2
26901/udp open|filtered unknown
26902/udp open|filtered unknown

Appendix A: Using telnet
How to use telnet when you're logged on the server (on any user account)

telnet localhost portnumber

(e.g. telnet localhost 8081)

How to use telnet when you're in same LAN as server

You can install telnet from Turn Windows features on/off (at least in Win Pro version).

telnet yourlanserver 8081

You need to set the password for telnet connection, serverconfig.xml option TelnetPassword, otherwise it's not bound to other interfaces than to localhost (127.0.0.1).

Use telnet over the Internet with SSH-tunnel

If you have to use telnet over Internet, you probably want to do it in secure way. Also you should block connections the telnet port if your server is directly connected to the Internet. SSH-tunneling works too in that case. Following example tunnels server telnet port 8081 to your local port 2222.

ssh -N -f 7days@yourserver.dot.com -L 2222:yourserver.dot.com:8081 telnet localhost 2222

Tunnel stays open as long you keep your local computer on. See man 1 ssh for explanation about command line switches.

Note: sshd running on the server should be configured properly to allow forwarding.

You may want to check if you already have tunnel with netstat:

netstat -tupan

Kill SSH process off if you want to destroy the tunnel.
Appendix B: Error 267 for Windows-player
Windows-players can't join

Windows-player informs you that following message is shown on the game client console:

IOexception win32 IO returned 267 Path: c:\whatever

Error code 267 is simply: The directory name is invalid

Check your serverconfig.xml. If you used character : in the GameName, Windows-players can't join as it's illegal character for file- and pathnames. Game saves are also on the player's computer.

See http://support.microsoft.com/kb/177506 for more information.

Appendix C: crond server update
You can periodically run automatic updates. Valve has added some messy scripts on SteamCMD-page, but here's easy one:

Save this as myserverupdate.sh on 7days home dir:
#!/bin/sh cd /home/7days/ ./steamcmd.sh +runscript update_server.txt

Set executable flag. You can actually use plus-operator for user u but Steam censores this line so this works as replacement around censorship.
chmod u=rwx myserverupdate.sh


Create new textfile named update_server.txt:
@ShutdownOnFailedCommand 1 force_install_dir ./7daysded login anonymous app_update 294420 quit

Test your script and check that update does not overwrite your config files (move them around and change paths!)

Add the script in the cron (I'll assume you don't want vi-editor;-)
env EDITOR=nano crontab -e

You should see crontab for 7days account, add following line:
0 5 * * * /home/7days/myserverupdate.sh &

Now your server updates at 05 every morning. Adding server.pid to text file and sending kill to server with that pid would be nice addition, but if you have players in the server, that's too nasty.

Have fun, gg.
Appendix D: Wiping old saves
If you have used earlier versions, there are old save games on your server.

Release instructions for A20 required that you delete your old saves.

These are found on hidden directory .local including dot at the front which makes it hidden.

cd ~/.local/share/ rm -rf 7DaysToDie/

Which removes everything including player records. If you like to save your players data, you can go through the directory and delete only world related files.
Appendix E: A20 server crashes on old AMD hardware
Looks like A20 server won't work on old AMD hardware like AMD Phenom(tm) II X4 B55 Processor. Rest well, old work horse. Server version A19 works fine on Phenom. A20 server works fine on newer AMD processors, i.e. Ryzen-series.
Notes
If you want to add something constructive to this guide, please write to the comment section.

I'm not going to help you with basic shell command usage, you will find lots of guides and information on the internet. Please use the search engine.

Also unix command line tools will give you plenty of help with man commandname (q to quit help page) or just type the command and write switch --help after it.

Big thank you to following people for contributing: Red_Nalf, StockholmSyndrome, Zerock, Burnt Mummy, mambo05, KieSeyHow, SiliconPenguin, tifkat

Changes:
22.12.2014: original version
19.02.2018: added old/experimental builds install option.
24.11.2019: updated to 18.1
30.08.2020: tested on A19 and Ubuntu 20.04.
18.10.2020: removed notes about using real Steam user account on SteamCMD scripts
29.11.2020: tested on Ubuntu 20.10.
01.12.2020: serveradmin.xml notes updated
08.12.2021: updated to A20 b238
20.03.2022: confirmed A20 does work on AMD but not on old AMDs
25.05.2022: added port forwarding 26903 UDP for LiteNetLib.
07.10.2024: added Ubuntu package steamcmd information
171 件のコメント
Max Noskill  [作成者] 4月16日 9時49分 
@Bonzo72:
What comes to installing: Steam Depot lists "v1.4" as the string so I assume it's just changing v1.3 to v1.4. "latest_experimental" and "public" points also to same build ID which is 17990043 for v1.4 version. So you can use all of those.

https://steamdb.info/app/294420/depots/?branch=v1.4

Valve documentation confirms that syntax still is the same:
app_update <app_id> [-beta <betaname>] [-betapassword <password>] [validate]

So correct syntax is:
app_update 294420 -beta v1.4

And when I try out that command, the server downloading works.

You might have old server still running and it connects to that process?

I haven't updated this for "1.0" release as it was so depressing to see that their promised main quest updates never happened. TFP just played numbers game on versioning. Now they are pushing "2.0" release instantly just under a year of 1.0 release. :-I
Bonzo72 4月14日 14時19分 
Would someone be able to tell me the exact string format to use if I want to update my v1.3 server to 1.4? I have tried updating and it appeared to download and complete but after starting the server back up and trying to log in my client, I get an error saying they are still mismatched.
Client is 1.4 and server is 1.3. I must be missing something in this update process.
Thanks
Max Noskill  [作成者] 2024年10月8日 1時22分 
@McEngineer:
Well I haven't played much with mods and that's outside of this guide but someone on comments said that mods go directory named "mods" which is located under the server directory.

So for example depending where you installed your server your mod directory is:

$HOME/myserver/mods/

$HOME/.local/share/Steam/steamcmd/your_server_is_here/mods/
McEngineer 2024年10月7日 19時18分 
Hi @Max Noskill, how to install mod, currently im playing using mod launcher https://7d2dmodlauncher.org/ , and i want to create my own server
Max Noskill  [作成者] 2024年10月7日 13時28分 
@Limitless:
I think I might have guessed how and why. If you used Ubuntu package for steamcmd, install directory is inside hidden .dot-directory named ".local" and there under steam files.

So full path looks like this:
$HOME/.local/share/Steam/steamcmd/your_new_server_is_here/

I have added some instructions about this case.

If not, another reason could be that you have already (two) server(s) running, so check that, quit them and then update.
Limitless 2024年10月6日 11時54分 
In theory I have installed server version 1.0, but when I try to join the server is shows that server is on 1.1.

I used the command: app_update 294420 -beta v1.0

How to change the server version to 1.0 ? (On Steam given as: v1.0 - version 1.1 Stable)
F!r3w@lL [PL] 2024年9月12日 7時26分 
@Max Noskill Agreed thank you bud enjoy Tarkov :P
Max Noskill  [作成者] 2024年9月1日 4時35分 
@ F!r3w@lL [PL] : no prob, you may advertise as much as you want. :D
Steam is community platform, right?
Me... well, I have been playing only Single Player Tarkov-mod lately and working so pardon me if I don't connect to server. :D
F!r3w@lL [PL] 2024年8月28日 11時56分 
Super tutorial and it does run on Linux Debian 12 with standard run script - logfiles delete from xml file.

If anyone interested I do have VPN server running with spare Ram capacity hit me up with priv.

Author hopefully you are ok with dat if not please send me priv and I will amend this post :P haven't seen anything about add's :P
Max Noskill  [作成者] 2024年8月27日 11時24分 
@tifkat: https://steamdb.info/app/294420/depots/
and there seems to be build release time & build number included, so... newer = more fresh zombies