Overview
Valheim is a Viking survival game that supports up to 10 players on a dedicated server. Running your own server gives you persistent worlds and mod support.
Requirements
- A Breeze with at least 4 GB RAM
- Ubuntu 22.04 or Debian 12
- At least 2 CPU cores
Step 1: Install SteamCMD
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y steamcmdStep 2: Create a Server User
sudo useradd -r -m -d /opt/valheim valheimStep 3: Install Valheim Server
sudo -u valheim steamcmd +force_install_dir /opt/valheim/server \
+login anonymous \
+app_update 896660 validate \
+quitStep 4: Create a Start Script
sudo -u valheim tee /opt/valheim/start.sh <<'EOF'
#!/bin/bash
export templdpath=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/valheim/server/linux64:$LD_LIBRARY_PATH
export SteamAppId=892970
/opt/valheim/server/valheim_server.x86_64 \
-name "My Valheim Server" \
-port 2456 \
-world "MyWorld" \
-password "changeme" \
-public 0
export LD_LIBRARY_PATH=$templdpath
EOF
chmod +x /opt/valheim/start.shStep 5: Create a Systemd Service
sudo tee /etc/systemd/system/valheim.service <<EOF
[Unit]
Description=Valheim Dedicated Server
After=network.target
[Service]
User=valheim
WorkingDirectory=/opt/valheim
ExecStart=/opt/valheim/start.sh
Restart=on-failure
RestartSec=15
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now valheimStep 6: Open Firewall Ports
sudo ufw allow 2456:2458/udpConnecting
Launch Valheim, go to Join Game, and enter your server's IP address with port 2457. Enter the password you configured.
Server Maintenance
- Update:
steamcmd +login anonymous +app_update 896660 +quit - Backups are in
/opt/valheim/.config/unity3d/IronGate/Valheim/worlds_local/ - Consider daily world backups with a cron job