1. Install SteamCMD and the Libraries
On Ubuntu 24.04, after securing the server. Accept Steam's licence when asked; the last three packages are the ones Iron Gate lists for the Linux server:
sudo add-apt-repository -y multiverse sudo dpkg --add-architecture i386 sudo apt update sudo apt install -y steamcmd libatomic1 libpulse0 libpulse-dev sudo useradd -m -s /bin/bash steam
2. Download the Server
sudo -u steam -i /usr/games/steamcmd +force_install_dir /home/steam/valheim +login anonymous +app_update 896660 validate +quit
The server comes with a start_server.sh to edit, but a service file (next step) is easier to keep running. Try it by hand first, replacing the name, world and password:
cd ~/valheim export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH export SteamAppId=892970 ./valheim_server.x86_64 -name "My Valheim Server" -port 2456 -world "Dedicated" -password "longsecret" -public 0
Wait for the log to show the server has started, then press Ctrl+C to stop it, which saves the world. -public 0 keeps it out of the community server list; use -public 1 to list it.
3. Run It as a Service
Back as a user with sudo, create /etc/systemd/system/valheim.service:
[Unit] Description=Valheim dedicated server After=network-online.target Wants=network-online.target [Service] User=steam WorkingDirectory=/home/steam/valheim Environment=LD_LIBRARY_PATH=/home/steam/valheim/linux64 Environment=SteamAppId=892970 ExecStartPre=-/usr/games/steamcmd +force_install_dir /home/steam/valheim +login anonymous +app_update 896660 +quit ExecStart=/home/steam/valheim/valheim_server.x86_64 -name "My Valheim Server" -port 2456 -world "Dedicated" -password "longsecret" -public 0 -backups 4 KillSignal=SIGINT TimeoutStopSec=60 Restart=on-failure RestartSec=10 TimeoutStartSec=600 [Install] WantedBy=multi-user.target
sudo systemctl daemon-reload sudo systemctl enable --now valheim journalctl -u valheim -f
KillSignal=SIGINT stops the server the way Ctrl+C does, so it saves before exiting. The ExecStartPre line fetches game updates on every start, so after a patch a restart is all it takes: sudo systemctl restart valheim.
4. Open the Ports and Join
sudo ufw allow 2456:2457/udp
If you turned on the firewall on your server's page in the dashboard, allow UDP 2456–2457 there too. In Valheim, choose Join Game, then Add Server, and enter 203.0.113.10:2456 (your server's address).
For friends on Xbox or Game Pass, add -crossplay to the start line. The server then joins through the crossplay service and shows a join code in its log, which players can enter instead of the address.
Worlds, Backups and Mods
- Where worlds live: under
~/.config/unity3d/IronGate/Valheimfor thesteamuser, unless you pass-savedir. Copy that folder off the server on a schedule, to a storage box or with Borg. - Built-in backups:
-backups 4keeps four rolling copies, and-saveinterval 1800sets how often the world saves, in seconds. - Mods: BepInEx-based mods run on the server too; every player needs the same mods and versions.
A server with memory to spare can run more than one game: Palworld and Minecraft set up the same way.