How to Host a Valheim Server on a VPS

A VPS is the shortest path to a Valheim server that’s up all the time and doesn’t depend on your home internet: you get a public IP, so there’s no port forwarding, no CGNAT problem, and no arguing with a router. The work is the same Linux install you’d do at home, plus two things unique to rented machines — the provider’s own firewall, and remembering that the box is exposed to the whole internet. This walks through the order that avoids rework.

Choose the instance

Location first. Pick the region closest to most of your players. This matters more than any spec on the plan page; you cannot buy your way out of physical distance.

Then CPU quality, not quantity. Valheim’s simulation leans on single-thread speed, so a plan with two decent cores generally beats one with many weak ones. Be wary of burstable plans that advertise a peak with a much lower sustained baseline — a game server runs at steady load forever, which is the worst case for CPU credits.

Then RAM. Give yourself headroom above what you actually observe in a session rather than trusting a number from a forum post. Sizing logic is in How to Size Hardware for a Valheim Dedicated Server.

Check the bandwidth policy. Most providers include generous transfer; a few meter it tightly. A server relaying world state to several players for hours a day is not trivial traffic, so read the allowance before you’re surprised by it.

Any current long-term-support Linux distribution is fine. The examples below use Debian/Ubuntu package commands.

First ten minutes: secure the box

Do this before installing anything game-related. A fresh VPS with a public IP starts getting probed within minutes.

Create a non-root user and give it sudo:

adduser valheim
usermod -aG sudo valheim

Use SSH keys and disable password login. Copy your key up from your own machine:

ssh-copy-id valheim@your.server.ip

Then in /etc/ssh/sshd_config, set password authentication off and root login off, and restart the SSH service. Confirm you can still log in with the key in a second terminal before closing the first — that’s the mistake that locks people out of their own server.

Patch it:

sudo apt update && sudo apt upgrade -y

Install the dedicated server

The server package is free and downloads anonymously through SteamCMD, Valve’s command-line tool. Install SteamCMD from your distribution’s packages (it usually lives in a multiverse/non-free component and requires accepting a licence prompt), then pull the server:

steamcmd +force_install_dir /home/valheim/server +login anonymous +app_update 896660 validate +quit

App ID 896660 is the dedicated server; 892970 is the game itself — using the wrong one is a common half-hour lost. The Linux server also needs the 32-bit/compat libraries SteamCMD depends on; if the download fails with missing-library errors, install your distribution’s Steam runtime dependencies and retry.

For the full native-Linux walk-through, including the start script, see Install a Valheim Dedicated Server on Ubuntu Without Docker. If you’d rather not manage the install by hand, the container route is genuinely less work on a VPS: Running a Valheim Dedicated Server in Docker on Linux.

Open the ports — in two places

This is the VPS-specific gotcha. There are usually two firewalls:

1. The provider’s cloud firewall / security group. Configured in their web console, outside the machine. Add an inbound rule for UDP 2456–2458 from anywhere.

2. The firewall inside the instance. With ufw:

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

Allow SSH before enabling ufw, or you’ll disconnect yourself.

Valheim uses UDP, and it needs the game port plus the one above it for queries. Opening only 2456 gives you a server that can be joined by IP but never lists properly. The reasoning is in How to Port Forward a Valheim Server — the same port logic applies, minus the router.

Keep it running without you

An SSH session that ends kills anything started in it. Two reasonable answers:

  • A systemd service — the right answer. It starts on boot, restarts on crash, and logs where you’d expect. Unit file and gotchas: Run a Valheim Server as a systemd Service.
  • Docker with a restart policy — same benefit, if you took the container route.

screen or tmux will do for an afternoon of testing, but don’t leave a friend-group server depending on a detached terminal.

Back it up off the VPS

A rented machine can vanish for reasons that have nothing to do with you: a billing lapse, a provider incident, a fat-fingered rebuild. Provider snapshots are convenient but they live in the same account, so treat them as a convenience, not a backup.

Pull dated world archives down to a machine you own, on a schedule:

0 5 * * * rsync -a valheim@your.server.ip:/home/valheim/backups/ /home/me/valheim-backups/

The backup script itself, and how to restore, are covered in Essential Valheim Admin Commands and Automated Backups and How to Restore a Valheim World From a Backup.

Ongoing maintenance

  • Patch the server after every game update, or updated clients can’t connect. Re-run the app_update command and restart the service.
  • Patch the OS monthly at least. It’s on the public internet.
  • Watch the first real session with top and free -h to see whether you sized the instance correctly. Resizing a VPS is usually a reboot, which is a nice property.
  • Give the IP to your group once, then have everyone add it to favourites so nobody needs to remember it.

Is a VPS the right call?

It’s the best fit when your home upstream is thin, you’re behind CGNAT, you don’t want a PC running all night, or your players are far from you and near a data centre. It’s the wrong call if you already have a suitable always-on machine at home and a public IP — in that case you’re paying monthly for something you own. Compare honestly in Paid Valheim Hosting vs Self-Hosting: How to Decide.