CrewWorlds

Valheim ยท Server setup

How to run a Valheim server for your friends

The cheapest way to run one that doesn't suck, on a machine you already own or a small box you rent. The SteamCMD install, the launch flags people get wrong, backups that actually restore, and mods that don't kick anyone.

Valheim runs a proper dedicated server, and it is light. What matters is deciding where it runs, getting the launch flags right (where people trip), and keeping the world saved so a crash never eats your longhouse.

There are two honest ways to do this, depending on the hardware you already have. This guide covers the choice, then the build, which is the same either way.

What this covers

  1. Where to run it. Your own machine, or a cheap box, and how to pick.
  2. Install the server with SteamCMD. One command, no Steam account.
  3. Launch it correctly. The flags people get wrong, and the password rule that locks everyone out.
  4. Open the right ports. Two UDP ports, and the one extra step if you self-host at home.
  5. Keep it running. A service that saves the world instead of killing it mid-write.
  6. Backups that restore. Which two files are your world, and how to prove a backup works.
  7. Mods, if you want them. BepInEx, and the rule that keeps friends from getting kicked.

Where to run it: your own machine, or a cheap box

Two honest ways to do this, and the right one just depends on the hardware you already have.

On a machine you own. If you have a computer you can leave on that you are not also gaming on (a spare PC, an old laptop, a mini PC, a home server), you can run a Valheim server on it for nothing but a little electricity. Valheim is light: a couple of free CPU cores and 2 to 4 GB of spare RAM covers a crew of two to ten. The two catches are that the world is only up while that machine is on, and you have to forward one port on your home router so friends can reach it (Step 4 covers that). If you already own the hardware, this is the cheapest way, full stop.

On a cheap box you rent. No spare machine, or you would rather not leave your PC on and open your home network? Rent a small server. It has a public IP so there is no port forwarding, it stays up on its own, and a box that runs Valheim well is about $5 to $12 a month. Valheim wants a strong single CPU core more than lots of RAM, so get a dedicated-vCPU box, not a cheap shared-core one with big memory numbers. If you want a specific recommendation, a small dedicated-vCPU VPS like the ones at crewworlds.com/go/host is what I would get.

Everything from here is the same either way. The server software does not care where it runs; only the networking differs, and I flag that where it matters. The commands below assume Linux (what a rented box gives you, and the easiest way to self-host); on a Windows machine the same steps apply with the Windows server download.

The build, step by step

Step 1: Get your machine ready

On the box or machine that will run it, make a normal user for the server and do not run it as root:

sudo adduser valheim
sudo apt update && sudo apt install -y curl

Step 2: Install the server with SteamCMD

SteamCMD is Valve's command-line installer. It pulls the dedicated server with no login (the server is a free anonymous app). As the valheim user:

# dependencies for SteamCMD (32-bit libs)
sudo dpkg --add-architecture i386 && sudo apt update
sudo apt install -y lib32gcc-s1

# install SteamCMD, then the Valheim server (app 896660)
mkdir -p ~/steamcmd && cd ~/steamcmd
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -
./steamcmd.sh +force_install_dir ~/valheim-server +login anonymous +app_update 896660 validate +quit

When it finishes you will have ~/valheim-server/valheim_server.x86_64. Re-run that same command any time to update the server.

Step 3: Launch it correctly

Valheim's server is configured entirely through launch flags. Here is the shape of a start script (~/valheim-server/start.sh):

#!/bin/bash
cd ~/valheim-server
export templdpath=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
export SteamAppId=892970
./valheim_server.x86_64 \
  -name "The Crew" \
  -port 2456 \
  -world "Midgard" \
  -password "longboat" \
  -crossplay
export LD_LIBRARY_PATH=$templdpath

Two things bite people here:

Note: the first launch generates the world and can take a minute. Watch the console for a line that says the server is connected and the world is loaded before you try to join.

Step 4: Open the right ports

Valheim uses UDP, not TCP, and it uses two consecutive ports: the one you set (2456) for the game and the next one up (2457) for the server query that makes you show up in the list. Open both:

sudo ufw allow 2456:2457/udp
sudo ufw allow OpenSSH
sudo ufw enable

Then friends connect with Join Game → Join by IP, using your address and port (your.ip.address:2456).

If you rented a box, that is it. It has a public IP with nothing in front of it. If you self-host at home, forward the ports on your router: log in, forward UDP 2456 and 2457 to the machine running the server, and give friends your home's public IP.

Step 5: Keep it running as a service

Right now the server stops the moment you close the terminal. Wrapping it in a systemd service fixes that: it starts on boot, comes back after a crash or reboot, and, the part that actually matters, stops gracefully so it saves the world instead of getting killed mid-write. Valheim saves on a clean shutdown, and the clean signal is SIGINT; a service that sends the wrong signal can corrupt a save.

[Unit]
Description=Valheim dedicated server
After=network.target

[Service]
User=valheim
ExecStart=/home/valheim/valheim-server/start.sh
# Valheim saves on SIGINT (a clean Ctrl-C), so stop it that way:
KillSignal=SIGINT
# give it time to write the world before systemd gives up
TimeoutStopSec=90
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Then sudo systemctl enable --now valheim and it launches on boot and comes back after a reboot. Watch it with journalctl -u valheim -f.

Step 6: Backups that actually restore

Your entire world is two files: <world>.db (the map and everything in it) and <world>.fwl (the metadata). By default they live in:

~/.config/unity3d/IronGate/Valheim/worlds_local/

The server also writes automatic .old backups next to them, but never rely on a backup that lives on the same box. If the VPS dies, both copies die with it. A cron job that tars those two files with a timestamp and copies them somewhere else (another box, S3, Backblaze B2) is the whole safety net. Copy them while the server is stopped, or right after a clean save, so you never grab a half-written file.

Do this once on purpose: stop the server, drop a backed-up .db/.fwl pair into the worlds folder, and start again. Proving a restore works before you need it is the difference between a backup and a rumor.

Step 7: Mods, if you want them

Valheim modding runs on BepInEx. You install the BepInEx pack on the server, drop your plugin .dll files into BepInEx/plugins, and restart. The rule that saves you a night of "why can't Bjorn join": every content mod on the server has to be on every player's client, at the same version. Client-only visual mods can differ, but anything that changes the world or items must match, or that player gets bounced at the connect screen. A client mod manager like r2modman keeps everyone's list identical, which is the easy way to stay in sync.

The honest money math

No spin. If you self-host on hardware you already own, the server is free; you are paying a little electricity to leave the machine on. If you rent, a small dedicated-vCPU box that runs Valheim comfortably is roughly $5 to $12 a month. Split across a group of five, that is a dollar or two each.

If you do split a rented box, do it the easy way: one person owns it, everyone sends their share, and you ask for the year up front so nobody chases anyone. And the number that actually matters is not the monthly one. It is that a corrupted world with a hundred hours of your crew's builds in it costs more than any box and costs it all at once. The backups in Step 6 are the real bargain.


That is the whole build: a private Valheim world that is up whenever your crew wants it, survives reboots, and that you are not scared to back up or mod. Now go raise a longhouse.