Valheim is a brutal survival and exploration game for 1-10 players set in a procedurally-generated purgatory inspired by Viking culture. This comprehensive guide covers everything you need to know about hosting a Valheim dedicated server on a VPS or dedicated server.
2456-2458 (UDP)1. Open Steam and go to your Library
2. Use the dropdown menu and check "Tools"
3. Locate "Valheim Dedicated Server" in the list
4. Click "Install" and choose installation directory
5. Wait for download to complete
# Install SteamCMD first (if not already installed)
# Ubuntu/Debian:
sudo apt update
sudo apt install steamcmd
# Create server directory
mkdir -p ~/valheim-server
cd ~/valheim-server
# Download server files
steamcmd +login anonymous +force_install_dir ~/valheim-server +app_update 896660 validate +exit
# The server files will be downloaded to your specified directory
Before starting your server for the first time, you'll need to configure the startup parameters.
Valheim uses startup scripts to configure the server. Edit the appropriate file for your OS:
@echo off
set SteamAppId=892970
valheim_server.exe -nographics -batchmode ^
-name "MyValheimServer" ^
-port 2456 ^
-world "MyWorld" ^
-password "MyPassword123" ^
-public 1
#!/bin/bash
export SteamAppId=892970
./valheim_server.x86_64 -nographics -batchmode \
-name "MyValheimServer" \
-port 2456 \
-world "MyWorld" \
-password "MyPassword123" \
-public 1 \
-logfile /path/to/valheim.log
Create these files in the server directory to manage administrators, bans, and whitelists:
# Add Steam64 IDs (one per line)
76561198012345678
76561198087654321
# Add Steam64 IDs of banned players
76561198099999999
# For whitelist mode - only these IDs can join
76561198012345678
76561198087654321
| Parameter | Description | Example |
|---|---|---|
-name |
Server name (appears in browser) | "My Valheim Server" |
-port |
Server port (default 2456) | 2456 |
-world |
World/save name | "Midgard" |
-password |
Server password (required) | "SecurePass123" |
-public |
1=Public listing, 0=Private | 1 |
-savedir |
Custom save directory path | "/path/to/saves" |
-logfile |
Path to log file | "/var/log/valheim.log" |
-nographics |
Run headless (no GUI) | Required for dedicated servers |
-batchmode |
Run in batch mode | Required for dedicated servers |
You must forward/open the following ports on your firewall:
# Allow Valheim ports
sudo ufw allow 2456:2458/udp
sudo ufw reload
# Open Windows Defender Firewall with Advanced Security
# Create new Inbound Rules for UDP ports 2456-2458
# Or use PowerShell:
New-NetFirewallRule -DisplayName "Valheim Server" -Direction Inbound -Protocol UDP -LocalPort 2456-2458 -Action Allow
Problem: Server fails to start or crashes immediately.
Solutions:
chmod +x start_server.sh)Problem: Server doesn't show up in the in-game server list.
Solutions:
-public 1 is set in startup parametersProblem: Players cannot connect to the server.
Solutions:
Problem: Server experiences lag, stuttering, or poor performance.
Solutions:
Problem: World save is corrupted or progress is lost.
Solutions:
# Linux backup script example
#!/bin/bash
WORLD_NAME="MyWorld"
BACKUP_DIR="/path/to/backups"
DATE=$(date +%Y%m%d_%H%M%S)
# Create backup
cp ~/.config/unity3d/IronGate/Valheim/worlds/$WORLD_NAME.* $BACKUP_DIR/
# Keep only last 7 days of backups
find $BACKUP_DIR -name "*.fwl" -mtime +7 -delete
find $BACKUP_DIR -name "*.db" -mtime +7 -delete
Set up daily restarts to clear memory and apply updates:
# Linux crontab entry for 4 AM restart
0 4 * * * /path/to/restart_valheim.sh
# restart_valheim.sh:
#!/bin/bash
pkill -9 valheim_server
sleep 10
cd /home/valheim/server
./start_server.sh &
Enable console with -console parameter, press F5 in-game:
devcommands - Enable admin commandskick [player name] - Kick a playerban [player name] - Ban a playerunban [player name] - Unban a playersave - Force save the worldresetskill [skill] - Reset player skill level