Running a Dedicated Server for Unturned on Linux

In this tutorial, we will show you how to set up a dedicated server for Unturned on a Linux-based operating system.

Unturned Dedicated Server Linux

Unturned is an entirely free-to-play multiplayer game where you must survive in a world ravaged by zombies.

One of the key features of Unturned is that it is possible to play this game with up to 48 players on one server. However, the recommended number of players is typically 24 as the server becomes more unstable under higher limits and requires significantly more resources to process.

Thanks to the development team putting out Linux versions, self-hosting an Unturned server on Linux is a relatively simple process. With the game being completely free, anyone can easily self-host an Unturned server. You will, however, at least need a Steam account as you require a “Game Server Login Token” if you want your server to be accessible over the internet.

A key advantage of using Linux to self-host your Unturned server is that it typically allows you to get more out of your hardware as it typically has a lower overhead. This is especially true if you are using a server optimized operating system such as Ubuntu server.

Installing and Starting the Unturned Dedicated Linux Server

By the end of the following few sections, you should have an Unturned server up and running on your Linux machine.

These steps have been written with a Debian based system such as Ubuntu in mind, but they should work with other Linux operating systems with only minor changes.

If you are hosting the Unturned server from within a home network, you will likely need to port forward ports 27015 and 27016. Additionally, you will need to unblock both ports if you are using a firewall.

Preparing your System

1. Before we get too carried away, our first step is to ensure our package list cache and packages are up to date.

If your system uses the apt package manager, you can perform both tasks by running the following two commands in the terminal.

sudo apt update
sudo apt upgrade -y

2. Your next step is to install the “screen” package by typing in the command below.

We will use this package to keep the Unturned server running within a virtual screen on our Linux device. This will allow us to easily issue commands to the server to shut it down safely.

sudo apt install screen

3. With screen installed, you must now install steamcmd on your Linux device. This tool will allow us to download and update the Unturned server easily.

We highly recommend our installation guide if you don’t have this tool installed already.

https://pimylifeup.com/linux-steamcmd/

Creating a User to Run the Unturned Dedicated Server on Linux

4. After installing SteamCMD, we can move on to creating a user that we will use to run the Unturned dedicated server on our Linux system. This isn’t necessarily required but it is typically good practice to run server software like this under its own user to keep it somewhat isolated.

Use the useradd command within the terminal to create a user called “unturned“. We use the “-m” option with this command to create a home directory for our new user.

sudo useradd -m unturned

Please note that if you decide not to create the “unturned” user you will need to make several adjustments to the tutorial later on.

5. Once the user has been created, we will want to change to it temporarily by running the command below.

We are swapping to this user while we download the Unturned server to our Linux machine. This helps ensure that we will avoid weird permission issues later.

sudo -u unturned -s

6. Now that we are running the terminal as the “unturned” user, we will want to swap to their home directory using the cd command followed by the tilde symbol.

cd ~

Downloading and Installing the Unturned Server

7. We are finally at the point where we can download and install the Unturned dedicated server to our Linux machine.

The SteamCMD tool that we installed earlier in this tutorial makes this process significantly easier. To install the Unturned server in the “/home/unturned/server” directory, run the following command.

/usr/games/steamcmd +@sSteamCmdForcePlatformType linux +force_install_dir /home/unturned/server +login anonymous +app_update 1110390 +quit

This same command will also update the server to the latest version. Just ensure the server isn’t already running.

8. With the server now installed, you can exit back to your normal user by using the command below.

exit

Writing a Service to Manage the Unturned Server on Linux

9. Our next step is to begin to write a Systemd service. This service will start the Unturned dedicated server when our Linux system boots and is also what you will use to start the server.

To begin writing this service file, use the following command within the terminal. We are using the nano text editor as it is one of the easier terminal text editors to use.

sudo nano /etc/systemd/system/unturnedserver.service

10. Within this file, you will want to enter the following lines. These lines basically dictate how the service is handled and how it will start and stop your Unturned server.

We have an extra line within this file that will automatically check for updates before the server is started.

In addition to this extra line, there is a placeholder that you must replace:

  • <SERVERNAME>: Replace this placeholder with the name that you want to use for your Unturned server. For example, “Pimylifeup“.
[Unit]
Description=Unturned Dedicated Server
After=network.target

[Service]
Type=forking
User=unturned
Group=unturned
WorkingDirectory=/home/unturned/server
ExecStartPre=/usr/games/steamcmd +@sSteamCmdForcePlatformType linux +force_install_dir /home/unturned/server +login anonymous +app_update 1110390 +quit
ExecStart=/bin/screen -dmS unturned-server /home/unturned/server/ServerHelper.sh -ThreadedConsole +InternetServer/<SERVERNAME>
ExecStop=/bin/bash -c 'screen -S unturned-server -p 0 -X stuff "save^Mshutdown^M"; tail --pid=$MAINPID -f /dev/null'

KillMode=process
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

11. Once you have finished writing the service file, you can save and quit by pressing CTRL + X, followed by Y, and then ENTER.

Starting up the Game Server

12. With the service written, you can now enable it so that the service will automatically start the Unturned dedicated server when your Linux system powers on.

Enabling the service is as simple as using the following command within the terminal.

sudo systemctl enable unturnedserver

13. After enabling the service, you can start up the Unturned server by running the command below within the terminal.

sudo systemctl start unturnedserver

Generating a Game Server Login Token

14. Before you can access your Linux-based Unturned Dedicated server over the Internet, you will need to generate what is called an “Steam Game Server Login Token“.

You can generate this token by going to the Steam manage game servers page, logging in, and then filling out the App ID with “304930“.

The memo can be set to whatever you would like, but it is best to set this to something that you can easily track this particular code with.

Please note that your account will need to have claimed the Unturned game before Steam lets you generate a server token for it.

https://steamcommunity.com/dev/managegameservers

Once you have generated a code, keep it handy as you will need it in the next step.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Modifying the Unturned Linux Dedicated Server Configuration File

15. Since we are making changes to the server’s configuration, you will need to temporarily take it offline by using systemd to stop the server.

sudo systemctl stop unturnedserver

16. You can begin editing the Unturned Linux server’s configuration file by running the following command within the terminal.

Replace “<SERVERNAME>” with the name you wrote for your service file.

nano /home/unturned/server/Servers/<SERVERNAME>/Config.json

17. Within this file, you should find the following option near the top of the file.

You will want to update this line to include the token you generated earlier in the guide.

    "Login_Token": "",

An example of an updated login token might look like is what we have shown below.

    "Login_Token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",

18. With the login token now set, you can browse through the rest of the file and tweak all the settings you like. Using these, you can completely tweak how your Unturned server will play.

19. Once you have finished modifying the configuration file, you can save and quit by pressing CTRL + X, Y, and then ENTER.

20. You will now want to bring your Linux Unturned server back online by running the command below.

sudo systemctl start unturnedserver

Conclusion

By this point in the tutorial, you should have the Unturned dedicated server up and running on your Linux system.

Unturned is a fun and completely free multiplayer survival game. While you can play this as a single player game, it is even better when played with others. It even has multiple game modes, such as arena.

Please feel free to leave a comment below if you have had any issues with getting this server up and running.

If you found this tutorial helpful, we recommend browsing through a list of game servers that you can self-host on Linux.

Leave a Reply

Your email address will not be published. Required fields are marked *