How to run a Valheim dedicated server on Linux with SteamCMD and systemd
Tutorials

How to Run a Valheim Dedicated Server on Linux (SteamCMD and systemd)

A practical Linux guide to the Valheim dedicated server: SteamCMD, the packages it needs, a start script, a systemd service, updates, backups and common errors.

Want your own server? Valheim server hosting — plans, specs and regions.

November 23, 202610 min read
Share

On This Page

A Valheim dedicated server runs natively on Linux. You install the free Valheim Dedicated Server tool (Steam app 896660) with SteamCMD and an anonymous login, add three libraries (libatomic1, libpulse0 and libpulse-dev), and start valheim_server.x86_64 with your settings as launch flags. Add -crossplay if anyone plays on PS5, Xbox or Switch 2, and run it under systemd as its own user so it starts on boot and saves cleanly when it stops.

This guide covers the Linux side: packages, a start script, a systemd unit, updates, backups and common errors. For the general walkthrough, including Windows, read our Valheim dedicated server setup guide.

What you need

  • A 64-bit Linux machine with a reasonably current glibc. Iron Gate lists a minimum of GLIBC_2.29 and GLIBCXX_3.4.26. Check yours with ldd --version.
  • Memory to spare. An empty 1.0 world idled at about 1.3 to 1.4GB on our servers. 4GB leaves room for a group to build.
  • You do not need to own Valheim. The server tool installs with login anonymous.

Skip SteamCMD, port forwarding and the crossplay flag

The official Valheim 1.0 dedicated server, crossplay already on so PS5, Xbox and Switch 2 friends join by code, backups included. From $7.99/mo, online in 60 seconds.

Start a Valheim server

Not ready to pay? Free 3-day trial, no card →

Step 1: create a user for the server

Valve's SteamCMD guide is clear that you should not run SteamCMD as root. Give the server its own account:

sudo useradd -m valheim

Step 2: install SteamCMD and the required packages

On Ubuntu, SteamCMD is in the multiverse repository and needs 32-bit packages enabled. These are Valve's commands, plus the three libraries Iron Gate's guide lists for the server:

sudo add-apt-repository multiverse sudo dpkg --add-architecture i386 sudo apt update sudo apt install steamcmd libatomic1 libpulse0 libpulse-dev

On Debian, the steamcmd package is in the non-free section, so enable non-free and the i386 architecture first. Valve's SteamCMD page has the workaround for Debian 12 and 13, where apt-add-repository no longer works. If you install SteamCMD by hand from Valve's tarball instead, install lib32gcc-s1 first.

Step 3: download the server

Switch to the server user and pull the files into a folder of their own:

sudo -iu valheim mkdir -p ~/server ~/saves steamcmd +force_install_dir /home/valheim/server +login anonymous +app_update 896660 validate +quit

Keep +force_install_dir before +login. Valve warns about this order. The download leaves valheim_server.x86_64, a linux64/ folder and Iron Gate's own start_server.sh in ~/server.

Step 4: write your start script

Iron Gate recommends editing a copy of start_server.sh, not the original, because the original is reset on every update. Keep your copy outside the server folder, at /home/valheim/start-valheim.sh:

#!/bin/bash cd /home/valheim/server export LD_LIBRARY_PATH=/home/valheim/server/linux64:$LD_LIBRARY_PATH export SteamAppId=892970 exec ./valheim_server.x86_64 -nographics -batchmode \ -name "Odin's Rest" \ -port 2456 \ -world "Midgard" \ -password "longhouse5" \ -public 1 \ -crossplay \ -savedir /home/valheim/saves \ -saveinterval 1800 \ -backups 4 -backupshort 7200 -backuplong 43200

Then chmod 700 /home/valheim/start-valheim.sh, so only the server user can read the password, and type exit to get back to your own account. The exec makes the server the service's main process, so systemd's stop signal reaches it directly.

FlagWhat it does
-nameThe name shown in the server list
-portBase port. The server uses this port and the next one up
-worldLoads the world with this name, or creates it
-passwordAt least 5 characters, and not contained in the world name, or the server exits
-public1 lists the server in the browser. 0 hides it, leaving Join IP
-crossplayUses the PlayFab backend so any platform can join. Without it, only Steam players can see and join
-savedirWhere worlds and the admin, permitted and banned lists are kept
-saveintervalSeconds between saves (default 1800)
-backups, -backupshort, -backuplongHow many automatic backups to keep, and how often they are taken
-instanceidOnly needed if you run several crossplay servers on one port from one machine

World modifiers such as -preset and -modifier are flags too. They have their own guide.

A Valheim rider on a moose under the northern lights
A Valheim rider on a moose under the northern lights

Step 5: open the right ports

What you open depends on the backend.

ModeWhat to open
Steam backend (no -crossplay)Forward UDP 2456-2457 on the router and allow them in the firewall
Crossplay (-crossplay)Nothing. The server talks through a relay, so port forwarding is not needed

With ufw, the Steam backend rule is:

sudo ufw allow proto udp from any to any port 2456:2457

One crossplay trap on a home network: Iron Gate's guide says you cannot join a crossplay server by its local or loopback IP. If you are testing from the same house, use the join code or your public IP and port, not 192.168.x.x.

Step 6: run it as a systemd service

Create /etc/systemd/system/valheim.service:

[Unit] Description=Valheim dedicated server Wants=network-online.target After=network-online.target [Service] User=valheim WorkingDirectory=/home/valheim/server ExecStart=/home/valheim/start-valheim.sh KillSignal=SIGINT TimeoutStopSec=120 Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target

Iron Gate's guide says to stop the server with Ctrl+C, which sends SIGINT. systemd sends SIGTERM by default, so KillSignal=SIGINT makes a service stop match the official advice. TimeoutStopSec gives it time to finish writing the world before systemd gives up.

Start it and follow the log:

sudo systemctl daemon-reload sudo systemctl enable --now valheim journalctl -u valheim -f

The server is ready at Game server connected. On a crossplay server you will also see Session "Odin's Rest" registered with join code 123456. To find the current code later:

journalctl -u valheim | grep "join code" | tail -1

The code changes on every restart, so console friends need the new one after each reboot or update.

Where your saves live

With -savedir /home/valheim/saves, everything is in one place:

  • worlds_local/ holds the worlds. A world played on 1.0 is a folder named after the world, containing _main.N.db2 and _main.N.fwl2 files and a set of .chunk files. A world last saved before 1.0 is a .db and .fwl pair.
  • adminlist.txt, permittedlist.txt and bannedlist.txt sit beside it, one platform ID per line.

Without -savedir, the default is ~/.config/unity3d/IronGate/Valheim in the server user's home. To bring a world from your PC, see how to move your Valheim world to a dedicated server. Remember that Linux file names are case-sensitive, so -world must match the folder name exactly.

Updating the server

When Valheim patches, players' games update. Your server does not. Anyone on the new version sees "Incompatible version" until you update it:

sudo systemctl stop valheim sudo -iu valheim steamcmd +force_install_dir /home/valheim/server +login anonymous +app_update 896660 validate +quit sudo systemctl start valheim

Backups

The -backups flags give you rolling copies. On our 1.0 servers they appear in worlds_local as sibling folders named like Midgard_backup_auto-20260911-064050. They are useful, but they are on the same disk as the world. If the disk fails, they go too.

A simple off-disk routine is a nightly root cron job that stops the server, archives the save folder and starts it again:

0 5 * * * systemctl stop valheim; tar -czf /root/valheim-backups/saves-$(date +\%F).tar.gz -C /home/valheim saves; systemctl start valheim

Create /root/valheim-backups first, then copy the archives to another machine. Stopping first means you never archive a half-written save. Pick a quiet hour, because the restart issues a new join code.

Two Valheim players on a frozen sea beside a longship
Two Valheim players on a frozen sea beside a longship

Common Linux errors

GLIBC_2.29 or GLIBCXX_3.4.26 not found. Your distribution is too old for the server. Upgrade it, or use the Docker route in Iron Gate's guide: the server ships with docker_start_server.sh for this.

SteamCMD: error while loading shared libraries: libstdc++.so.6. SteamCMD is 32-bit. Valve's fix on Debian and Ubuntu is sudo apt install lib32stdc++6.

[S_API FAIL] SteamAPI_Init() failed. Steam's client library is not where the server expects it. Valve's fix is to link SteamCMD's steamclient.so into ~/.steam/sdk32/. Our own install also copies SteamCMD's linux64/steamclient.so into ~/.steam/sdk64/ for the 64-bit server.

A ulimit warning from SteamCMD. Valve notes this is usually only a warning. If it stops SteamCMD, raise the open-files limit with ulimit -n 2048, or in /etc/security/limits.conf as root.

The server exits straight after starting. Check the password first: under 5 characters, or contained in the world name.

A brand-new world loads instead of yours. The -world name does not match the folder name, including case, or the world is in the wrong folder.

Console players cannot see the server. -crossplay is missing. Without it the server is Steam-only.

Mods. In our testing on the 1.0 Linux server, BepInEx would only start once the crossplay library was removed, which makes the server PC-only. If anyone joins from a console, stay vanilla. More in why Valheim mods broke after 1.0.

The honest trade-off

A spare Linux box runs Valheim well, and everything above is free. What you take on is the upkeep: patching the operating system, updating the server on patch day before friends hit "Incompatible version", getting backups off the machine, and keeping the box powered and online while people want to play. If it sits on a home connection, that connection carries everyone's game.

If you would rather not own those jobs, our Valheim server hosting runs the same 1.0 dedicated server on Linux. Crossplay is on from the first boot, the join code is in your panel console, the server updates itself from Steam each time it boots, and you can import an existing world from the Server Settings tab. You also get backup slots and SFTP access. Karve has 4GB of RAM and all 10 player slots for $7.99/month, and you can try a Valheim server free for 72 hours with no card.

Valheim players working at a forge inside a wooden hall
Valheim players working at a forge inside a wooden hall

The short version

Create a valheim user, install steamcmd with libatomic1, libpulse0 and libpulse-dev, and download app 896660 with an anonymous login. Put your flags in a start script outside the server folder, add -crossplay for console friends, and run it under systemd with KillSignal=SIGINT. Forward UDP 2456-2457 only if you run without crossplay. Update with SteamCMD after every patch and copy your saves off the machine. If you would rather skip the upkeep, a hosted server does the same job.

Frequently Asked Questions

Does the Valheim dedicated server run on Linux?

Yes. Iron Gate ships a native Linux build, valheim_server.x86_64, in the free Valheim Dedicated Server tool (Steam app 896660).

Which packages does a Valheim server need on Ubuntu?

steamcmd from the multiverse repository with the i386 architecture enabled, plus libatomic1, libpulse0 and libpulse-dev, which Iron Gate lists as required.

Which ports does a Valheim server use on Linux?

The base port and the next one up, UDP 2456-2457 by default. With -crossplay the server connects through a relay, so you do not need to forward ports.

Where does a Linux Valheim server save worlds?

In worlds_local under the -savedir folder. Without -savedir, the default is ~/.config/unity3d/IronGate/Valheim in the server user's home.

How do I update a Valheim server on Linux?

Stop the service, run the same SteamCMD app_update 896660 command you installed with, and start the service again.

Can PS5, Xbox and Switch 2 players join a Linux server?

Yes, if it was started with -crossplay. They join with the six-digit code printed in the server log, which changes on every restart.

Skip SteamCMD, port forwarding and the crossplay flag

The official Valheim 1.0 dedicated server, crossplay already on so PS5, Xbox and Switch 2 friends join by code, backups included. From $7.99/mo, online in 60 seconds.

Start a Valheim server

Not ready to pay? Free 3-day trial, no card →

Or see plans, specs and regions on Valheim server hosting.

Related Help Articles

Need step-by-step instructions? Check out these guides in our Help Center.