LochStudios  /  Help Centre  /  Game Servers  /  Set up a Valheim dedicated server

Set up a Valheim dedicated server

Install SteamCMD and the official Valheim dedicated server on a LochStudios KVM VPS so the world stays up when nobody is hosting from the game client.

Updated

Valheim is a Norse survival game. A dedicated server on a LochStudios KVM VPS keeps the same world online so you and friends can join whenever you like, without one player hosting from their PC.

This is not a cPanel or shared-hosting job. You need a Linux VPS (Ubuntu 22.04 or 24.04 LTS is the usual pick) and SSH. Need a machine first? Browse VPS. Unsure which size? Open a support ticket and tell us how many people will play.

Credentials, the IPv4, and an out-of-band console sit on that server in the portal. Sign in at the portal, open the VPS, and copy the login from there. Do not guess a hostname.

Before you start

  1. Sign in at the portal, open the VPS service, and keep that page open.
  2. Connect with a sudo user, or root on a fresh box.

- Connect to your VPS via SSH from macOS or Linux
- Connect to your VPS via SSH from Windows

  1. Patch the box and use a daily sudo user: First steps on a new VPS.
  2. Install SteamCMD under a dedicated steam user: Install SteamCMD on Linux.
  3. Leave at least 10 GB free. The server files are under 2 GB. Worlds and backups grow.
  4. Plan on UDP 2456-2458. The process uses the -port you set (2456 by default) and the next port for the Steam query.

If SSH from your computer will not connect, open the console on the same VPS service. That session does not need port 22 from your network.

Install the extra libraries the Linux binary expects (from your sudo account, not as steam):

sudo apt update
sudo apt install -y libatomic1 libpulse0

Step 1: Download the Valheim server

Log in as the steam user and pull Steam app 896660. That is the dedicated server tool. You do not need a Steam password on the VPS, and the VPS does not need its own Valheim licence. Every player who joins still needs to own the game.

su - steam
cd ~/steamcmd
./steamcmd.sh +force_install_dir ~/valheim +login anonymous +app_update 896660 validate +quit

Wait until SteamCMD prints Success! and App '896660' fully installed.

Do not use app 896666 or the game app 892970. Those will not install this server.

Step 2: Check the files

ls -la ~/valheim/valheim_server.x86_64

You should see that binary, a bundled start_server.sh, and a linux64 folder.

Do not edit start_server.sh. Steam overwrites it on every update. Use your own script in the next step.

Step 3: Create a startup script

Still as steam:

nano ~/valheim_start.sh

Paste this, then change the name, world, and password:

#!/bin/bash
export LD_LIBRARY_PATH=~/valheim/linux64:$LD_LIBRARY_PATH
export SteamAppId=892970
cd ~/valheim

./valheim_server.x86_64 \
  -nographics \
  -batchmode \
  -name "Your Server Name" \
  -port 2456 \
  -world "MyWorld" \
  -password "change-me-now" \
  -public 1 \
  -crossplay

SteamAppId=892970 is required. That is the game app id. The dedicated server will not start correctly without it.

Password rules:

  • At least five characters.
  • Must not appear inside the server name (and must not be the same as the name). A name of Loch Vikings with the password vikings will refuse to start.

-crossplay lets PC and console players use the same world. Traffic then goes through a relay, so friends can also join with a join code. Leave it off if you only want Steam players connecting straight to the VPS IPv4.

-public 1 lists the server. Use -public 0 if you want it hidden and joinable only by IP (and password).

Save the file (Ctrl+X, then Y, then Enter) and make it executable:

chmod +x ~/valheim_start.sh

Step 4: Open the ports

Two filters can block players. Open both.

Portal Firewall tab (the filter in front of the VPS):

  1. Sign in at the portal and open the VPS.
  2. Open the Firewall tab.
  3. If no rules are listed, we are not filtering at that layer. Skip to UFW.
  4. If you already added Drop rules, add an Accept for UDP 2456-2458 and keep an Accept for SSH (22, TCP) ahead of any Drop.

Full walkthrough: Open the Right Firewall Ports for Your Game Server.

UFW on Ubuntu or Debian (from your sudo account, not steam):

sudo ufw allow 2456:2458/udp
sudo ufw reload
sudo ufw status

Allow SSH (22/tcp) before you ever run sudo ufw enable. See Set up a UFW firewall on Ubuntu.

If a rule locks you out of SSH, use the console on the VPS, or open a support ticket.

Step 5: Start the server

As steam:

su - steam
~/valheim_start.sh

Wait until the log shows the Valheim version and a line like Game server connected. The world is then accepting players.

Leave that terminal open while you test. Ctrl+C is the clean stop. Do not kill the window another way or the process can keep running in the background.

Step 6: Join from the game

On your PC:

  1. Copy the VPS IPv4 from the portal.
  2. Launch Valheim.
  3. Click Start Game, then Join Game.
  4. Add the address as YOUR-VPS-IPV4:2456 (Community, Join IP, or the address box, depending on the client build).
  5. Enter the password from your start script.

Friends use the same IPv4 and port. With -crossplay they can also use the join code the server prints.

If nobody can connect, re-check the Firewall tab, sudo ufw status, and that the process is still running. Still stuck? Open a support ticket and include the VPS service, the IPv4, and the port. Do not put the server password in the ticket.

Keep it running after you disconnect

For a first test, run it in screen or tmux so SSH can close without stopping the world. See Run a game server persistently with screen or tmux.

su - steam
screen -S valheim
~/valheim_start.sh

Detach with Ctrl+A, then D. Reattach with screen -r valheim.

For something that comes back after a reboot or a crash, use a systemd unit: Keep a Game Server Running and Auto-Restarting with systemd. Point ExecStart at /home/steam/valheim_start.sh and run the service as steam.

Update the server

Stop the process first (Ctrl+C in the screen session, or stop the systemd unit). Then, as steam:

su - steam
cd ~/steamcmd
./steamcmd.sh +force_install_dir ~/valheim +login anonymous +app_update 896660 validate +quit

Start the script again. Your ~/valheim_start.sh is outside the install folder, so Steam will not overwrite the name, world, or password.

World files and backups

Default save directory for the steam user:

~/.config/unity3d/IronGate/Valheim/

Current builds keep world files in worlds_local/ (MyWorld.db and MyWorld.fwl if you used -world "MyWorld"). Older builds used worlds/. Admin, ban, and permit lists live in that same Valheim folder.

Copy that whole directory on a schedule. Stop the server first if you can, so you do not snapshot a half-written save. Steps: Back Up and Restore a Game Server World or Save.

You can point saves at a folder you choose with -savedir /home/steam/valheim-saves in the start script. Create that directory as steam before you start.

Notes

  • Name length: keep the public name short (under 32 characters) so it displays cleanly in the list.
  • Player cap: 10 people per world. That is the game limit, not a plan limit.
  • RAM and CPU: a small co-op world is light. A long-lived, built-out world uses more. Watch it with Monitor Server Resources. If the VPS is tight, resize from the portal or open a support ticket.
  • Modifiers: you can add official flags such as -preset hard or -modifier raids none to the start script. Restart the server after you change them.
  • Permissions: adminlist.txt, bannedlist.txt, and permittedlist.txt sit in the save directory. One platform user id per line. A non-empty permitted list blocks everyone who is not on it.

Need a hand with the VPS, the firewall, or a world that will not load? Open a support ticket.


Was this article helpful?

← Back to Game Servers