🔥 Agencies & studios Run unlimited client servers for a flat $99/mo — zero per-seat or bandwidth tax. Railyard for agencies →
Host a Valheim dedicated server ← Blog Guides & tutorials • 6 min read

Host a Valheim dedicated server

Almokhtar Bekkour

Almokhtar Bekkour, Founder, Systems Architect

November 23, 2026 · 6 min read

Follow this on your own server. Start free, no card needed

Valheim’s rented hosts charge a monthly fee for a slot you don’t control, and your world lives on their disk. A dedicated server on a box you own runs the same game for a flat price, keeps the world as files you can back up and move, and lets you add mods and SSH in when you want to. By the end of this guide you’ll have a Valheim dedicated server running in Docker on your own server, reachable by your group, sized for a full party, with backups that won’t corrupt the world.

Like other game servers, Valheim isn’t a web app: it speaks its own protocol over UDP ports, so there’s no reverse proxy and no HTTPS involved, just a few ports open to the internet. The two things that actually matter are getting those ports and the server password right, and giving the server enough memory for everyone exploring at once.

What you’ll need

  • A server. Valheim’s dedicated server is memory-hungry; a 4 GB box is the floor for a small group, and a full party of ten with a large explored world is happier on 8 GB. CPU matters less than RAM. Any Ubuntu 24.04 VPS works.
  • Docker and the Docker Compose plugin (Step 2).
  • SSH access and a terminal.

Step 1: Create the server and open the ports

Create an Ubuntu 24.04 server with at least 4 GB of RAM and note its public IP.

Valheim uses three consecutive UDP ports, 2456 to 2458. Open them in your cloud provider’s firewall/security group, and on the host:

sudo ufw allow 2456:2458/udp

There’s no TLS and no proxy here; players connect to the server’s IP and port directly from Valheim’s “Join by IP” option.

Step 2: Install Docker

curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER

Log out and back in, then confirm docker --version and docker compose version both print a version.

Step 3: Lay out the project

The community-standard image is lloesche/valheim-server. It downloads and updates the dedicated server through SteamCMD for you, and takes its settings from environment variables. Create a directory:

mkdir -p ~/valheim && cd ~/valheim

Step 4: Write the Docker Compose file

Create docker-compose.yml:

services:
  valheim:
    image: lloesche/valheim-server:latest
    restart: unless-stopped
    cap_add:
      - SYS_NICE
    ports:
      - "2456-2457:2456-2457/udp"
    environment:
      SERVER_NAME: "A server you own"
      WORLD_NAME: "Midgard"
      SERVER_PASS: "<at least five characters>"
      SERVER_PUBLIC: "false"
      BACKUPS: "false"
    volumes:
      - valheim_config:/config
      - valheim_data:/opt/valheim
    stop_grace_period: 2m

volumes:
  valheim_config:
  valheim_data:

The choices worth explaining:

  • SERVER_PASS is required and must be at least five characters, and it can’t contain the server name. The server refuses to start otherwise. Everyone who joins needs it.
  • SERVER_PUBLIC: "false" keeps the server off the public community browser so only people with the IP and password find it. Set it to "true" only if you want it listed.
  • The image updates the Valheim server on start via SteamCMD, so the first boot takes several minutes while it downloads. Pinning a specific game version isn’t really a thing here the way it is for a web app; Valheim’s client and server have to match the current game version, so the server tracking latest is usually what you want.
  • BACKUPS: "false" turns off the image’s built-in backup cron in favour of the consistent, off-server backup in Step 6. The image’s own backups land on the same box, which doesn’t survive the failure that destroys the box.
  • cap_add: SYS_NICE lets the server adjust process priority, which the image uses to keep the simulation smooth; without it you’ll see a harmless warning.
  • The world and config live in named volumes. /config holds your worlds and server settings; /opt/valheim holds the downloaded server itself.

Step 5: Start it and connect

docker compose up -d
docker compose logs -f valheim

The first start is slow while SteamCMD downloads the server. Wait for a log line indicating the server is up and the world is loaded. Then, in Valheim, choose Join Game → Join by IP, enter your server’s IP (the game appends the port), and type the password. You should spawn into the named world.

Step 6: Back up the world without corrupting it

A Valheim world is two files per world in /config/worlds_local (a .db and an .fwl), and they’re written while the server runs. Copying them from under a live server can catch a half-written database. The safe, simple approach is to stop the server briefly, copy, and start it again; Valheim saves on shutdown, so a clean stop flushes the world to disk:

docker compose stop valheim
docker run --rm -v valheim_valheim_config:/config -v $(pwd):/backup alpine \
  tar czf /backup/valheim-world-$(date +%F-%H%M).tar.gz -C /config worlds_local
docker compose start valheim

Put that in a cron job during off-hours and copy the result off the server. If you can’t tolerate the short restart, Valheim also autosaves periodically, and you can copy the world files between saves, but the stop-copy-start cycle is the one that never gives you a corrupt restore.

Step 7: Add mods

Most Valheim mods use BepInEx. The lloesche/valheim-server image supports loading a BepInEx mod pack through environment variables and a mounted directory; the simplest path is to set the image’s Valheim Plus or BepInEx options and drop the mods into the config volume. Keep the server and every player on the same mod versions, mismatched mods are the most common reason someone can’t connect.

The shortcut: do it with Railyard

Everything above, the dedicated server with its password and ports set and the world on a persistent volume, is also a one-click template:

https://app.railyard.run/deploy?template=valheim

It deploys the server to a box in your own cloud account, exposes the game ports, and keeps the world on a persistent volume so it survives restarts and redeploys. You still own the box and can SSH in to add mods or change the world. For how persistent data and scheduled backups work across templates, see databases and backups.

Troubleshooting

The server doesn’t appear and friends can’t connect. Confirm UDP 2456–2458 are open in both the host firewall and the cloud security group, that you’ve shared the correct public IP, and that everyone has the exact password. Valheim connection failures are almost always the UDP ports or the password, not the server itself.

The server won’t start, logs mention the password. SERVER_PASS is shorter than five characters, missing, or contains the server name. Fix it and restart.

First boot seems stuck for minutes. That’s SteamCMD downloading the dedicated server. Watch docker compose logs -f valheim; it’s working as long as you see download progress. Only worry if it errors out.

The game lags with a full group in a big world. Valheim’s server simulates everything players have loaded. Check docker stats; if it’s near its memory ceiling, move to an 8 GB box. More players and more explored map mean more RAM.

A world backup restored to a corrupt or old state. The .db was copied from a live server mid-write, or only one of the .db/.fwl pair was restored. Both files for a world must come from the same clean stop, which is why Step 6 stops the server first.

FAQ

How much RAM do I need? 4 GB for a small group, 8 GB for a full party of ten or a heavily explored world. Memory is the limit, not CPU.

Can I move my existing single-player or co-op world here? Yes. Your local world’s .db and .fwl files (from your own machine’s Valheim save folder) go into /config/worlds_local; name WORLD_NAME to match, and the dedicated server loads it.

Does this cost less than rented Valheim hosting? Usually, and the box runs anything else you want too. A 4 GB VPS is a flat $12–24/month versus a per-slot game-host fee, and the world is yours on disk.

Is it safe to expose the ports? Opening the game’s UDP ports is normal and necessary. Keep SERVER_PUBLIC false and the password strong so only your group joins, and keep the box’s system packages updated.

Either path gets you the same thing: your own Valheim server, your own world on disk, and a flat bill instead of a rented slot.

Why people pick Railyard for this

  • Your own cloud account. Deploy to DigitalOcean, Hetzner, Vultr, AWS, OVHcloud, or any Linux server over SSH, billed directly by your provider with no markup.
  • One flat price per team. Free is free forever: one server plus a database server, three apps, no card. Pro is $19 a month for up to five servers and unlimited apps. Team is $99 a month with unlimited servers. No per-app, per-deploy, per-seat or per-gigabyte charges.
  • One-click templates. Deploy open-source apps, like databases, analytics and dev tools, to your own server in one click.
  • Managed databases. Postgres, MySQL and Redis with scheduled, restore-verified backups and point-in-time recovery.
  • Push-to-deploy. Deploy from GitHub, GitLab or the CLI, with automatic HTTPS and zero-downtime releases.

Skip the server setup

Launch the Valheim template on Railyard in one click and get a dedicated server with its world on a persistent volume.

Free plan, no card, and 7 days of Pro for every new team. One flat price per team.

Theme
Colors