On this page

A dedicated Valheim server is useful when the world should stay available after the person who normally hosts leaves the game. It is still a Linux server. Give it a separate account, open only the game ports, and make a copy of the world before an update.

This guide installs the official Valheim Dedicated Server tool with SteamCMD on Ubuntu 24.04. It runs the service under a non-root valheim account and keeps saves in /srv/valheim/saves. It does not install mods, expose a web panel, or promise a particular player count. Add those only after the plain server works.

This is a Steam direct-IP setup. It does not enable -crossplay. If people in your group need crossplay, stop here and read the manual bundled with the current dedicated-server tool before changing the launch line. Crossplay changes the connection path and needs its own player test.

The Valheim Dedicated Server is Steam app 896660, a separately released tool with a Linux depot. SteamDB's current record is useful for checking that identity, but install and update it through SteamCMD rather than downloading files from a third party.

Choose who will operate the server

Hosting from a player’s own machine suits sessions that only need to run while that player is available. A managed game host may suit a group that wants someone else to handle the server platform; check its backup, update and support scope. Choose a self-managed Droplet only if you will maintain Linux, monitor load and rehearse restoring saves.

Budget for compute, backups, retained storage and excess outbound transfer. Bundled CPU plans cap compute usage at 672 hours per month; v5 configurations have no monthly cap. Powered-off bundled Droplets still incur charges until destroyed. Check the current billing rules and backup charges before provisioning. Billing details checked October 2, 2026.

Choose the small-server boundary first

Start with a current Ubuntu LTS Droplet in a region that is reasonably close to the people playing. Choose the plan after checking the current price in the control panel. Choose memory and CPU against your actual world and measure load with your group; this guide has no tested capacity or player-count result. World size, mods, concurrent players, and other processes all change the answer.

At creation, attach an SSH key, turn on monitoring and backups, and use a tag such as valheim. DigitalOcean recommends a VPC, IPv6, monitoring, and backups for a new Droplet. Their setup guide explains what each option covers. Droplet backups are not a substitute for a save archive you have restored yourself.

Create a tag-based cloud firewall before inviting anyone. Allow these inbound rules:

ProtocolPortSourceWhy
TCP22Your fixed IP or VPN exitAdministrator SSH only
UDP2456-2457AnywhereValheim game traffic and server query

Keep outbound traffic allowed. Do not add TCP 2456 or a broad port range because a forum post said to. If you later choose a different SERVER_PORT, change the firewall to that port and the following UDP port as a deliberate paired change. A private server is controlled by SERVER_PUBLIC=0; the firewall still needs to allow players to reach it.

If this is your first Droplet, make those choices in this order: create the Ubuntu 24.04 LTS Droplet with your SSH key and the valheim tag, create the firewall against that tag, then connect with ssh using the Droplet IP shown in the control panel. Keep that first SSH session open until the firewall and service checks below work.

Create the named administrator before the SteamCMD step. operator below is an example login and is separate from the restricted valheim service account. adduser asks you to set that administrator's local password for sudo; do not paste it into a command. Keep the original root session open. Add your own public key to the new account, then confirm a second key-authenticated SSH session and that sudo id -u prints 0. Do not disable the old access path until this succeeds. DigitalOcean's recommended setup explains the non-root/key boundary.

Shell command
# In the original root SSH session on the fresh Droplet:
adduser operator
usermod -aG sudo operator
install -d -o operator -g operator -m 700 /home/operator/.ssh
# Use only the public key you intend to authorize for this named administrator.
nano /home/operator/.ssh/authorized_keys
chown operator:operator /home/operator/.ssh/authorized_keys
chmod 600 /home/operator/.ssh/authorized_keys
Shell command
# In a NEW terminal on your workstation:
ssh operator@YOUR_DROPLET_IP
id
sudo -v
sudo id -u

Install the server under its own account

Connect with the non-root administrator you created with your SSH key. Install SteamCMD and the small set of runtime packages, then create directories that the game account owns. Ubuntu can prompt you to enable the multiverse repository before it offers the steamcmd package. Follow the prompt and confirm steamcmd exists before continuing.

Shell command
sudo apt-get update
sudo apt-get install -y steamcmd libatomic1 libpulse0
sudo adduser --system --group --home /srv/valheim valheim
sudo install -d -o valheim -g valheim -m 750 /opt/valheim/server /srv/valheim/saves
sudo -u valheim /usr/games/steamcmd \
  +@sSteamCmdForcePlatformType linux \
  +force_install_dir /opt/valheim/server \
  +login anonymous \
  +app_update 896660 validate \
  +quit

If SteamCMD refuses anonymous access, stop there and follow the current Steam prompt with an account entitled to install the dedicated-server tool. Do not put a Steam password or Steam Guard code in a systemd unit, shell history, or a file on the Droplet.

Confirm the server binary exists and record the installed files before you make it start automatically.

Shell command
sudo -u valheim test -x /opt/valheim/server/valheim_server.x86_64
sudo -u valheim find /opt/valheim/server -maxdepth 1 -type f -printf '%f\n' | sort | sed -n '1,40p'

The companion repository holds the launcher, service file, backup command, and update command used below. Clone it now if you want files you can inspect instead of rebuilding them from the article.

Shell command
git clone https://github.com/TylorMayfield/valheim-droplet-server.git /tmp/valheim-droplet-server
git -C /tmp/valheim-droplet-server checkout --detach 97df09b81f7503c381356b18e9c51d3315b6e17b
test "$(git -C /tmp/valheim-droplet-server rev-parse HEAD)" = 97df09b81f7503c381356b18e9c51d3315b6e17b

Keep the server settings out of the service file

The password belongs in a root-readable environment file, not in the unit or a command copied into a shared terminal. Use a distinct world name and a strong password. Do not reuse an account password. Valheim requires at least five password characters, and the password cannot appear in the server name. SERVER_PUBLIC=0 keeps the server out of the public list; set it to 1 only when you intend that visibility.

Shell command
sudo install -d -m 750 /etc/valheim
sudo nano /etc/valheim/server.env
/etc/valheim/server.env
SERVER_NAME="Your server name"
WORLD_NAME=your_world
SERVER_PASSWORD=replace-with-a-long-unique-password
SERVER_PORT=2456
SERVER_PUBLIC=0
SAVE_DIR=/srv/valheim/saves
Shell command
sudo chown root:valheim /etc/valheim/server.env
sudo chmod 640 /etc/valheim/server.env

Create a small launcher. It passes the configuration from the environment, sets the Steam app ID expected by the server, and uses a predictable save directory. This is the one command path that systemd and any later maintenance procedure share. If you cloned the companion, install its reviewed copy instead of making this file by hand.

Shell command
sudo install -m 750 -o valheim -g valheim /tmp/valheim-droplet-server/scripts/start-valheim.sh /opt/valheim/server/start-valheim.sh

Otherwise, create the file before pasting the following content:

Shell command
sudo nano /opt/valheim/server/start-valheim.sh
/opt/valheim/server/start-valheim.sh
#!/usr/bin/env bash
set -euo pipefail

export SteamAppId=892970
export LD_LIBRARY_PATH="$PWD/linux64:${LD_LIBRARY_PATH:-}"

exec ./valheim_server.x86_64 \
  -nographics \
  -batchmode \
  -name "$SERVER_NAME" \
  -port "$SERVER_PORT" \
  -world "$WORLD_NAME" \
  -password "$SERVER_PASSWORD" \
  -public "$SERVER_PUBLIC" \
  -savedir "$SAVE_DIR"
Shell command
sudo chown valheim:valheim /opt/valheim/server/start-valheim.sh
sudo chmod 750 /opt/valheim/server/start-valheim.sh

Run Valheim with systemd and verify the socket

The unit gives the game a controlled restart policy and a single journal to inspect. Restart=on-failure is intentional. It will restart after a crash, but it will not hide a deliberate administrator stop.

/etc/systemd/system/valheim.service
[Unit]
Description=Valheim dedicated server
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=valheim
Group=valheim
WorkingDirectory=/opt/valheim/server
EnvironmentFile=/etc/valheim/server.env
ExecStart=/opt/valheim/server/start-valheim.sh
Restart=on-failure
RestartSec=10
TimeoutStopSec=120
LimitNOFILE=100000
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target

If you cloned the companion, use sudo install -m 644 -o root -g root /tmp/valheim-droplet-server/config/valheim.service /etc/systemd/system/valheim.service rather than making this file by hand. Otherwise create it first with sudo nano /etc/systemd/system/valheim.service.

Shell command
sudo systemctl daemon-reload
sudo systemctl enable --now valheim
sudo systemctl status valheim --no-pager
sudo journalctl -u valheim -n 80 --no-pager
sudo ss -ulnp | grep -E ':2456|:2457'

Wait for a normal startup message in the journal before asking a player to join. Then have one player add YOUR_DROPLET_IP:2456 in Valheim's Join IP screen. A green systemd status proves only that the process is alive. A successful join proves the firewall, server, game version, and player route work together.

If the server starts but players cannot join, inspect the cloud firewall first, then compare the port in /etc/valheim/server.env with ss -ulnp. Do not turn off the firewall or run the service as root to work around a port mistake.

Back up and update as separate maintenance jobs

Stop the server before copying its world files. That is the simple, conservative choice when the group can tolerate a few minutes of maintenance. Create an archive in a protected local directory, inspect it, then copy it to a private recovery destination. The companion backup command reads the actual SAVE_DIR from /etc/valheim/server.env and restarts a previously running service even when the archive fails. The existing Minecraft-to-Spaces backup guide shows the storage and restore discipline; adapt the storage path for Valheim rather than running its Minecraft script unchanged.

Shell command
sudo install -m 700 -o root -g root /tmp/valheim-droplet-server/scripts/backup-valheim-world /usr/local/sbin/backup-valheim-world
sudo /usr/local/sbin/backup-valheim-world

Test one archive in an empty directory before you call this backup routine complete. A tested restore means the expected .db and .fwl files are present for the world you plan to recover. It does not prove the world will load until you start an isolated server from that copy.

For updates, announce a maintenance window, take the archive, then run the companion update command. It stops a running service, runs SteamCMD as valheim, and brings the service back if SteamCMD fails. Do not automatically update before every launch until you have decided how your group handles game-version mismatches and mod compatibility.

Shell command
sudo install -m 700 -o root -g root /tmp/valheim-droplet-server/scripts/update-valheim-server /usr/local/sbin/update-valheim-server
sudo /usr/local/sbin/update-valheim-server

What this setup is and is not for

ApproachGood fitTrade-off
This Droplet serverA small group that wants a world online independently of one player's PCYou administer Linux, updates, and backups
A player's local hostA short session with everyone availableThe world ends when the host leaves
A managed game hostPeople who do not want server administrationLess control and a provider-specific bill

Use this route if your group is comfortable treating the server as something that needs updates and recovery practice. Skip it if nobody can own those jobs. A hosted world that silently fails after an update is worse than a local session that ends on time.

Companion source reviewed 8 October 2026: 97df09b81f75. This fixes the script revision, not the Steam build. Record git rev-parse HEAD and the installed dedicated-server build before the first isolated world-load rehearsal; no live result is asserted here.

Frequently asked questions

Which ports does a Valheim server need on a Droplet?

With the default SERVER_PORT=2456, allow UDP 2456 and UDP 2457 in the cloud firewall. If you change the configured port, update the paired UDP rule at the same time and verify the listening sockets after restart.

Do players need SSH access to join?

No. Players connect through the Valheim UDP ports. Keep SSH limited to the administrator's fixed IP or VPN exit and do not share that access with players.

Can I use mods on this server?

Yes, but treat a modded server as a separate deployment. Pin compatible game and mod versions, record every added file, and test an update against a copied world before changing the active server.

Are Droplet backups enough for a Valheim world?

No. They are one recovery layer. Keep a separate world archive, store it privately, and restore one before relying on it. Neither the commands in this guide nor a local archive prove a live player can join after a provider outage.

Next steps

Keep the server plain until one player has joined and you have inspected an archive. Then add a scheduled backup with alerting, a written update window, and a simple list of people authorized to administer the Droplet. That is a much better use of time than adding a panel before you know how to recover the world.