Overview
Step-by-step guide: installing 7 days to die dedicated server on Linux.
Foreword
This guide is for 10.4 b9. Update to alpha19 release.
Guide is for Ubuntu systems as that’s what Valve is supporting. However, it’s extremely easy to install this on RedHat systems too.
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.
Step 1: Log in to your server with SSH
Step 2: Choose account for 7days dedicated server
You can skip this step.
This requires you have root access.
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, let’s install text editor nano (if it already isn’t installed).
Otherwise just use whatever editor suits you.
As you can’t daemonize the server with command line switches, you most likely want to install screen.
There is also byobu which offers more functionality, but screen is no-brainer.
Step 3: Install SteamCMD
Download SteamCMD:
Open the package:
Remove install package:
Note: if you don’t have wget installed, you can install it:
Problems running steamcmd? You might need to install lib32gcc1:
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.
SteamCMD shell appears after a while and you can type commands in SteamCMD prompt. Note that SteamCMD prompt always begins with Steam>.
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.
Experimental and old server builds:
You can see available server builds from Steam:
Go to Library > Tools > 7days > Properties > Beta
Old build:
Note that’s “alpha13.8” without spaces!
Latest experimental:
Revert to current build from old:
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.
Size 8192×8192 map takes about:
It should write information about generation on logs. If not, restart the server as it’s stuck. And yes, generation is single thread.
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.
Note that when you close the connection to the server, it will die.
Press Ctrl-C to kill the server.
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.
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.
Section 7.3.1: About screen
To get back to your session, resume the screen:
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:
Type exit on screen to quit the screen (closes the terminal so screen quits).
Step 8: Observe output_log.txt
After you have started the server, there is output_log-dateandtimehere.txt in the data-directory.
For reading whole log you may want to use less:
Observing the log changes until you hit Ctrl-C
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!
Step 9: Observing server with telnet and killing the server
You may want to shutdown the server.
If you set up telnet, you can log in with it and use “shutdown”. See tips-section about safe use of telnet over internet.
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.
Server is stuck, crashed or in zombie state and does not want to die gracefully:
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):
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 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.
Step 11: Editing serveradmin.xml
There is serveradmin.xml file on the save game directory:
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.
Step 13: Port forwarding, troubles connecting from the internet
Server reserves by default TCP port 26900 and UDP ports 26900, 26901 and 26902.
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:
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
PORT STATE SERVICE
26900/udp open|filtered hexen2
26901/udp open|filtered unknown
26902/udp open|filtered unknown
Appendix A: Using telnet
(e.g. telnet localhost 8081)
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.
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:
Kill SSH process off if you want to destroy the tunnel.
Appendix B: Error 267 for Windows-player
Windows-player informs you that following message is shown on the game client console:
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 [link] 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:
Set executable flag. You can actually use plus-operator for user u but Steam censores this line so this works as replacement around censorshop.
Create new textfile named update_server.txt:
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;-)
You should see crontab for 7days account, add following line:
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.
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
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