In this guide, you will learn how to setup your own “7 Days to Die” server (7D2D) on Ubuntu. Please note that this game is still “early access” and that the installation steps may change without notice as updates are released.
Ensure that you are logged in as the root user. 64-bit Ubuntu users need to install the 32-bit libraries.
dpkg --add-architecture i386
apt-get update
apt-get install libc6-i386 lib32gcc1 lib32stdc++6 -y
7D2D has very little output to the console. The option is up to you whether or not to use screen. If so, then you may need to install it.
apt-get update
apt-get install screen -y
Next, we want to create a user account for 7D2D to run under. We will also create a secure password.
adduser <choose a account name>
Switch to the newly created user account.
su <new account>
Download the steamcmd utility from the Steam website. This tool is also available on the Steam Wiki.
mkdir ~/steamcmd
cd ~/steamcmd
wget http://media.steampowered.com/client/steamcmd_linux.tar.gz
tar -xf steamcmd_linux.tar.gz
rm steamcmd_linux.tar.gz
Once this is done, make the steamcmd “executable”, and run it.
chmod +x steamcmd.sh
./steamcmd.sh
Once it loads, enter your login credentials. You may receive a Steamguard warning. You could also login anonymously with login anonymous
.
login <username> <password>
Warning: Your password is visible in plain text.
Set the installation directory and install the application.
force_install_dir ./7D2D
app_update 294420
quit
Edit startserver.sh
with your favorite text editor.
cd 7D2D
nano startserver.sh
Once this is open, replace:
./7DaysToDie.x86_64 -logfile 7DaysToDie_Data/output_log.txt $@
with:
./7DaysToDie.x86 -configfile=serverconfig.xml -logfile 7DaysToDie_Data/output_log.txt $@
Now, edit the config file:
nano serverconfig.xml
There are a few key settings in this file that you may want to modify.
Now is a good time to look through other settings that you may want to modify.
Time to start the server. If want to use screen, make sure that you are in the 7D2D directory.
screen -s 7D2D ./startserver.sh
Otherwise, start the server without screen.
./startserver.sh
If you have enabled telnet, you can type “shutdown” from the telnet window.
If you are running in screen, Ctrl + C will break it out and shut down.
If you are not running screen, run these commands.
ps aux | grep -i "7days"
kill <procid returned>
# or (case sensitive)
pkill 7Days
Everyone likes a new 7 days to die update. You can set to your 7D2D server to auto-update with a few steps. First, you need to create an update file with the steam login and update commands. Then, create a cron job to run it.
Start by creating the update file.
nano /home/<account name you name in first section>/serverupdate.txt
@ShutdownOnFailedCommand 1
login steamaccount steampass
force_install_dir ./7D2D
app_update 294420
quit
Save the file. Then, the update script.
nano /home/<account name you name in first section>/update.sh
#!/bin/sh
cd /home/<account name you made in the first section>
./steamcmd.sh +runscript updateserver.txt
Save the update script. Make the script “executable”.
chmod +x update.sh
Add a cron entry.
crontab -e
00 00 * * * /home/<account name you made in the first section>/update.sh
Save the crontab file.
Using your favorite text editor, create the following file: /usr/lib/systemd/system/7dtd.service
then add the following to it:
[Unit]
Description=7 Days to Die
After=network.target nss-lookup.target
[Service]
Type=simple
PIDFile=/run/7dtd.pid
ExecStart=<path to 7 Days to Die>/startserver.sh -configfile=serverconfig.xml
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target
After saving the file, you can use the systemctl
to start 7dtd
as follows:
systemctl start 7dtd
You can also set 7dtd
to start automatically when the server (re)starts using the following command:
systemctl enable 7dtd
At this point, you’re all set. Enjoy your 7D2D server!
If you restart your server, it will reset the game back to day 1.