Use case · Game server

Valheim dedicated server on Linux, from SteamCMD to systemd

A Valheim dedicated server on Linux is Iron Gate's free server program (SteamCMD app 896660), started from a copy of start_server.sh with your world name, port and password, and reachable on ports 2456-2457 or, with -crossplay, through a relay that needs no port forwarding. Iron Gate publishes no CPU or memory requirement, so the machine is sized from your world and your group, not from a spec sheet.

See the game servers

What the server needs from the machine

Iron Gate's own guide lists libraries and ports, not hardware. It states no core count, no memory figure and no player-per-gigabyte rule, and any number you see quoted elsewhere is somebody's estimate. What the guide does fix is this:

ItemIron Gate's guide
InstallValheim Dedicated Server, a Steam tool; SteamCMD app ID 896660
C librariesAt least GLIBC_2.29 and GLIBCXX_3.4.26; older systems can use the bundled Docker script
Extra packageslibatomic1, libpulse-dev, libpulse0
PortsThe chosen port and port+1; default 2456-2457
Save path (Linux)~/.config/unity3d/IronGate/Valheim, or wherever -savedir points
Ready signalThe log prints 'Game server connected'

Check the C library on a candidate system with ldd --version before you install anything. A current Ubuntu or Debian release clears the floor; very old images do not.

Sizing without a published spec

With no vendor figure to copy, size by observation. Start the world, let your group play an evening with everyone spread out across biomes, and watch resident memory and per-core load with top or systemd-cgtop. A world grows: bases, portals and explored land accumulate, so the figure at week one is not the figure at month six.

  • Players in different places load more of the world at once than players standing together.
  • Large bases with many placed pieces make each save and each sync heavier.
  • Save time grows with the world file; -saveinterval sets how often you pay it (1800 seconds by default).
  • Leave memory headroom for backups being written while the game runs.

A whole machine makes that measurement honest. Nothing else on the host takes cores or RAM, so the numbers you read are the numbers the game gets, and you can run a second world or a test copy beside it without asking anyone.

Install with SteamCMD

On Ubuntu, SteamCMD is a package in multiverse and needs the i386 architecture. Run the server as its own unprivileged user, never as root.

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

sudo useradd -m -s /bin/bash valheim
sudo -u valheim /usr/games/steamcmd +force_install_dir /home/valheim/server \
  +login anonymous +app_update 896660 validate +quit

sudo ufw allow 2456:2457/udp

Anonymous SteamCMD login for 896660 is not guaranteed. Players reported in November 2024 that anonymous requests for this app stopped returning data for several days before working again. If +login anonymous fails, wait and retry: the 2024 outage cleared on its own after about a week. During it, even Steam accounts that did not own Valheim could not see the app, so a fresh throwaway account is no workaround.

Iron Gate's guide gives the port range but not a protocol. The game's traffic is UDP, which is what the firewall rule above opens. With -crossplay no inbound rule is needed at all.

The start script and its flags

Copy start_server.sh before editing it: a Steam update, and the validate step above, reset the original. Then set the launch line in the copy.

cd /home/valheim/server
cp start_server.sh start_world.sh
# in start_world.sh, edit the launch line, for example:
./valheim_server.x86_64 -name "Northern Hall" -port 2456 -world "Hall" \
  -password "use-a-long-one" -public 0 -savedir /home/valheim/saves \
  -saveinterval 1800 -backups 4
FlagWhat it does
-nameName shown in the server list
-portBase port; the server also takes port+1
-worldWorld to load, created if it does not exist
-passwordJoin password
-public1 lists the server (default); 0 hides it, join by IP
-crossplayPlayFab backend: any platform joins via a relay, no port forwarding
-savedirOverrides where worlds and permission lists live
-saveintervalSeconds between saves; default 1800
-backupsAutomatic backups kept; default 4

Without -crossplay the Steam backend is used and only Steam players can see and join. With it, players connect by public IP and port, a join code or the server list, but not by a local or loopback address. If you run several crossplay servers on the same port from the same machine (same MAC address), give each a unique -instanceid so that each gets its own PlayFab ID.

Running it as a systemd service

Iron Gate says to stop the server with Ctrl+C so it shuts down cleanly. Ctrl+C is SIGINT, so tell systemd to send that and give the save time to finish.

# /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/server/start_world.sh
KillSignal=SIGINT
TimeoutStopSec=120
Restart=on-failure

[Install]
WantedBy=multi-user.target

Enable it with sudo systemctl enable --now valheim and follow the log with journalctl -u valheim -f until 'Game server connected' appears. To update after a patch: stop the unit, rerun the SteamCMD line, start it again. Your start_world.sh survives because it is not a file Steam ships.

Saves, backups and admin lists

  • Worlds live in ~/.config/unity3d/IronGate/Valheim of the server user, or in the -savedir path. Point -savedir at its own directory so one copy job takes everything.
  • By default the server keeps 4 automatic backups: one 2 hours old (-backupshort 7200) and three 12 hours apart (-backuplong 43200). They share a disk with the world itself, so copy them off the machine too.
  • adminlist.txt, bannedlist.txt and permittedlist.txt sit in the save path, one Platform User ID per line in the form [Platform]_[User ID]. Any entry in the permitted list locks everyone else out.
  • Copy saves while the unit is stopped, or right after a save, to avoid catching a half-written file.

Which of our machines fit

Our game server hosting on bare metal gives the world a physical machine: HPE enterprise hardware, root, any operating system, support around the clock by phone, email and live chat. Every rack server and blade carries an out-of-band controller (HPE iLO, Dell iDRAC or a Supermicro BMC) with a browser console, so a host that will not boot is still yours to fix. A racked machine is live about 30 minutes after the order is approved; a build to your own specification takes 4-24 hours.

Each dedicated server comes with an unmetered port and one IPv4 address: 1 Gbps on most lines, 500 Mbps on the others. Pick the city nearest your players from New York, Miami, San Francisco, Amsterdam and Bucharest, and compare the five on the data centre page first. A Linux dedicated server with a current Ubuntu image is the shortest path to the setup above.

When a whole machine is overkill

Three friends who play on Friday nights do not need a rented server; one of them can run the same program at home and forward two ports. A dedicated machine pays off when the world must be up while the host player is away, when a community plays across time zones, or when you want one box to carry several worlds or other game servers, such as a Palworld world, side by side.

Questions

How much RAM does a Valheim server need?

Iron Gate does not publish a figure. Run your world with your group, watch resident memory over a few sessions, and keep generous headroom because the world file and its saves grow as players build and explore.

Which ports must be open for Valheim?

The base port and the one above it, 2456 and 2457 by default. If you start the server with -crossplay, traffic goes through a relay and you need no port forwarding; the port then only tells servers on one public address apart.

Where does a Linux Valheim server keep its worlds?

In ~/.config/unity3d/IronGate/Valheim of the user that runs it, unless -savedir sets another path. The permission lists for admins, bans and allowed players live in the same place.

Can Xbox players join a Linux server?

Yes, if the server runs with -crossplay. Iron Gate's guide says the crossplay backend lets users from any platform join; without it only Steam users can see and join.

Why does my edited start_server.sh keep resetting?

Steam updates and SteamCMD's validate step restore the shipped file. Iron Gate's advice is to work on a copy, which is why the service unit above starts start_world.sh rather than the original.

Can I run more than one world on one machine?

Yes. Give each instance its own base port two apart, such as 2456 and 2458, its own -savedir and its own service unit. If you run several crossplay servers on the same port from the same machine (same MAC address), give each a unique -instanceid so that each gets its own PlayFab ID.

A machine for the world

Pick a city near your players, install Ubuntu, and run the steps above on a server nobody else shares.

See the game servers

Related on Server Room

Other use cases