Skip to content

Dedicated Server: Set Up Your Dedicated Game Server as a Linux Service

Learn how to set up and manage dedicated game server services on Linux for seamless automation and easy control → Find out more

12 November 20263 min read76 Views0 helpful

Introduction

Services are an integral part of Linux. They are processes or applications that run in the background, either as predefined tasks or in response to events. This offers many benefits, such as automatically starting the server at boot, automatic server updates, easy management, and access to logs. In this guide, we'll show you how to create a service for your dedicated game server.

Before you begin

First, connect to your Dedicated Server via SSH. If you need help, follow our SSH Initial Access guide.

You should also follow one of our dedicated game server guides in this section to install and set up a game server on your Linux system. In this guide, we'll use the Palworld Dedicated Game Server as an example, but you can adapt the steps for any of our guides.

Create the service

Start by creating a new service file for your dedicated game server. Replace [your_game] with a suitable name. We recommend using the name of the game to keep things organized—in this case, palworld.service.

Code
sudo nano /etc/systemd/system/[your_game].service

Configure the service

With the Nano editor open, copy the following basic content. This service file template can be reused. We've provided two versions: one for guides that use SteamCMD and one for games that don't use SteamCMD.

Code
[Unit]
Description=[your_server] Server
Wants=network-online.target
After=network-online.target

[Service]
User=steam
Group=steam
WorkingDirectory=/home/steam/[your_server_folder]
ExecStartPre=/usr/games/steamcmd +force_install_dir '/home/steam/[your_server_folder]' +login anonymous +app_update [your_game_steamid] +quit
ExecStart=/home/steam/[your_server_folder]/[your_path_to_start_file]
Restart=always

[Install]
WantedBy=multi-user.target
Code
[Unit]
Description=[your_server] Server
Wants=network-online.target
After=network-online.target

[Service]
User=gameservers
Group=gameservers
WorkingDirectory=/home/gameservers/[your_server_folder]
ExecStart=/home/gameservers/[your_server_folder]/[your_path_to_start_file]
Restart=always

[Install]
WantedBy=multi-user.target

Here's a brief explanation of the key settings:

  • Description: Any description that helps you quickly identify the service's purpose.
  • User: Our guides set up either the steam user for SteamCMD or the gameservers user for games that don't use SteamCMD. If you're not following one of our guides, enter the user that should run the service here.
  • WorkingDirectory: The path to the main directory containing all the files the service needs.
  • ExecStartPre (SteamCMD only): Runs the SteamCMD installation command, which ensures the server is up to date every time it restarts. We recommend copying this from the relevant dedicated game server guide or replacing the values manually.
  • ExecStart: The command that actually starts the server. Copy the path from the relevant guide or adjust it manually.
Important

Wine compatibility For games that require the Wine compatibility layer, add the xvfb-run and wine commands to the ExecStart parameter. Here's an example for V-Rising:

Code
/usr/bin/xvfb-run wine /home/steam/V-Rising-Server/start_server.bat

Also make sure your ExecStartPre SteamCMD command includes the +@sSteamCmdForcePlatformType parameter if needed to force a platform version.

Once you've adjusted all the values for your dedicated game server, save the file by pressing CTRL + X, confirm with Y, and press ENTER to exit Nano.

Here's what the file looks like for our Palworld example:

Code
[Unit]
Description=Palworld Server
Wants=network-online.target
After=network-online.target

[Service]
User=steam
Group=steam
WorkingDirectory=/home/steam/Palworld-Server
ExecStartPre=/usr/games/steamcmd +force_install_dir '/home/steam/Palworld-Server' +login anonymous +app_update 2394010 +quit
ExecStart=/home/steam/Palworld-Server/PalServer.sh
Restart=always

[Install]
WantedBy=multi-user.target

Manage the service

Once you've created the service file, you need to enable it. In this example, replace [your_service] with palworld for palworld.service.

Code
sudo systemctl enable [your_service]
Tip

Whenever you make changes to the service file, run systemctl daemon-reload afterward to apply them.

Start the server with:

Code
sudo systemctl start [your_service]

You can also stop or restart the server with:

Code
sudo systemctl stop [your_service]
sudo systemctl restart [your_service]
Tip

To view service details, run:

Code
systemctl status [your_service]

To troubleshoot using logs, run the following command to view the latest entries:

Code
journalctl -u [your_service].service

If you no longer want the service to start automatically when the system boots, you can disable it:

Code
sudo systemctl disable [your_service]

Conclusion

You've successfully set up a service for your dedicated game server. The server will now start automatically when the system boots.

You've also learned how the service file is structured and how to manage the service using various commands.

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

A service offers benefits such as automatically starting the server at boot, automatic server updates, easy management, and access to logs.
Use 'sudo systemctl start [your_service]', 'sudo systemctl stop [your_service]', or 'sudo systemctl restart [your_service]'.
Yes. After changing the service file, always run 'systemctl daemon-reload' to apply the changes.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.