Posted on Apr 11, 2021 by kingbeowulf
This guide will assist in setting up a Valheim Dedicated Server (VHDS) on Slackware64-current. This procedure should also work on Slackware6-14.2, although additional prerequisites may be required. The process is similar to setting up a Half-Life Dedicated Server (HLDS) with one important simplification. We will be using LinuxGSM: the Linux Game Server Manager.
LinuxGSM is a command line tools written in BASH to greatly simplify and streamline the installation of Linux dedicated game servers. The instructions are easy and straightforward.
Prerequisites
---------------
The VHDS is x86_64 while SteamCMD is 32-bit. Thus, we need to convert Slackware64 to Slackware64-multilib. Instructions for doing so are described in "Adding Multilib Capability to Slackware on x86_64 Architecture". If you've set up the Steam Client on Slackware64, then you are familiar with this process.
As the 'root' user, you first create a dedicated user account under which SteamCMD ann VHDS will run.
1# groupadd steam 2# useradd -g steam -m -d /home/steam -c "Steam server account" -s /bin/bash steam
Then set a password for the new “steam” account:
1# passwd steam
For convenience, symlink 'ip' and 'ethtool' so that the steam user can access these tools, since we are not going to use 'sudo', and to squash the resulting errors and warnings. For some reason the LinuxGSM scripts to not use the full file path which would make this step necessary. I might submit a bug/feature request about this.
1# ln -s /sbin/ip /bin/ip 2# ln -s /usr/sbin/ethtool /usr/bin/ethtool
Valheim server uses anonymous login. Other servers will prompt for a Steam login. You can create a new Steam user dedicated to running servers. Recommended. Do not use your current Steam Client login. You can place the Steam login credentials into $HOME/lgsm/config-lgsm/<servername>/secrets-{common|<servername>}.cfg, but note that these credentials are stored in plain text.
1## SteamCMD Login 2steamuser="username" 3steampass="password"
Now we are ready to Install LinuxGSM. This will install SteamCMD automatically as needed. Login as our 'steam' user, and download LinuxGSM, and install:
1$ cd $HOME 2$ wget -O linuxgsm.sh https://linuxgsm.sh 3$ chmod +x linuxgsm.sh
You can get a list of all available servers with:
1$ ./linuxgsm.sh list
Now to install out Valheim server:
1$ ./linuxgsm.sh vhserver 2$ ./vhserver install
Now you have the following in your 'steam' user home directory, as well as a '.steam' for the SteamCMD files:
1$ tree -d -L 3 2. 3├── lgsm 4│ ├── backup 5│ │ └── script 6│ ├── config-default 7│ │ └── config-lgsm 8│ ├── config-lgsm 9│ │ └── vhserver 10│ ├── data 11│ ├── functions 12│ ├── lock 13│ └── tmp 14├── log 15│ ├── console 16│ ├── script 17│ └── server -> /home/steam/serverfiles/Saved/Logs 18└── serverfiles 19 ├── Saved 20 │ └── Logs 21 ├── linux64 22 ├── steamapps 23 │ ├── downloading 24 │ ├── shadercache 25 │ └── temp 26 └── valheim_server_Data 27 ├── Managed 28 ├── MonoBleedingEdge 29 ├── Plugins 30 └── Resources
Next, You'll want to adjust the default configuration to set up the server parameters. '~/lgsm/config-default/config-lgsm/' contains the default and example configurations. Leave the _default.cfg alone as they will be overwritten on updates. Each lower layer overrides the previous one. This is so that you can set up multiple independent servers.
In the '~/lgsm/config/lgsm/vhserver' directory, copy _default.cfg to common.cfg and customize as needed. Since we are running just one Valheim server, we can stuff everyting into common.cfg. Whan runnign multiple servers, the common parameters are here, and parameters specific to each server is on secrets-<server name>.cfg and <server name>.cfg. Set up the server parameters (customize as needed):
1#### Game Server Settings #### 2 3## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters 4servername="<Server name>" 5serverpassword="<server password>" 6port="2456" 7gameworld="${selfname}" 8public="1" 9ip=<server local LAN IP>
The rest you can leave at the defaults, or customize as needed.
I recommend setting the PC running the server to a fixed IP on your home network. Port=2456 (UDP) is the default; change as needed. Next, open your router's firewall or use port forwarding for port range 2456-2458 (UDP). Note that the port specified in the configuration is the start of a port triplet. When connecting via the Steam client, the Valheim in game community browser can be a bit finicky. You can explicitly set the server IP via the Steam Client View -> Servers -> Favorites -> Add a Server and enter the <server IP>:<port+1>
NOTE: This is the external, or direct, IP from your internet service provider. This will not necessarily be the IP in config.cfg if you are behind a router/cable modem etc.
[Update: The in-game server browser has improved a bit, but can still take some time to find your server. There is now a button for direct IP entry.]
Now run the server:
1$ ./vhserver start
Just running 'vhserver' will provide a list of commands. View server information with:
1$ ./vhserver details
This will provide your external IP. A number of server commands are available (see References). Valheim specific information is located: ~/serverfiles/Valheim Dedicated Server Manual.pdf
https://docs.linuxgsm.com/steamcmd
https://linuxgsm.com/lgsm/vhserver/
https://docs.linuxgsm.com/commands
https://docs.slackware.com/howtos:games:halflife_dedicated_server
Contact:
Try a nice upgrade from EVGA and get a discount!
Tired of Steam, Epic and other rip-off game "stores"? Check out Humble Bundle for your digital download needs! A portion of your hard-earned gaming cash goes to charity.
King Beowulf's Humble Bundle Referral Code