How to Install Valheim Dedicated Server on Ubuntu 24.04
Running your own Valheim dedicated server gives your group a persistent Viking world that stays online 24/7, even when the host is offline. You get full control over the save files, admin commands, mods, and backups, and you pay a flat monthly rate regardless of how many players join. This guide walks through every step from a fresh Ubuntu 24.04 VPS to a production-ready server with systemd, crossplay, BepInEx mods, and automated backups.
Want an easier path? Our CloudCore Starter VPS runs Valheim comfortably for under EUR 8 per month. Deploy a Starter VPS and follow along.
Table of Contents
Why Self-Host Valheim?
Valheim is a lightweight game from a server perspective. A dedicated instance typically consumes around 2 GB of RAM, one or two CPU cores, and minimal bandwidth. That makes it a perfect candidate for a small VPS rather than a managed game-hosting plan.
Cost savings vs managed hosting:
| Hosting option | Typical monthly cost | Slots | Mods allowed | SSH access |
|---|---|---|---|---|
| Managed Valheim host (10 slots) | EUR 15 - 25 | 10 | Limited | No |
| Shared game panel | EUR 8 - 12 | 10 | Some | No |
| CloudCore Starter VPS | EUR 7.99 | Unlimited | Any | Yes |
- Full filesystem access for instant backups, mod sideloading, and save migration
- No slot limits -- Valheim allows up to 10 concurrent players regardless of host
- Any mod you want via BepInEx, not a curated subset
- Room to grow -- add a Terraria or Factorio server on the same box later
- Data ownership -- your world file, your schedule, your SSH key
Prerequisites
Before you begin, make sure you have:
- A VPS running Ubuntu 24.04 LTS with root or sudo access
- SSH access (OpenSSH on Linux/macOS, PuTTY or Windows Terminal on Windows)
- At least 4 GB of RAM and 2 vCPU cores
- At least 10 GB of free disk space for the server files, world saves, and backups
- The SteamID64s of every intended admin (look yours up at steamid.io)
Recommended Plan: CloudCore Starter>
Valheim is light, but it still needs predictable CPU scheduling and steady bandwidth. The CloudCore Starter plan is the sweet spot:>
- 2 vCPU cores
- 4 GB RAM
- 50 GB NVMe SSD
- Unmetered bandwidth
- EUR 7.99/month>
That is enough for a 10-player Valheim world plus OS overhead, with headroom for a Discord bot or backup script on the side.
Connect to your server via SSH to get started:
ssh root@your-server-ipStep 1: Update System and Install Dependencies
Start by updating your package index and installing the 32-bit libraries SteamCMD requires. Valheim's server binary itself is 64-bit, but SteamCMD ships as a 32-bit tool.
sudo dpkg --add-architecture i386
sudo apt update && sudo apt upgrade -y
sudo apt install -y \
curl wget tar unzip \
lib32gcc-s1 libsdl2-2.0-0 \
ufw rsyncExpected output (abbreviated):
Setting up lib32gcc-s1 (14.2.0-4ubuntu2) ...
Setting up libsdl2-2.0-0:amd64 (2.30.0+dfsg-1) ...
Setting up steamcmd dependencies ...If the kernel was updated, reboot before continuing:
sudo rebootStep 2: Create the steam User
For security, never run SteamCMD or the Valheim server as root. Create a dedicated unprivileged user called steam:
sudo useradd -m -s /bin/bash steam
sudo passwd steamSwitch to the new user for the remaining install steps:
sudo -iu steamYour prompt should now read something like steam@your-server:~$. Every command from here through Step 5 runs as this user.
Step 3: Install SteamCMD
SteamCMD is Valve's command-line client for downloading game server binaries. Install it into the steam user's home directory:
mkdir -p ~/steamcmd && cd ~/steamcmd
curl -sSL https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz | tar -xzVerify the installer:
ls -l ~/steamcmdYou should see steamcmd.sh and a linux32 directory. Launch SteamCMD once to pull its self-updates:
./steamcmd.sh +quitExpected output (abbreviated):
Redirecting stderr to '/home/steam/Steam/logs/stderr.txt'
[ 0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation - version ...
Loading Steam API...OKSteamCMD is ready.
Step 4: Install the Valheim Server Files
The Valheim dedicated server is Steam app ID 896660 (this is separate from the game itself, which is app 892970). Download it with SteamCMD into ~/valheim:
~/steamcmd/steamcmd.sh \
+force_install_dir /home/steam/valheim \
+login anonymous \
+app_update 896660 validate \
+quitThe anonymous login works because the dedicated server is a free download. Expect roughly 1 GB of data and a few minutes on typical VPS bandwidth.
Expected final output:
Success! App '896660' fully installed.Confirm the files landed correctly:
ls ~/valheimYou should see valheim_server.x86_64, start_server.sh, start_server_xterm.sh, and supporting .so libraries.
Step 5: Create the Custom Start Script
The bundled start_server_xterm.sh assumes an X11 session, which a headless VPS does not have. Replace it with a clean script that reads the server name, world name, and password from environment variables, making the systemd unit in Step 7 cleaner.
Create ~/valheim/start.sh:
cat > ~/valheim/start.sh <<'EOF' #!/usr/bin/env bash set -euo pipefailDefaults -- override via systemd Environment= entries
: "${SERVER_NAME:=My Valheim Server}" : "${WORLD_NAME:=Midgard}" : "${SERVER_PASS:=changeme12}" : "${SERVER_PORT:=2456}"export LD_LIBRARY_PATH="/home/steam/valheim/linux64:${LD_LIBRARY_PATH:-}" export SteamAppId=892970
cd /home/steam/valheim
exec ./valheim_server.x86_64 \ -name "${SERVER_NAME}" \ -port "${SERVER_PORT}" \ -world "${WORLD_NAME}" \ -password "${SERVER_PASS}" \ -public 1 \ -crossplay \ -savedir /home/steam/.config/unity3d/IronGate/Valheim \ -logFile /home/steam/valheim/logs/valheim-$(date +%Y-%m-%d).log EOF
chmod +x ~/valheim/start.sh mkdir -p ~/valheim/logs
Key flags explained:
-name-- The display name in the server browser. Supports spaces when quoted.-port 2456-- The main game port. The server also binds 2457 and 2458 automatically.-world "Midgard"-- Matches the.fwland.dbfilenames in the save directory.-password-- Valheim requires passwords of at least 5 characters and will refuse to start otherwise. The password cannot appear inside the server name.-public 1-- Advertises the server in the community list. Set to0for a whitelist-style private server.-crossplay-- Registers the server with the Microsoft Playfab backend so Xbox and PlayStation players can connect. Without this flag, only Steam players can see it.-savedir-- Explicit save path so backups and admin files are easy to find.-logFile-- Writes a dated log file for troubleshooting; still mirrors to journal via systemd.
Security tip: Change SERVER_PASS in Step 7 to something unique. Do not reuse your Steam password.Step 6: Open the UDP Firewall Ports
Valheim uses three consecutive UDP ports. Many guides only open 2456; that leaves the server invisible to the server browser because the Steam query port (2457) is blocked.
Switch back to your sudo-capable user first:
exit # back to the admin userConfigure UFW:
sudo ufw allow 22/tcp comment 'SSH'
sudo ufw allow 2456:2458/udp comment 'Valheim'
sudo ufw --force enable
sudo ufw status numberedExpected output:
Status: active
To Action From
-- ------ ----
[ 1] 22/tcp ALLOW IN Anywhere # SSH
[ 2] 2456:2458/udp ALLOW IN Anywhere # ValheimIf your VPS provider also exposes a network-level firewall (Contabo Cloud Panel, OVH Network Firewall, Hetzner Firewalls), mirror the same rule there.
Step 7: Create the systemd Service
Running the server under systemd gives you automatic restarts on crash, start-on-boot, and unified log access with journalctl.
Create the unit file:
sudo tee /etc/systemd/system/valheim.service > /dev/null <<'EOF' [Unit] Description=Valheim Dedicated Server After=network-online.target Wants=network-online.target[Service] Type=simple User=steam Group=steam WorkingDirectory=/home/steam/valheim
Environment="SERVER_NAME=My Viking Hall" Environment="WORLD_NAME=Midgard" Environment="SERVER_PASS=ReplaceThisPass" Environment="SERVER_PORT=2456"
ExecStart=/home/steam/valheim/start.sh
Restart=on-failure RestartSec=15 TimeoutStopSec=60 KillSignal=SIGINT
Hardening
NoNewPrivileges=true PrivateTmp=true ProtectSystem=full ProtectHome=read-only ReadWritePaths=/home/steam/valheim /home/steam/.config
[Install] WantedBy=multi-user.target EOF
Edit the three Environment= lines to your own server name, world name, and a strong password (minimum 5 characters, cannot match the server name).
Reload systemd, enable the service at boot, and start it:
sudo systemctl daemon-reload
sudo systemctl enable valheim.service
sudo systemctl start valheim.serviceCheck status:
sudo systemctl status valheim.serviceExpected output (abbreviated):
● valheim.service - Valheim Dedicated Server
Loaded: loaded (/etc/systemd/system/valheim.service; enabled; preset: enabled)
Active: active (running) since Thu 2026-04-16 10:00:00 UTC; 1min ago
Main PID: 4321 (start.sh)
Tasks: 18 (limit: 4915)
Memory: 1.9GTail the live log while the world generates (first boot takes 30-60 seconds):
sudo journalctl -u valheim.service -fLook for the line Game server connected -- that confirms Playfab crossplay registration succeeded.
Step 8: Configure Admin Access
Valheim reads three flat files for moderation from the world's save directory:
adminlist.txt-- grants in-game admin commands (kick, ban, save, etc.)permittedlist.txt-- allowlist (only these SteamIDs can connect; optional)bannedlist.txt-- denylist
sudo -u steam mkdir -p /home/steam/.config/unity3d/IronGate/Valheim
sudo -u steam tee /home/steam/.config/unity3d/IronGate/Valheim/adminlist.txt > /dev/null <<'EOF'
76561198000000001
76561198000000002
EOFReplace the placeholder IDs with each admin's SteamID64 (the 17-digit form). Use steamid.io to convert a vanity URL.
Restart the server to load the list:
sudo systemctl restart valheim.serviceAdmins can now press F5 in-game and run:
save-- force-save the worldkick <player>/ban <player>banned/permitted-- reload the files from disk without restartingsetkey defeated_eikthyr-- manipulate world progression
Step 9: Install BepInEx for Mods
BepInEx is the standard Unity mod loader for Valheim. The Unix build is distinct from the Windows build -- do not mix them up.
Stop the server first:
sudo systemctl stop valheim.serviceDownload and unpack the BepInEx Unix pack into the Valheim directory (check Thunderstore for the latest URL):
sudo -iu steam
cd ~/valheim
wget -O bepinex.zip "https://valheim.thunderstore.io/package/download/denikson/BepInExPack_Valheim/5.4.2202/"
unzip bepinex.zip -d bepinex-tmp
cp -r bepinex-tmp/BepInExPack_Valheim/* ./
rm -rf bepinex.zip bepinex-tmpBepInEx ships with a launcher script called start_server_bepinex.sh. Update your start.sh so the Unity doorstop injector loads BepInEx before the server binary executes. Open ~/valheim/start.sh and add these three exports just above the existing export LD_LIBRARY_PATH line:
export DOORSTOP_ENABLE=TRUE
export DOORSTOP_INVOKE_DLL_PATH=/home/steam/valheim/BepInEx/core/BepInEx.Preloader.dll
export LD_PRELOAD="libdoorstop_x64.so ${LD_PRELOAD:-}"Drop any server-compatible mod .dll files into ~/valheim/BepInEx/plugins/. Popular server mods include ValheimPlus, ServerCharacters, and WorldAdvancedEditCommands.
Exit back to your admin user and restart:
exit
sudo systemctl start valheim.service
sudo journalctl -u valheim.service -f | grep -i bepinexYou should see BepInEx <version> - valheim_server in the logs. Remember that any gameplay-affecting mod must also be installed on every client.
Step 10: Set Up Automated Backups
Valheim writes world data to /home/steam/.config/unity3d/IronGate/Valheim/worlds_local/ as paired .fwl (world metadata) and .db (terrain + objects) files. A single corrupted save can erase weeks of progress, so daily backups are non-negotiable.
Create a backup script:
sudo tee /usr/local/bin/valheim-backup.sh > /dev/null <<'EOF'
#!/usr/bin/env bash
set -euo pipefailSRC="/home/steam/.config/unity3d/IronGate/Valheim/worlds_local/"
DEST="/home/steam/backups/$(date +%Y-%m-%d_%H%M)"
KEEP_DAYS=14
mkdir -p "${DEST}"
rsync -a --delete "${SRC}" "${DEST}/"
Prune backups older than KEEP_DAYS
find /home/steam/backups -maxdepth 1 -type d -mtime "+${KEEP_DAYS}" -exec rm -rf {} \;
EOF
sudo chmod +x /usr/local/bin/valheim-backup.sh
sudo chown steam:steam /usr/local/bin/valheim-backup.shSchedule it via cron as the steam user:
sudo -u steam crontab -eAdd the following line to run backups every 6 hours:
0 /6 /usr/local/bin/valheim-backup.sh >> /home/steam/backups/backup.log 2>&1Off-site backup (strongly recommended): pipe the backup directory to a second machine nightly:
rsync -az --delete /home/steam/backups/ [email protected]:/srv/valheim-backups/Test restoration at least once: stop the service, copy a backup over worlds_local/, and start again.
Connecting from the Valheim Client
Your server is now live. To join:
your-server-ip:2456 and the password.To use the community browser instead, wait about 60 seconds after boot for Playfab to index the server, then switch to the Community tab (not Steam) and search by name. Crossplay servers take 2 - 3 minutes to appear on Xbox and PlayStation client lists the first time.
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
| Server not visible in browser | UDP 2457 blocked, or Playfab still indexing | Confirm ufw status shows 2456:2458/udp open. Wait 2 - 3 minutes after first boot. Check provider-level firewall. |
Password cannot be contained in server name | Valheim rejects weak passwords or substring matches | Change SERVER_PASS in valheim.service to a unique value with at least 5 chars. |
libsteam_api.so: cannot open shared object file | LD_LIBRARY_PATH not exported | Verify export LD_LIBRARY_PATH="/home/steam/valheim/linux64:..." is present in start.sh. |
Server starts then crashes with IL2CPP error | Wrong SteamCMD architecture or missing lib32gcc-s1 | Re-run sudo apt install -y lib32gcc-s1 libsdl2-2.0-0. |
Clients see Incompatible version | Server updated after Valheim patch; client is older | Run ~/steamcmd/steamcmd.sh +login anonymous +app_update 896660 validate +quit and restart the service. |
| Saves vanish after reboot | Default ~/.config/unity3d/... blocked by systemd ProtectHome=read-only | Confirm ReadWritePaths=/home/steam/valheim /home/steam/.config is in the unit file. |
| High CPU when world is empty | BepInEx plugin CPU loop or infinite log | Check ~/valheim/BepInEx/LogOutput.log and disable suspect plugins. |
Tailing Logs
The systemd journal is your first stop:
sudo journalctl -u valheim.service -f
sudo journalctl -u valheim.service -n 200 --no-pagerThe dated game log in /home/steam/valheim/logs/ has engine-level detail for Unity errors.
FAQ
How much RAM does a Valheim server need?
A Valheim dedicated server uses approximately 2 GB of RAM for a small world with up to 10 players. Our CloudCore Starter plan with 4 GB RAM is comfortable for most groups. Large, heavily-explored worlds with 10 concurrent players and multiple bases can push usage toward 3 GB, which still fits within Starter without swapping. Upgrade to a 6 GB plan only if you run BepInEx with heavy mods like terrain-altering tools or custom creature packs.
Does the Valheim dedicated server support crossplay between PC and Xbox?
Yes. Launch the server with the -crossplay flag (already included in the start.sh script above) and it will register with Microsoft's Playfab backend, making it discoverable from the cross-platform Community tab in the Valheim client on PC, Xbox, and PlayStation. Players on any platform can then connect by server name or by IP. Crossplay does not affect mod compatibility -- modded servers are still restricted to clients that can run the same mods, which in practice means PC only.
Which ports does Valheim use?
Valheim uses UDP ports 2456, 2457, and 2458. Port 2456 is the main game port that clients connect to; 2457 is the Steam query port used by the server browser; 2458 is used for matchmaking. All three must be open in your firewall (and your VPS provider's network firewall, if applicable) for both direct IP connections and server-list discovery to work correctly.
Can I install mods on a Valheim dedicated server?
Yes. Install the BepInEx Unix pack into the server directory (see Step 9), then drop server-compatible mod DLLs into ~/valheim/BepInEx/plugins/. Popular options include ValheimPlus (configuration tweaks), ServerCharacters (server-side character saves), and various quality-of-life mods from the Thunderstore. Every connecting player must have the same mods installed client-side for any mod that affects gameplay -- pure server-side mods like login messages work without client changes.
How do I give myself admin rights on the server?
Edit the adminlist.txt file in /home/steam/.config/unity3d/IronGate/Valheim/ and add each admin's SteamID64 (17-digit form) on its own line. After saving, either restart the service or have an existing admin run /banned in chat to reload the list. Admins can then press F5 in-game and use console commands such as kick, ban, save, and setkey for world progression flags.
Is self-hosting Valheim cheaper than using a paid game host?
Yes, significantly. A CloudCore Starter VPS is EUR 7.99 per month for unlimited slots, a persistent world, and full SSH access. Typical managed Valheim hosts charge EUR 15 - 25 per month for a 10-slot server with limited mod support. That is roughly 75% savings, and the gap grows if you add more game servers or related services to the same VPS. You also keep full filesystem access for instant backups, mod sideloading, and world migration.
How do I back up my Valheim world?
The world data lives in /home/steam/.config/unity3d/IronGate/Valheim/worlds_local/ as paired .fwl and .db files. Use the rsync-based script in Step 10 on a 6-hour cron, and strongly consider piping to an off-site target (another VPS, S3-compatible storage, or a home NAS) nightly. Always back up before running a SteamCMD update in case a game patch introduces save-file incompatibility.
Related Guides
- How to Install a Rust Game Server on Ubuntu
- How to Install a Terraria Server on Ubuntu
- How to Install Project Zomboid Dedicated Server on Ubuntu
- How to Install a Factorio Headless Server on Ubuntu
Ready to raid Valhalla?>
Our CloudCore Starter VPS has the right mix of CPU, RAM, and bandwidth for a smooth Valheim experience:>
- 2 vCPU cores, 4 GB RAM, 50 GB NVMe SSD
- Unmetered bandwidth, EU and US locations
- Full root SSH access, any OS
- EUR 7.99/month -- roughly 75% cheaper than managed Valheim hosts>
Deploy a Starter VPS and be in-game in under 30 minutes.