Valheim is a co-op survival game for up to 10 players per world. A dedicated server keeps your world online when the host player logs off, and gives everyone the same low latency. The server runs well on Linux, and it’s easy to set up with SteamCMD or Docker.

Requirements

  • 2 vCPU and 4 GB RAM for a small group. Large, heavily built worlds benefit from 4 vCPU and 8 GB.
  • Single-thread CPU speed matters more than core count.
  • UDP ports 2456–2457 open.
  • A server location near your players. Latency matters more than raw bandwidth. See choosing a VPS location and game server VPS.

Install SteamCMD (Ubuntu/Debian)

sudo dpkg --add-architecture i386        # Debian: also enable the non-free repository
sudo apt update
sudo apt install -y steamcmd lib32gcc-s1
sudo adduser --disabled-password --gecos "" valheim
sudo -iu valheim

Install the server (Valheim Dedicated Server, app ID 896660):

/usr/games/steamcmd +force_install_dir ~/valheim +login anonymous +app_update 896660 validate +quit

Start script

Create ~/valheim/start.sh (based on the bundled start_server.sh):

#!/bin/bash
export templdpath=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
export SteamAppId=892970
cd ~/valheim
./valheim_server.x86_64 \
  -name "Our Viking Server" \
  -port 2456 \
  -world "Midgard" \
  -password "secret-pass" \
  -savedir "/home/valheim/saves" \
  -public 1 \
  -crossplay
export LD_LIBRARY_PATH=$templdpath
chmod +x ~/valheim/start.sh

Settings:

  • -password must be at least 5 characters, and must not contain the server name.
  • -public 1 lists the server in the community browser. Use 0 to join by IP only.
  • -crossplay enables Xbox and Microsoft Store players (uses PlayFab relays). Players join with a join code shown in the log.
  • -savedir keeps worlds outside the install directory.

Run it as a systemd service

# /etc/systemd/system/valheim.service
[Unit]
Description=Valheim Dedicated Server
After=network-online.target
Wants=network-online.target

[Service]
User=valheim
WorkingDirectory=/home/valheim/valheim
ExecStartPre=/usr/games/steamcmd +force_install_dir /home/valheim/valheim +login anonymous +app_update 896660 +quit
ExecStart=/home/valheim/valheim/start.sh
KillSignal=SIGINT
TimeoutStopSec=60
Restart=on-failure

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now valheim
journalctl -u valheim -f

ExecStartPre updates the server on every start. KillSignal=SIGINT makes the server save the world cleanly when stopped. See systemd unit files.

Firewall

sudo ufw allow 2456:2457/udp

See UFW.

Joining

In Valheim: Join game → Add server → your-server-ip:2456, then enter the password. Steam’s server browser also works with “Join IP”.

Admins, bans and world modifiers

In the save directory (~/saves), add SteamID64 values (one per line) to:

  • adminlist.txt: admins can use console commands such as kick, ban and save;
  • bannedlist.txt and permittedlist.txt (the latter as a whitelist).

World modifiers (combat difficulty, resources, raids) can be set with launch options such as -preset hard or -modifier raids none. See the game’s documentation for current options.

Mods

BepInEx (via Thunderstore or r2modman) is the common mod loader. Install the BepInExPack for Valheim on the server, put plugins into BepInEx/plugins, and start with the BepInEx run script. Every player needs matching mods. Crossplay doesn’t work with mods.

Backups

Valheim saves the world periodically, and keeps a few backups, but you should keep your own:

tar czf /backups/valheim-$(date +%F-%H%M).tgz -C /home/valheim saves

Run it from cron every few hours, and copy the archives off-site. See crontab and backup strategy.

Troubleshooting

  • Server not visible in the browser: listing can take several minutes. Join by IP instead.
  • Can’t connect: check UDP 2456–2457, and check the logs for the “Game server connected” message.
  • Lag with many structures: this is CPU-bound. Raise the plan’s CPU, or reduce sprawling bases.

Quick reference

Item Value
SteamCMD app ID 896660
Ports 2456–2457/udp
Saves -savedir (worlds, admin and ban lists)
Clean stop SIGINT
Players up to 10

Related: LinuxGSM and Minecraft server on Linux.

  • Game Server
  • SteamCMD
  • Linux