Skip to content

Example Linux Valheim Server Setup Workflow

Mythic edited this page Feb 23, 2023 · 6 revisions

This page is a dedicated to documenting an example workflow for setting up and using a Valheim server using TCLI's mod management. It is kind of a step by step guide, but I am assuming a few things, like that you know how to get files to and from your server in some way. This will have most of its focus placed on the specifics of running the server via TCLI specifically. With that disclaimer of sorts out of the way, let's get started.

There are two main prerequisites to use TCLI on your server, those being:

  • A way to get the server files, for Valheim I'm going to be using steamcmd.
  • The TCLI files (both tcli and tcli-bepinex-installer) which can be found in the releases.
    • Note: The dotnet distribution does not yet include mod management capabilities. You must download a release archive & extract it manually to a location which is in your path, e.g. the directory you run the commands in, or /usr/local/bin

With both of those on your server somewhere, just move into the main directory you want to hold your mods in.

My command line sections are going to look like this:

# aaronr @ aaron-arch in ~/valheim_example
$ 

The first line shows my username and the folder I'm in, the second line will show the command I execute. Everything after that will be the output.

So, first, I'm going to be installing Valheim using steamcmd. steamcmd will place its files wherever you run it for the first time, so I'd recommend having it in its own folder, here steam.

# aaronr @ aaron-arch in ~/valheim_example/steam
$ steamcmd
Redirecting stderr to '/home/aaronr/.local/share/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation - version 1676336512
-- type 'quit' to exit --
Loading Steam API...OK

Steam>force_install_dir /home/aaronr/valheim_example/valheim_server

Steam>login anonymous

Connecting anonymously to Steam Public...OK
Waiting for client config...OK
Waiting for user info...OK

Steam>app_update 896660'
 Update state (0x1) running, progress: 0.00 (0 / 0)
 Update state (0x61) downloading, progress: 0.78 (10485760 / 1350315922)
// a lot more downloading messages
 Update state (0x81) verifying update, progress: 98.80 (1334104282 / 1350315922)
Success! App '896660' fully installed.

Steam>exit

Notice how I used an absolute path for force_install_dir instead of a relative one, Steam can place things really weirdly when you use relative paths. This is now what my directory structure looks like:

# aaronr @ aaron-arch in ~/valheim_example
$ exa -TL 2 ~/valheim_example
/home/aaronr/valheim_example
├── steam
    ├── steamcmd
    └── a bunch of steam files in here (these won't exist if you've previously installed steam, it will use that installation instead)
├── tcli
├── tcli-bepinex-installer
└── valheim_server
   ├── docker
   ├── docker_start_server.sh
   ├── linux64
   ├── LinuxPlayer_s.debug
   ├── start_server.sh
   ├── start_server_xterm.sh
   ├── steam_appid.txt
   ├── steamapps
   ├── steamclient.so
   ├── UnityPlayer.so
   ├── UnityPlayer_s.debug
   ├── valheim_server.x86_64
   ├── valheim_server_Data
   └── Valheim Dedicated Server Manual.pdf

Now that I have the server files, it's time to do the fun part of installing mods. The first thing to do is to point TCLI to where your server files are (please note this currently uses valheim as the game identifier, this will probably change eventually, as valheim should belong to the normal game instead of the server):

# aaronr @ aaron-arch in ~/valheim_example
$ ./tcli import-game valheim --exepath valheim_server/valheim_server.x86_64 
Successfully imported Valheim Dedicated Server (valheim) with install folder "/home/aaronr/valheim_example/valheim_server"

For this example I'm just going to install the (as I'm writing this) most downloaded modpack on valheim.thunderstore.io, EpicValheim.

# aaronr @ aaron-arch in ~/valheim_example
$ ./tcli install valheim EpicValheim-EpicValheim-4.1.5
Downloading main package: EpicValheim-EpicValheim
18/18 dependencies downloaded ✓
Installed mod: denikson-BepInExPack_Valheim-5.4.1901
Installed mod: pipakin-SkillInjector-1.1.1
Installed mod: ValheimModding-Jotunn-2.10.4
Installed mod: RandyKnapp-EpicLoot-0.9.8
Installed mod: Huntardys-EpicValheimsAdditions-1.9.2
Installed mod: remmiz-SimpleRecycling_Fixed-0.0.15
Installed mod: WackyMole-WackyEpicMMOSystem-1.5.5
Installed mod: JereKuusela-Expand_World-1.22.0
Installed mod: JereKuusela-Server_devcommands-1.41.0
Installed mod: JereKuusela-Upgrade_World-1.32.0
Installed mod: neurodr0me-RRRCore-2.14.0
Installed mod: neurodr0me-RRRMonsters-2.2.1
Installed mod: ASharpPen-Drop_That-2.3.5
Installed mod: ASharpPen-Spawn_That-1.2.2
Installed mod: WackyMole-WackysDatabase-1.4.2
Installed mod: ASharpPen-This_Goes_Here-2.1.1
Installed mod: AzuRe-Spawner_Tweaks-1.8.0
Installed mod: Digitalroot-Better_Trader_Remake-2.2.7
Installed mod: EpicValheim-EpicValheim-4.1.5

Alright, now mods are installed for the server. All we've got to do is start it! I'm just going to modify the example start_server.sh they provide with Valheim slightly to get it to run through tcli, then place it in our valheim_example folder.

# aaronr @ aaron-arch in ~/valheim_example
$ bat -p start_server.sh
#!/bin/bash

# valheim wants to be in its own directory, so we move there
cd valheim_server

export templdpath=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
export SteamAppId=892970

echo "Starting server PRESS CTRL-C to exit"

# NOTE: Minimum password length is 5 characters & Password cant be in the server name.
# NOTE: You need to make sure the ports 2456-2458 is being forwarded to your server through your local router & firewall.
../tcli run valheim --  -name "My server" -port 2456 -world "Dedicated" -password "secret" -crossplay

export LD_LIBRARY_PATH=$templdpath
cd ..

After all that, the server can simply be started with ./start_server!

Clone this wiki locally