On this page
- How much server does a Valheim world need?
- How do you install SteamCMD on Ubuntu or Debian?
- How do you download the Valheim server files?
- How do you start the server with a name, world and password?
- How do you run Valheim as a systemd service?
- Which ports does Valheim need open?
- How do you add admins and handle troublemakers?
- Where are worlds saved and how do you back them up?
- How do you update Valheim and fix common problems?
- Questions
How much server does a Valheim world need?
Plan on 2 vCPU and 4 GB of memory for a group of up to around ten Vikings on a fresh world; explored worlds with large bases and many players grow toward 6 to 8 GB. The server simulates the areas around each player, so a fast core shortens hitches when people build or fight far apart. The High Frequency plans give that per core speed, and the game servers page helps you pick a city close to your players to keep ping low.
The steps below cover Ubuntu 24.04, Ubuntu 22.04, Debian 12 and Debian 13 on 64 bit x86. Sign in with a sudo account first (see first SSH session).
How do you install SteamCMD on Ubuntu or Debian?
SteamCMD is packaged in the multiverse (Ubuntu) and non-free (Debian) sections and needs 32 bit libraries, so enable both before installing. Accept the Steam license in advance so apt does not stop at a prompt.
Ubuntu 24.04 and 22.04
sudo add-apt-repository -y multiverse
sudo dpkg --add-architecture i386
sudo apt updateDebian 12 and 13
sudo sed -i 's/^Components: main.*/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources
sudo dpkg --add-architecture i386
sudo apt updateIf your Debian install still uses /etc/apt/sources.list, add contrib non-free after main on each line there instead. Then, on any of the four systems:
echo steam steam/question select "I AGREE" | sudo debconf-set-selections
echo steam steam/license note '' | sudo debconf-set-selections
sudo apt install -y steamcmd libatomic1 libpulse0
/usr/games/steamcmd +quitThe first run updates SteamCMD itself. More detail on the tool sits in the SteamCMD guide.
How do you download the Valheim server files?
Create a dedicated account that owns the game files and worlds, then fetch the server as that user. The dedicated server is free to download with an anonymous login.
sudo adduser --disabled-password --gecos "" valheim
sudo -iu valheim
/usr/games/steamcmd +force_install_dir /home/valheim/server \
+login anonymous +app_update 896660 validate +quit
ls /home/valheim/server/valheim_server.x86_64The force_install_dir option must come before login, otherwise SteamCMD ignores it. Rerun the same command whenever the game patches; it downloads only the changed files.
How do you start the server with a name, world and password?
Wrap the launch in a small script so the library path and Steam app id are set each time. Still as the valheim user:
mkdir -p /home/valheim/data
cat > /home/valheim/start.sh <<'EOF'
#!/bin/bash
cd /home/valheim/server
export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
export SteamAppId=892970
exec ./valheim_server.x86_64 -nographics -batchmode \
-name "Example Longhouse" -port 2456 -world "Midgard" \
-password "fjord-raven-82" -public 1 \
-savedir /home/valheim/data -saveinterval 900 -backups 4
EOF
chmod +x /home/valheim/start.sh
/home/valheim/start.shRules for the password: at least five characters, and it must not appear inside the server name. -public 1 lists the server in the community browser; use 0 to join by address only. -saveinterval is in seconds and -backups sets how many rotated world backups the game keeps. To let console and PC players share the world, add -crossplay; players then join with the join code printed in the log. World modifiers such as -preset hard or -modifier raids none adjust difficulty. When the log says the game server connected, stop it with Ctrl+C and type exit to return to your sudo account.
How do you run Valheim as a systemd service?
Valheim saves the world when it receives SIGINT, so tell systemd to stop it that way and give it time to finish writing:
sudo tee /etc/systemd/system/valheim.service >/dev/null <<'EOF'
[Unit]
Description=Valheim dedicated server
After=network-online.target
Wants=network-online.target
[Service]
User=valheim
Group=valheim
ExecStart=/home/valheim/start.sh
KillSignal=SIGINT
TimeoutStopSec=90
Restart=on-failure
RestartSec=15
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now valheim
journalctl -u valheim -fWatch for the line that reports the game server as connected, then press Ctrl+C to leave the log. sudo ss -lnup | grep 245 shows the UDP sockets once the world is loaded.
Which ports does Valheim need open?
Valheim uses UDP 2456 for game traffic and 2457 for the query that the server browser reads. Open them alongside SSH:
sudo ufw allow OpenSSH
sudo ufw allow 2456:2457/udp
sudo ufw enable
sudo ufw statusPlayers can then open Join Game, choose Add server and enter 198.51.100.24:2456. With crossplay enabled, traffic goes through the game relay and the join code works even when the browser is slow to list the server. For nftables instead of ufw, use the pattern in firewall rules.
How do you add admins and handle troublemakers?
Admins are listed by platform id in adminlist.txt inside the save directory. Steam players use their 64 bit Steam id; with crossplay, ids carry a platform prefix such as Steam_. Each id goes on its own line:
sudo -u valheim nano /home/valheim/data/adminlist.txt
sudo systemctl restart valheimIn game, an admin opens the console with F5 and can use kick, ban, unban, banned and save. The matching bannedlist.txt and permittedlist.txt sit in the same folder; filling permittedlist.txt turns the server into an allow list only.
Where are worlds saved and how do you back them up?
Worlds sit in /home/valheim/data/worlds_local/ as a .db file plus a .fwl metadata file, and the rotated backups the server keeps are stored beside them. Copy both files together, ideally right after a save:
sudo -u valheim tar -czf /home/valheim/world-$(date +%F).tgz \
-C /home/valheim/data worlds_local
ls -lh /home/valheim/*.tgzPull those archives to your own computer with scp now and then. The daily backups add-on adds a full server copy each day. To move an existing single player world onto the server, upload its .db and .fwl into worlds_local, set -world to its name and restart.
How do you update Valheim and fix common problems?
After a game patch, clients and server must match. Update with the same SteamCMD line:
sudo systemctl stop valheim
sudo -u valheim /usr/games/steamcmd +force_install_dir /home/valheim/server \
+login anonymous +app_update 896660 validate +quit
sudo systemctl start valheim- Incompatible version: one side has not updated; run the update above and ask players to restart Steam.
- Not in the community list: the list can take several minutes. Join by IP or join code meanwhile.
- Server stops with a memory error: check
free -h. Large explored worlds need more RAM; move with a larger plan. - Password rejected at start: it is shorter than five characters or appears in the server name.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
| Plan | Fits because | Size | Monthly | Order from |
|---|---|---|---|---|
| F2-4 | a small group on a new world | 2 vCPU, 4 GB RAM, 128 GB NVMe | $14.40/mo | $43.20 for 3 months |
| F3-8 | busy worlds and bigger groups | 3 vCPU, 8 GB RAM, 256 GB NVMe | $28.80/mo | $86.40 for 3 months |
| F4-16 | heavily built or modded worlds | 4 vCPU, 16 GB RAM, 384 GB NVMe | $57.60/mo | $57.60 for 1 month |
Questions about Valheim dedicated server
Do I need to own Valheim to host the server?
No. The dedicated server downloads with an anonymous SteamCMD login. Players still need the game to connect.
Can Xbox and PC players share the server?
Yes, start the server with -crossplay. Console players join with the code the server prints in its log.
Can I run mods such as BepInEx?
Yes. Mod loaders install into the server folder and change the start script; every player then needs the same mods. Keep a vanilla backup of the world before you try them.
How do I change the world without losing the old one?
Set a new name with -world in start.sh and restart. The old world files stay in worlds_local and you can switch back at any time.
Why does the stop take so long?
The server writes the whole world on SIGINT. Larger worlds take longer, which is why the unit allows 90 seconds before forcing a stop.