Set up a Valheim dedicated server
Your own Valheim server runs around the clock, even when the host player is offline. This guide sets up the dedicated server on a Linux machine with SteamCMD, explains the start parameters and ports, shows how to install mods with BepInEx and how to back up your world.
8 min read · Last reviewed: October 2026
Requirements
- A Linux server running Ubuntu 22.04/24.04 or Debian 12 with root access
- At least 2 CPU cores and 4 GB RAM for a small group – with mods and large bases rather 8 GB
- About 5 GB of free disk plus room for world backups
- Basic SSH experience (see Secure your SSH server)
Step 1: Create a user and install SteamCMD
The server runs as its own user, not as root. On Ubuntu, install SteamCMD from the multiverse repository:
# User for the game server sudo useradd -m -s /bin/bash valheim # 32-bit architecture and SteamCMD (Ubuntu) sudo add-apt-repository multiverse sudo dpkg --add-architecture i386 sudo apt update sudo apt install -y steamcmd # Libraries the Valheim server needs sudo apt install -y libatomic1 libpulse-dev libpulse0
non-free there. Enable contrib non-free in your package sources and the same installation works.Step 2: Install the Valheim dedicated server
The dedicated server has Steam app ID 896660 and can be downloaded anonymously – you don't need a Steam account that owns Valheim.
sudo -u valheim -i steamcmd +force_install_dir /home/valheim/server \ +login anonymous \ +app_update 896660 validate \ +quit
Run the same command to update the server later. After a Valheim update, server and players must be on the same version, otherwise joining fails with “Incompatible version”.
Step 3: Create a start script
The install folder contains start_server.sh. Don't edit the original – an update overwrites it. Create your own copy:
#!/bin/bash export templdpath=$LD_LIBRARY_PATH export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH export SteamAppId=892970 ./valheim_server.x86_64 \ -name "My Valheim Server" \ -port 2456 \ -world "Midgard" \ -password "secret123" \ -public 1 \ -saveinterval 1800 \ -backups 4 export LD_LIBRARY_PATH=$templdpath
chmod +x /home/valheim/server/start_valheim.sh
| Parameter | Meaning |
|---|---|
-name | Name in the server list |
-world | World name – created if it doesn't exist yet |
-password | At least 5 characters and must not appear in the server name, otherwise the server won't start |
-public | 1 = listed in the community list, 0 = reachable by IP only |
-saveinterval | Save interval in seconds (default 1800 = 30 minutes) |
-backups | Number of automatic world backups (default 4) |
-crossplay | Opens the server to Xbox/Game Pass players via relay servers (see below) |
-preset | Difficulty: e.g. casual, easy, normal, hard, hardcore, immersive, hammer |
Step 4: Open the ports
Valheim uses the given port and the next one – with the default that's 2456 and 2457 (UDP):
sudo ufw allow 2456:2457/udp sudo ufw status
Players connect in-game via Join Game → Join IP with YOUR-SERVER-IP:2456. Public servers also show up in the community list – that can take a few minutes after start.
-crossplay connections go through PlayFab relay servers instead of directly via Steam. No port forwarding is needed then, and players can also join with a join code. Connecting via a local IP doesn't work in this mode. Players on Xbox can't use mods.Step 5: Run it as a systemd service
To have the server start automatically after a reboot and save cleanly, create a service. Valheim saves when it receives SIGINT (like Ctrl+C) – hence KillSignal=SIGINT:
[Unit] Description=Valheim Dedicated Server After=network-online.target Wants=network-online.target [Service] Type=simple User=valheim WorkingDirectory=/home/valheim/server ExecStart=/home/valheim/server/start_valheim.sh KillSignal=SIGINT TimeoutStopSec=120 Restart=on-failure RestartSec=30 [Install] WantedBy=multi-user.target
sudo systemctl daemon-reload sudo systemctl enable --now valheim sudo journalctl -u valheim -f # follow the log live
Step 6: Set admins
The permission files live in the valheim user's save folder ~/.config/unity3d/IronGate/Valheim/:
adminlist.txt– admins, who may use e.g.kickandbanin the console (F5)bannedlist.txt– banned playerspermittedlist.txt– whitelist. Careful: as soon as anyone is listed here, everyone else is locked out.
One ID per line. Current versions expect the format Platform_ID, so for Steam players e.g. Steam_76561198… (the SteamID64). You'll find the exact spelling in the server log when someone connects, or in-game with F2. Restart the server after changes.
Step 7: Mods with BepInEx
Almost all Valheim mods rely on BepInEx, specifically the adapted BepInExPack_Valheim from Thunderstore.
- Stop the server and take a backup (see step 8).
- Download BepInExPack_Valheim and extract it into a separate folder.
- Copy the contents of the
BepInExPack_Valheimfolder into the server directory/home/valheim/server. - Put the same parameters as in your start script into
start_server_bepinex.sh, runchmod u+x start_server_bepinex.shand pointExecStartin the systemd service to this script. - Start the server. If BepInEx messages show up in the log, it worked – the folders
BepInEx/pluginsandBepInEx/configare created on the way. - Copy mod DLLs into
BepInEx/plugins/, restart, adjust settings inBepInEx/config/.
Step 8: Back up the world
A world consists of two files named after it: Midgard.db (the actual world) and Midgard.fwl (metadata such as the seed). Both live in:
/home/valheim/.config/unity3d/IronGate/Valheim/worlds_local/
With -backups Valheim keeps a few copies there automatically – but on the same server. Back up externally as well, e.g. with a daily cron job:
# Daily 05:00: archive the world, keep 14 days 0 5 * * * tar czf /home/valheim/backups/world-$(date +\%F).tar.gz -C /home/valheim/.config/unity3d/IronGate/Valheim worlds_local && find /home/valheim/backups -name 'world-*.tar.gz' -mtime +14 -delete
mkdir -p /home/valheim/backups
Download the archives to your PC or a storage service regularly, e.g. with scp or rsync. To restore: stop the server, copy both files back, start.
Upload your own world: a world from your local game lives on Windows in %USERPROFILE%\AppData\LocalLow\IronGate\Valheim\worlds_local. Copy the .db and .fwl into the folder on the server and set -world to exactly that name.
A KVM server for your Valheim server
We don't offer Valheim as a ready-made game server package. A KVM server from AvantaHost gives you full root access and dedicated resources – exactly what this guide assumes.
View KVM servers