Tutorials

Valheim Server

Valheim is a Viking-themed survival game with massive demand for dedicated servers. This guide assumes you have already installed SteamCMD.

Requirements

  • A VPS running Ubuntu 20.04+ or Debian 11+
  • SteamCMD installed with a steam user
  • At least 4 GB RAM
  • At least 5 GB free disk space

1. Install the Server

su - steam
cd ~/steamcmd
./steamcmd.sh +force_install_dir ~/valheim +login anonymous +app_update 896660 validate +quit

2. Configure the Server

Create a start script:

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

./valheim_server.x86_64 \
  -name "My Sitequest Valheim Server" \
  -port 2456 \
  -world "MyWorld" \
  -password "YOUR_SERVER_PASSWORD" \
  -public 1

export LD_LIBRARY_PATH=$templdpath
chmod +x ~/valheim/start.sh

The password must be at least 5 characters and cannot be contained in the server name.

3. Create a systemd Service

Exit back to root:

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

[Service]
User=steam
WorkingDirectory=/home/steam/valheim
ExecStart=/home/steam/valheim/start.sh
Restart=on-failure
RestartSec=15
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable valheim
systemctl start valheim

4. Open Firewall Ports

Open UDP ports 2456-2458 in the Sitequest firewall.

With ufw:

ufw allow 2456:2458/udp

5. Connect

In Valheim, go to Join Game, select Add server, and enter YOUR_SERVER_IP:2457. Note: the connection port is the game port +1.

Updating the Server

Stop the server, update, and restart:

sudo systemctl stop valheim
su - steam
cd ~/steamcmd
./steamcmd.sh +force_install_dir ~/valheim +login anonymous +app_update 896660 validate +quit
exit
sudo systemctl start valheim

Next Steps

  • Configure world modifiers in the start script for difficulty adjustments
  • Set up automatic backups of ~/.config/unity3d/IronGate/Valheim/worlds_local/
  • Install Valheim Plus or BepInEx for mods