How to set up a Valheim dedicated server with LinuxGSM

LinuxGSM (short for Linux Game Server Management) is an open source game server creator and manager, running in Linux (of course). The tool was designed to be as simple and lightweight as possible, enabling gamers spend less time on management and more time entertaining. While not having an eye-catching graphical interface, LinuxGSM makes it up with a huge number of games supported, as well as automatic updates, server monitoring, and a bunch of other awesome features.

Valheim has been one of the dark horses in the gaming industry in the recent years. The Viking-themed co-op survival phenomenon game quickly rose in popularity and surpassed 6 million sold units in merely a time span of six weeks.

In this article, we will guide you through the process of setting up a full-fledged Valheim dedicated server with LinuxGSM in just a couple of minutes. Using LinuxGSM is going to save you a few hours installing, customizing and optimizing with Valheim Dedicated Server Tool. The machine in the test runs Ubuntu 20.04 LTS, has 4 GBs of RAM and 2 Xeon E5-2670 CPU cores.

Prerequisites

The following requirements are unofficial, but are the general consensus amongst official Helpers in the Valheim Discord. You may still be able to run a playable dedicated server using less but to maintain good performance, this is a good starting point.

  • 2vCPU or higher
  • 4 GB RAM or higher
  • 100Mbps connection or higher. A server near your location is better.
  • Ubuntu, Debian or CentOS. Other Linux distros are not officially tested with LinuxGSM and may not work as intended.
  • Most of the server plans offer a few hundreds GBs of bandwidth, opt for a value higher than 100GB.
  • Port forwarding if you're operating from a home lab with NAT.

Please note that the more players you have, the higher these requirements will need to be to sustain performance.

I've had great performance with Vultr cloud-based VPS. If you're not sure about which provider to use, choose Vultr, its price, specs and locations are great as a starting point.

Install LinuxGSM depencies

Before install the actual game server manager, you need to install all the packages it relies to.

In order to do that, connect to your server through SSH (Linux) or Putty (Windows), log into an user with root privileges and run the following command.

sudo dpkg --add-architecture i386; sudo apt update; sudo apt install curl wget file tar bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc jq tmux netcat lib32gcc1 lib32stdc++6 libsdl2-2.0-0:i386 steamcmd
Code language: CSS (css)
LinuxGSM depencies

If you're asked anything, just proceed by pressing Enter or select OK button for SteamCMD.

Running Debian or CentOS? Copy the command to install LinuxGSM depencies here : https://linuxgsm.com/lgsm/vhserver/

Create an user for LinuxGSM

As a security best practice, you should create a new, dedicated user for running LinuxGSM only.

sudo adduser vhserver

Following the prompt, you will be asked to provide password for the newly-created user along with other details. You should choose a strong and random password for better security.

You can also choose a different name for the user as it does not affect LinuxGSM, for example vhdedi.

Run LinuxGSM installation script

After creating vhserver user, we switch to it by the following command

su - vhserver

Please do note that there are two spaces before and after the hyphen.

image-20210322161627665

In the new prompt, copy and paste the following command into it.

wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh vhserver
Code language: JavaScript (javascript)

The command will automatically download the installation script, give it permission to run as an executable and call the script with vhserver argument.

vhserver_1

Once you see "Installed Valheim server as vhserver", that's when LinuxGSM has finished installing the script to automatically set up and manage Valheim. Type the following command into the prompt to proceed with the actual Valheim dedicated server installation.

./vhserver install

Now vhserver script we've just grabbed will begin the preparation. Wait until you see Continue? [Y/n] along with information about the installation script, then input Y and press Enter. You may want to grab yourself a cup of coffee as this process is pretty long.

In the end of the installation, it will ask if SteamCMD successfully downloads the game data and whether you want to send anonymous server information back to LinuxGSM development team. Depend on your setup, you may answer them accordingly.

Manage Valheim dedicated server created by LinuxGSM

In order to start the server, use the following command :

./vhserver start

Call vhserver with details argument and you will see information about the server status, configuration path, command line parameters, IP, ports, etc.

vhserver details

LinuxGSM has a bunch of other useful commands that allows for easier management of the Valheim server.

commands

Changing Valheim server name

LinuxGSM stores its configuration files in lgsm/config-lgsm directory. Each game server have their own subdirectory inside config-lgsm. Please make sure you're in the home directory where you've got LinuxGSM installed and run the following command to edit _default.cfg config file:

nano lgsm/config-lgsm/vhserver/_default.cfg
linuxgsm-valheim-config

In this file you will find all settings related to your Valheim servers. Every new Valheim server you spin up uses this set of settings. You can not edit _default.cfg directly because it would be overwritten the next time the server starts. Instead, you have to edit another configuration file called vhserver.cfg.

Most of the time, people runs one single Valheim server instance only. In this case, you need to determine which settings you want to change and copy them to another file. For example, we want to change the server name, so servername is the parameters we need.

Once you've created a list of parameters, you have to put it in lgsm/config-lgsm/vhserver/vhserver.cfg. run the following command to open it up.

nano lgsm/config-lgsm/vhserver/vhserver.cfg

When you're done, press Ctrl+O to write the changes to disk.

After changing things, you have to restart LinuxGSM server to load the new configuration. In order to do so, run the following command :

./vhserver restart

Alternatively, if you want to run multiple Valheim servers, edit vhserver.cfg instead of _default.cfg. You will be able to add another Valheim server with the same LinuxGSM installation later by running bash linuxgsm.sh vhserver. Newly added servers will be appended with a number to separate it from the others. For example, running bash linuxgsm.sh vhserver for the second time will create ./vhserver-2 management file and vhserver-2.cfg configuration file.

nano lgsm/config-lgsm/vhserver/vhserver.cfg

vhserver.cfg is empty, any flag you add to this file will supplant what was specified in _default.cfg. In the example below, I'll replace the default server name from _default.cfg with LinuxPip.

linuxgsm-valheim-vhserver-config

Save the file, now you need to start the actual server by running the following command.

./vhserver start

Starting a Valheim server usually takes about a minute or so, sometimes longer if you runs LinuxGSM on a low-end CPU. I used the default port 2456 in the config, so the port for Steam would be 2457 (2456 plus 1). Adjust for your configuration accordingly.

image-20210323103042116

Troubleshooting

  1. Where is LinuxGSM Valheim config file located?

    Default config : lgsm/config-lgsm/vhserver/_default.cfg
    Customized config : lgsm/config-lgsm/vhserver/vhserver.cfg

  2. How to fix "[ fail ] starting vhserver: executable was not found"?

    Reinstall Valheim server instance might be the quickest solution. First, you have to check whether linuxgsm.sh is present. If it is, then run it using this command : bash linuxgsm.sh vhserver

  3. How to integrate LinuxGSM with mods like Valheim Plus?

    At the moment, the only way to integrate mods for Valheim into LinuxGSM is through hacks. The methods change quite often, you may see the latest updates and guides at https://github.com/GameServerManagers/LinuxGSM/issues/3287

  4. What are the system requirements for running Valheim dedicated server ?

    We've covered that in the article. TL;DR : 4-core CPU, >2GBs of RAM and runs a supported OS.

Click to rate this post!
[Total: 1 Average: 5]

1 thought on “How to set up a Valheim dedicated server with LinuxGSM”

Leave a Comment