Gaming

How to Set Up a Valheim Dedicated Server on a VPS

Host a persistent Valheim world your friends can join anytime: SteamCMD install, the crossplay flag, ports 2456–2458, and a systemd service that survives reboots.

NXNxeonNxeon editorialAugust 4, 2026 4 min read
Quick answer

Host a persistent Valheim world your friends can join anytime: SteamCMD install, the crossplay flag, ports 2456–2458, and a systemd service that survives reboots.

Topic
Gaming
Read time
4 min read
Covers
valheim, dedicated server, steamcmd
Last updated
August 5, 2026

A Valheim dedicated server keeps your Viking world online around the clock, so friends can log in and build even when the host is offline. This guide sets up a proper Linux server with SteamCMD, enables crossplay, and runs everything as a systemd service.

What you need

  • A Linux VPS: Ubuntu 22.04/24.04 or Debian 12. Valheim is fairly light — 4 GB RAM handles a small group comfortably, 8 GB for larger worlds and player counts. Details in Valheim server requirements and best specs.
  • Open ports: UDP 2456–2458. Valheim uses three consecutive ports.

Step 1: Create a user and install dependencies

sudo adduser --disabled-password --gecos "" valheim
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y lib32gcc-s1 steamcmd

Step 2: Install the Valheim server

The Valheim dedicated server is App ID 896660 and installs anonymously:

sudo su - valheim
steamcmd +force_install_dir /home/valheim/server +login anonymous +app_update 896660 validate +quit
Deploying a new server with the Nxeon one-click deploy wizard
Deploying a new server with the Nxeon one-click deploy wizard

Step 3: Open the firewall

sudo ufw allow 2456:2458/udp
sudo ufw reload

Open the same UDP range on any provider-level firewall too.

Step 4: Write a start script

Valheim ships a start_server.sh template, but it's cleaner to write your own so your world name and password are explicit. Create /home/valheim/start.sh:

#!/bin/bash
export templdpath=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/home/valheim/server/linux64:$LD_LIBRARY_PATH
export SteamAppId=892970
cd /home/valheim/server
./valheim_server.x86_64 \
  -name "My Nxeon Valheim Server" \
  -port 2456 \
  -world "Midgard" \
  -password "CHANGE_ME_MIN_5_CHARS" \
  -crossplay \
  -savedir /home/valheim/data
export LD_LIBRARY_PATH=$templdpath

Make it executable:

chmod +x /home/valheim/start.sh

Key flags:

  • -crossplay — enables the crossplay backend so PC (Steam/Xbox Game Pass) and console players can join. Leave it off if you want a Steam-only server.
  • -password — required, minimum 5 characters, and it must not contain your world or server name.
  • -savedir — keeps your world files in a predictable place for backups.

Step 5: Run it as a systemd service

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

[Service]
Type=simple
User=valheim
ExecStart=/home/valheim/start.sh
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now valheim
sudo journalctl -u valheim -f

Give it a minute on first launch — Valheim generates the world before it accepts connections.

Step 6: Join the server

In Valheim, go to Join Game → Join IP and enter YOUR_IP:2456, then the password. If crossplay is enabled, players can also find it through the crossplay browser. Once you're settled in, the next thing most groups want is mods — see the approach in the best Valheim server mods (BepInEx-based).

Back up your world

Valheim writes your world to two files — Midgard.db and Midgard.fwl — in your save directory. A corrupted .db is the most common way people lose a world, so snapshot them regularly. A tiny nightly cron job is enough:

# crontab -e as the valheim user — daily 4am backup, keep 7 days
0 4 * * * tar -czf /home/valheim/backups/world-$(date +\%F).tar.gz /home/valheim/data && find /home/valheim/backups -name 'world-*' -mtime +7 -delete

Because Valheim saves periodically while running, it's safest to back up when the server is idle or briefly stopped. For a fuller strategy across games, see how to back up your game server automatically. Pair that with a scheduled restart from automating game server restarts with systemd and your world is both fresh and safe.

FAQ

What ports does a Valheim server use?

UDP 2456, 2457, and 2458 — three consecutive ports. Open the whole 2456–2458/udp range on both the OS and provider firewall.

How do I enable crossplay on a Valheim server?

Add the -crossplay flag to the server start command. This lets PC and Xbox/Game Pass players connect through the shared crossplay backend.

How much RAM does a Valheim server need?

4 GB is comfortable for a small group; 8 GB gives headroom for larger worlds and more players. See Valheim requirements and best specs for detail.

Do I need to own Valheim to run the server?

You need to own the game to play, but the dedicated server itself installs anonymously through SteamCMD (App ID 896660) — no login required on the server box.

Want a low-latency Viking world that's always online? Launch one on our game server hosting, or check VPS pricing for the right memory tier.

Game server hosting

Deploy in seconds, not weekends

Explore Game server hosting ★★★★★ Instant deploy · full root · 24/7 support
#valheim#dedicated server#steamcmd#crossplay#game servers#seobatch
NX

Nxeon · Nxeon editorial

★★★★★ Straight-talking guides from the team that runs the servers.

Game server hosting

Deploy in seconds, not weekends

Spin up a ready-to-play game server in minutes — one-click installs, DDoS protection and instant scaling.

Explore Game server hosting ★★★★★ Instant deploy · full root · 24/7 support