Hop til hovedindhold

How to Set Up a Valheim Dedicated Server

Running a Valheim dedicated server lets your group explore, build, and fight together without relying on a single player to host every session. Your world stays online 24/7, friends can join on their own schedule, and performance stays consistent regardless of what the host is doing in-game. This guide walks through everything you need to get one running.

Why Run a Dedicated Server?

In Valheim's default peer-to-peer mode, the person hosting the world must be online for anyone to play. That creates scheduling headaches and ties server performance to the host's hardware and internet connection. A dedicated server solves both problems. The world runs independently, stays persistent, and performs consistently since it is not sharing resources with someone's game client.

Hardware Requirements

Valheim relies heavily on single-threaded performance. Clock speed per core matters more than core count because physics calculations run on a single thread.

Minimum (1-3 Players)

  • CPU: Dual-core at 2.8 GHz or higher
  • RAM: 4 GB dedicated to the server
  • Storage: 5 GB for server files and world data (SSD recommended)
  • Network: 2 Mbps upload speed minimum
  • CPU: Quad-core at 3.0 GHz or higher
  • RAM: 8-16 GB dedicated to the server
  • Storage: 10 GB on SSD to accommodate updates and backups
  • Network: 5 Mbps upload or higher

Worlds with heavy construction or extensive terrain modification will need resources toward the higher end of these ranges.

Port Configuration

Valheim uses two consecutive ports for its networking. The default configuration requires:

  • Port 2456 (UDP): Main game connection
  • Port 2457 (UDP): Steam query port

Both ports need to be forwarded through your router and allowed through your firewall for players to connect from outside your local network.

Crossplay Mode

If you enable crossplay using the -crossplay launch argument, Valheim routes traffic through PlayFab relay servers. This eliminates the need for port forwarding entirely, which simplifies setup. However, players using the crossplay backend are more likely to experience higher latency, occasional timeouts, and disconnects compared to the direct Steam connection.

Setting Up via SteamCMD

The recommended way to install a Valheim dedicated server is through SteamCMD, Valve's command-line tool for managing game servers.

Step 1: Install SteamCMD

Download SteamCMD from the official Valve developer site and extract it to a dedicated folder such as C:\SteamCMD on Windows or /home/steam/steamcmd on Linux.

Step 2: Download the Server Files

Run the following commands within SteamCMD:

login anonymous
force_install_dir /path/to/valheim-server
app_update 896660 validate
quit

App ID 896660 is the Valheim Dedicated Server tool. You do not need to own Valheim on the account running SteamCMD since the server is freely available.

Step 3: Configure the Server

Edit the startup script (start_headless_server.bat on Windows or start_server.sh on Linux). The key parameters are:

-name "Your Server Name" -port 2456 -world "YourWorldName" -password "yourpassword"
  • -name: The display name visible in the server browser.
  • -port: The first of the two consecutive ports.
  • -world: The world file name (creates a new world if it does not exist).
  • -password: Must be at least 5 characters and cannot be contained within the server name.

Step 4: Open Ports and Start

Forward ports 2456-2457 (UDP) on your router, add firewall rules for both ports, and then run the startup script. The server will generate the world on first launch, which may take a minute or two.

Connecting to Your Server

Players can connect through the in-game server browser by searching for the server name, or by adding it directly using the IP address and port (for example, 192.168.1.100:2456 for LAN or your public IP for remote connections). The Steam server browser also works by adding the query port address.

Keeping Your Server Updated

Valheim receives regular patches, and your dedicated server needs to stay on the same version as connecting clients. Use SteamCMD to update:

login anonymous
force_install_dir /path/to/valheim-server
app_update 896660
quit

Run this command before each play session or automate it with a scheduled task or cron job to stay current.

Backups and World Safety

Valheim world data is stored in the .db and .fwl files within the worlds directory. Back these up regularly. A corrupted world file without a backup means starting over entirely.

Set up automated backups on a daily schedule at minimum, and always create a manual backup before applying server updates or installing mods.

Quick Tips for a Smooth Server

  • Password length: The server password must be at least 5 characters. Shorter passwords cause the server to reject connections silently.
  • Separate machine: If self-hosting, run the dedicated server on a separate machine or at least a separate user account to avoid resource conflicts with the game client.
  • World size: Valheim worlds are procedurally generated. Performance depends more on what players build than on how much of the map has been explored.
  • Regular restarts: Schedule a daily restart during off-peak hours to clear accumulated memory and keep performance stable.

Whether you choose to self-host or go with a managed solution, a dedicated server transforms Valheim from a game you coordinate around one person's schedule into a persistent world your entire group can call home.