Linux Server Setup Guide

Introduction

In this guide we will walk you through the complete start-to-finish setup and configuration of a 7 Days to Die dedicated server on Linux.

If you are looking at this, and are still up in the air about whether to choose Windows or Linux for you host OS, I’ll lay out some basics.

Pros

  • The dedicated server on Linux tends to perform on average 10-15% faster than on the same hardware in Windows 7-10. (This is partially due to the lack of a GUI interface, and also because of less junk running in the background. Linux also tends to utilize hardware more efficiently.)
  • A Linux dedi will give you more control over automatic restarts, and live server backups. (Note: backing up files on Windows while the server is active is likely to cause corrupted or incomplete backups due to limitations in the NTFS file system.)
  • Linux is free, and open source. There are many flavors to choose from to suit your level of knowledge.

Cons

  • The command line interface can be a little bit overwhelming for people who aren’t used to it. (You can use a desktop version of Linux, or install a GUI on the server version. You will lose some resource overhead and performance gains.)

Getting Started With The OS

The most commonly used versions of Linux for hosting are Ubuntu, Debian, and CentOS. You will want to get started by downloading the desired flavor, getting it onto a USB or DVD, and then installing the OS.

  • Ubuntu
    Easiest for beginners, or low maintenance servers, and requires very little input from the user during setup. Canonical allows for super easy OS updates without having to restart the server as much. Is based on Debian, and offers a lot of apps and assorted packages.
    https://ubuntu.com/download/server
  • Debian
    Probably the most versatile and feature-packed. Recommended for more advanced users that are familiar with the Linux OS. It’s a lightweight distro, so with will require a bit more setup and configuration to get it running. It’s more stable and secure than Ubuntu, but this can also lead to a lack of software support with new updates.
    https://www.debian.org/distrib/
  • CentOS
    This is based on Red Hat Enterprise Linux, and is extremely robust. It’s long been considered one of the best distributions. It’s the most widely used in the corporate IT world. It’s not real user friendly though, and is less compatible from the gaming and entertainment support perspective.
    https://www.centos.org/download/
  • TLDR
    If you’re new, and are still getting used to CLI and/or Linux go with Ubuntu.
    If you’re more familiar with working inside Linux, Debian or CentOS should be your prime choice.

Getting The Dedicated Server Installed

First, a small discussion about how we’re going to do this. There are a plethora of options for you here. You could just install SteamCMD and then use that to manually install the client and configure everything. You could use a Docker image you found pre-assembled somewhere. You could use Allocs Server Management Scripts. Or you can use Linux Game Server Manager.

From personal experience, the First choice is fine if you’re experienced, but it’s going to be a lot more work. It also isn’t as easy to manage.

The second choice is kind of like reaching your hand into a jar and hoping you pick your lucky number. Maybe the docker will be up to date, maybe it will have the tools you need, maybe it will just be a headache and worse than the first choice.

The Third option works OK if you only plan to run a single server. It will limit your capabilities with mods, and will limit your ability to expand later. It is a nice set of tools, and is fairly easy to use for beginners though.

The final Fourth option though is the most robust of them all. LGSM is open-source, is updated regularly, has excellent mod support, and comes with almost all the tools you will need for the basics. It’s additionally much easier to expand with more servers later if you desire.

As a result, we’re going to go with LGSM in this guide. I will walk you through the intricate details, and provide you with all of the tips and tricks I have build up over the years.

Prerequisites for Installation

Most of these are for features of the LGSM scripts to run, so you can trim them down if you want to. Things such as PostScript don’t need to be installed if you don’t plan on using email alerts for the servers. We will be providing you with the full package by default though. Always better to have too much, than too little. 🙂

I have listed the full command to install all of them. Just copy and paste into the command line. If the user account you will be using to install has SuperUser access, then you can skip this step as they will get installed with LGSM.

  • Ubuntu
    sudo dpkg –add-architecture i386; sudo apt update; sudo apt install mailutils postfix curl wget file tar bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc jq tmux lib32gcc1 libstdc++6 lib32stdc++6 steamcmd telnet expect
  • Debian
    sudo dpkg –add-architecture i386; sudo apt update; sudo apt install mailutils postfix curl wget file tar bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc jq tmux lib32gcc1 libstdc++6 lib32stdc++6 steamcmd lib32z1 telnet expect
  • CentOS
    yum install epel-release
    yum install mailx postfix curl wget tar bzip2 gzip unzip python3 binutils bc jq tmux glibc.i686 libstdc++ libstdc++.i686 telnet expect

Installing LGSM

  1. Create a user. Use a good password.
    adduser sdtdserver
    NOTE: sdtdserver is just a standard. I recommend using something unique to you. I name mine after the servers they will host. i.e. Zed Rising server is under zedrising user. I will highlight this word in the text where it’s the name of our user.
  2. Give the user account SU access. Not required, but is helpful.
    sudo usermod -a -G sudo sdtdserver
  3. Log into the user account.
    su – sdtdserver
  4. Download linuxgsm.sh with the following command.
    wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh sdtdserver
  5. Run the installer following the on-screen instructions.
    ./sdtdserver install

    Once this is complete, you will have the basics taken care of.

Server Configuration

Now we need to configure the settings for your server. Thankfully LGSM has already resolved the issue of updates wiping your server config! If you navigate to your dedi client folder (/home/sdtdserver/serverfiles), you will notice that there are two .xml files. serverconfig.xml is the default client config file, and we will not be using it at all.
The file we’re going to edit your server settings in is sdtdserver.xml. In this file you will configure the name of the server, and the other intricate details. (Line 36 with the option “TerminalWindowEnabled” will not have any effect since that is an option for the Windows launcher.)

If you want to add information to the “ServerDescription” or “ServerLoginConfirmationText”, you can have a little fun with that. You are able to use the text with line breaks as you would like for it to appear, and can even add colors using hex codes.

“[03F1F5]A 7 Days to Die server[-]” in your Description, will appear like A 7 Days to Die server in the server detail listing. The first set of brackets contain the hexadecimal color code, and the brackets with the minus sign tell it to end the color.

Once you’re done with your server configuration, it’s time to go poke at the LGSM configuration for the server.
You will want to navigate to /home/sdtdserver/lgsm/config-lgsm/sdtdserver. There you will notice three files. _default.cfg, common.cfg, and sdtdserver.cfg. First you will want to copy all of the information inside of _default.cfg to common.cfg because the common file is empty by default. This is the file that will be used for our configuration though, so you need to set it up. If you are still using just the text interface, you can use the command “cp _default.cfg common.cfg”.
Inside of this file you can configure notification alerts for your servers activity. I recommend setting line 82 to “on” for update on Start so that when your server starts up it will check for updates to the client, and automatically install them. You would want this switched to Off if you wish to stay on the current branch, and do not want to update when a client update is pushed. If you wish to set the server to use a specific branch of the client, you can configure that on line 109. Options would be similar to “-latest_experimental” or “-alpha10.4”. It will use this argument when running SteamCMD to download or update the server. For information on how to configure all of the option in this file, you can find the documentation on it here.

Now you aren’t quite done yet. We want to set up a few more things so your server will always be up and running and ready. For the next step, we’re going to set the server up to run at boot. First you will create the file by typing “vi /etc/systemd/system/sdtdserver.service”
Then you will enter the following text into this file.

[Unit]
Description=LinuxGSM 7 Days to Die Server
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
User=
sdtdserver
WorkingDirectory=/home/
sdtdserver
ExecStart=/home/
sdtdserver/sdtdserver start
ExecStop=/home/
sdtdserver/sdtdserver stop
Restart=no
RemainAfterExit=yes #Assume that the service is running after main process exits with code 0

[Install]
WantedBy=multi-user.target

Once you’ve entered the text, save it by pressing the Escape key, and then entering zz.
Next you will type the command “systemctl daemon-reload” to update the system to include this file.
Now you can do

  • systemctl start sdtdserver
    This will start the server
  • systemctl stop sdtdserver
    This will start the server
  • systemctl enable sdtdserver
    This will enable the ability to auto-start the server when the system boots.
  • systemctl disable sdtdserver
    This will disable starting on boot

But wait! There’s MORE!
Now you want to enable the monitoring script. Running the monitor script will check that your server is up and running. If the script is unable to find your server active, it will automatically restart it for you. This is especially valuable for scheduled restarts, and for recovering from crashes.
To schedule this, we’re going to have it run once every 2 minutes, and we’re going to set it up in Cron. To open cron use the command “crontab -e” and it will open the cron configuration in the file editor. Enter the following line
*/2 * * * * su – sdtdserver -c ‘/home/sdtdserver/sdtdserver monitor’ > /dev/null 2>&1
Once that line is entered, save and exit the editor.
If you are running the server on a lower-spec machine, you may want to set the command to run every 3 minutes instead. Simply change the first number in that line from a 2 to a 3.

Running your server

Yes, we are finally there! You’re now all set up and ready to start your server. You can either fire it up by using the systemctl commands from above, or you can use “./sdtdserver start” from the home folder of the user account. You can view the full list of commands by typing “./sdtdserver” or via the LGSM page here.

Enjoy hosting your server!

Both comments and pings are currently closed.

Comments are closed.

Powered by WordPress

7 Days to Die Admin Coalition