Valheim

PlatformSupportNotes
Linux✅ NativeRecommended
Windows✅ Native

Valheim is a Viking survival game that supports dedicated servers for up to 10 players. The server is lightweight: 4 GB of RAM and 2 CPU cores are enough for a smooth session.

02

Requirements

ComponentMinimumRecommended
RAM4 GB6 GB
CPU2 core4 core
Disk5 GB10 GB SSD
OSUbuntu 22.04Ubuntu 22.04
Ports2456-2457 UDP:
03

Preparation

bash
# Install dependencies
dpkg --add-architecture i386
apt update
apt install -y lib32gcc-s1 curl wget screen

# Create dedicated user
useradd -m -s /bin/bash valheim
su - valheim

# Install SteamCMD
mkdir ~/steamcmd && cd ~/steamcmd
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -
04

Server Installation

bash
# Create server directory
mkdir ~/valheim_server

# Download server (AppID 896660)
~/steamcmd/steamcmd.sh \
  +force_install_dir ~/valheim_server \
  +login anonymous \
  +app_update 896660 validate \
  +quit
05

Startup Script

bash
nano ~/start_valheim.sh
bash
#!/bin/bash
export templdpath=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=~/valheim_server/linux64:$LD_LIBRARY_PATH
export SteamAppId=892970

cd ~/valheim_server

./valheim_server.x86_64 \
  -name "My Valheim Server" \
  -port 2456 \
  -world "MyWorld" \
  -password "server_password" \
  -public 1 \
  -crossplay \
  -savedir ~/.config/unity3d/IronGate/Valheim \
  2>&1 | tee ~/valheim_server/logs/server.log

export LD_LIBRARY_PATH=$templdpath
bash
chmod +x ~/start_valheim.sh
mkdir ~/valheim_server/logs

Valheim requires a password of at least 5 characters. Without a password the server won't start.

06

systemd Service

Return to root:

bash
exit
nano /etc/systemd/system/valheim.service
ini
[Unit]
Description=Valheim Dedicated Server
After=network.target

[Service]
User=valheim
Group=valheim
ExecStart=/home/valheim/start_valheim.sh
Restart=on-failure
RestartSec=30

[Install]
WantedBy=multi-user.target
bash
systemctl daemon-reload
systemctl enable --now valheim
systemctl status valheim
07

Firewall

bash
ufw allow 2456:2457/udp
08

Cross-play (PC + Xbox/Game Pass)

The -crossplay flag in the startup script enables compatibility with Xbox and Game Pass players. The server will appear in both the Steam and Xbox server list.

PlayStation cross-play is not supported by the dedicated server side: only official servers managed by IronGate support it.

09

Managing Saves

Worlds are saved in:

~/.config/unity3d/IronGate/Valheim/worlds_local/
bash
# Backup world
tar -czf ~/valheim-backup-$(date +%Y%m%d).tar.gz \
  ~/.config/unity3d/IronGate/Valheim/worlds_local/

# Automatic backup every 6 hours
echo "0 */6 * * * valheim tar -czf ~/backups/valheim-\$(date +\%Y\%m\%d_\%H\%M).tar.gz ~/.config/unity3d/IronGate/Valheim/worlds_local/ 2>/dev/null" >> /etc/cron.d/valheim
10

Update

bash
systemctl stop valheim
su - valheim -c "~/steamcmd/steamcmd.sh +force_install_dir ~/valheim_server +login anonymous +app_update 896660 +quit"
systemctl start valheim
11

Logs and Diagnostics

bash
# Live logs
journalctl -u valheim -f

# Search for errors
journalctl -u valheim | grep -i "error\|failed\|warning"

# Verify server is reachable (from outside)
# Use https://valheim.shockbyte.com/check and enter IP:2456
12

Tips & Tweaks

Startup Script Flags

Customize your server with these flags:

bash
#!/bin/bash
export templdpath=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=~/valheim_server/linux64:$LD_LIBRARY_PATH
export SteamAppId=892970

cd ~/valheim_server

./valheim_server.x86_64 \
  -name "My Valheim Server" \
  -port 2456 \
  -world "MyWorld" \
  -password "secure_password_min_5chars" \
  -public 1 \
  -crossplay \
  -savedir ~/.config/unity3d/IronGate/Valheim \
  2>&1 | tee ~/valheim_server/logs/server.log

export LD_LIBRARY_PATH=$templdpath

Important flags:

World Backup Strategy

Manual backup:

bash
# Backup world and character data
tar -czf ~/valheim-backup-$(date +%Y%m%d_%H%M).tar.gz \
  ~/.config/unity3d/IronGate/Valheim/worlds_local/ \
  ~/.config/unity3d/IronGate/Valheim/characters_local/

Automated backup every 6 hours:

bash
# Add to crontab: crontab -e
0 */6 * * * su - valheim -c "tar -czf ~/backups/valheim-\$(date +\%Y\%m\%d_\%H\%M).tar.gz ~/.config/unity3d/IronGate/Valheim/worlds_local/ 2>/dev/null"

Restore world:

bash
systemctl stop valheim
tar -xzf ~/valheim-backup-20240101_1200.tar.gz -C ~/.config/unity3d/IronGate/Valheim/
systemctl start valheim

BepInEx Mods Installation

BepInEx allows plugins and mods on Valheim servers:

bash
# As valheim user
cd ~/valheim_server

# Download latest BepInEx
wget https://github.com/BepInEx/BepInEx/releases/download/v5.4.22/BepInEx_linux.zip
unzip BepInEx_linux.zip
rm BepInEx_linux.zip

# Install example mod (ServerSync for mod sync)
# Create plugins folder
mkdir -p BepInEx/plugins

# Download mods into BepInEx/plugins/
# Then restart server
systemctl restart valheim

Popular server mods:

Admin Commands

Valheim admin commands (via chat when connected):

bash
# Teleport self to player
/goto PlayerName

# Teleport player to you
/summon PlayerName

# List player locations
/pos

# Start raid (random creatures attack)
/raid

# God mode (admin only)
/god

# Ghost mode (invisible, pass through walls)
/ghost

# Kill all enemies
/killall

# Spawn item
/give ItemName Count

# Set time of day
/time <0-1>    # 0=day, 1=night

# Reset portal entrance
/resetworldportals

Cross-play Configuration

Enable cross-play between Steam and Xbox:

In startup script:

bash
-crossplay

Important notes:

Performance Tuning

Valheim is lightweight, but optimize for more players:

bash
# In startup script, reduce load by limiting entities:
# (Valheim doesn't support these flags, but you can:)

# 1. Limit world size (use smaller world for smaller servers)
# 2. Manage active mods (some are CPU-heavy)
# 3. Monitor with: top, ps aux | grep valheim_server

Monitoring Commands

bash
# Server status
systemctl status valheim

# Real-time logs
journalctl -u valheim -f

# Active connections
ss -tulnp | grep 2456

# Memory usage
ps aux | grep valheim_server | grep -v grep

# World file size (can grow large)
du -h ~/.config/unity3d/IronGate/Valheim/worlds_local/

Troubleshooting Connection Issues

Server not appearing in browser:

bash
# Check if -public 1 is set in startup script
# Verify ports are open
sudo ufw allow 2456:2457/udp

# Restart server
systemctl restart valheim

Clients can't connect:

bash
# Verify firewall
ss -tulnp | grep 2456

# Check server is running
systemctl status valheim

# Inspect logs
journalctl -u valheim -n 20

Lag/slow world:

bash
# Check server memory
free -h

# Monitor active connections
watch -n 2 "ss -tulnp | grep 2456 | wc -l"

# Reduce active mods or restart to clear memory
systemctl restart valheim

Wipe Procedures

Reset world for new season:

bash
# 1. Backup current world
tar -czf ~/valheim-wipe-$(date +%Y%m%d).tar.gz \
  ~/.config/unity3d/IronGate/Valheim/worlds_local/

# 2. Stop server
systemctl stop valheim

# 3. Delete world files
rm ~/.config/unity3d/IronGate/Valheim/worlds_local/MyWorld*

# 4. Restart (creates fresh world)
systemctl start valheim

Network Optimization

For servers with latency issues:

bash
# Check network from server
ping -c 3 $(echo $SSH_CLIENT | awk '{print $1}')

# Monitor bandwidth
iftop -i eth0

# If behind NAT/firewall, consider port forwarding
sudo ufw allow 2456:2457/udp
  • -crossplay: Enable Xbox Game Pass support
  • -public 1: List on server browser (0 to hide)
  • -password: Minimum 5 characters
  • ServerSync: Auto-sync mods to clients
  • ConfigurationManager: Web config editor
  • Nexus Mods: Browse at nexusmods.com/valheim
  • Server appears on both Steam and Xbox Game Pass server lists
  • Mixed accounts play together seamlessly
  • PlayStation not supported on dedicated servers (console only)

DeluxHost, fondata nel 2023, offre soluzioni di hosting di alta qualità per diverse esigenze digitali. Forniamo hosting condiviso, VPS e server dedicati con sicurezza avanzata e datacenter globali.

© DeluxHost, Tutti i diritti riservati. | Partita IVA: IT17734661006
Tutti i sistemi operativi