Skip to main contentSkip to navigation
[email protected]
Client AreaSupport
Hosting Mammoth
HostingMammothYour Data, Our Responsibility
Home
Solutions
Hosting Services
Store
Pricing
About
Blog
API
Contact

Stay Ahead of the Curve

Get the latest insights on cybersecurity, AI innovations, and enterprise data solutions delivered to your inbox.

Hosting Mammoth
HostingMammothEnterprise Solutions

Enterprise-grade data solutions. Hosting, recovery, cybersecurity, and AI-powered services for businesses worldwide.

[email protected]
Sun - Fri, 9:00am - 5:00pm

Services

  • Cloud Hosting
  • Data Recovery
  • Cybersecurity
  • Legal Support
  • MSP Services
  • Web Development
  • AI Services
  • Free Server Migration

Hosting

  • VPS Hosting (NVMe SSD)
  • VDS Hosting (NVMe)
  • Storage VPS (High SSD)
  • GPU Servers
  • Managed Services
  • Cloud Firewall
  • Load Balancer
  • One-Click Apps
  • n8n Hosting
  • Object Storage
  • FAQ

Company

  • Store
  • Pricing
  • About Us
  • Locations
  • Blog
  • Testimonials
  • Contact
  • Affiliate Program
  • White-Label
  • Terms of Service
  • Privacy Policy
  • Browser Cookies
  • SLA

Support

  • Client Area
  • Submit Ticket
  • Knowledge Base
  • Server Status
  • API Documentation

© 2026 Hosting Mammoth. All rights reserved.

Knowledge Base
Getting StartedAccount ManagementVPS HostingGPU ServersStorage VPSCloud FirewallLoad BalancerServer ManagementBilling & PaymentsSupport & TicketsAffiliate ProgramReseller ProgramMarketplace & Appsn8n HostingManaged ServicesServer MigrationAPI & DevelopersSecurityTroubleshootingGlossaryInstall Guides
  1. Home
  2. /
  3. Support
  4. /
  5. Install Guides
  6. /
  7. How To Install Valheim Server Ubuntu
GUIDEInstall Guides

How to Install Valheim Dedicated Server on Ubuntu 24.04

20 min read

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?
  • Prerequisites
  • Step 1: Update System and Install Dependencies
  • Step 2: Create the steam User
  • Step 3: Install SteamCMD
  • Step 4: Install the Valheim Server Files
  • Step 5: Create the Custom Start Script
  • Step 6: Open the UDP Firewall Ports
  • Step 7: Create the systemd Service
  • Step 8: Configure Admin Access
  • Step 9: Install BepInEx for Mods
  • Step 10: Set Up Automated Backups
  • Connecting from the Valheim Client
  • Troubleshooting
  • FAQ
  • Related Guides
  • 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 optionTypical monthly costSlotsMods allowedSSH access
    Managed Valheim host (10 slots)EUR 15 - 2510LimitedNo
    Shared game panelEUR 8 - 1210SomeNo
    CloudCore Starter VPSEUR 7.99UnlimitedAnyYes
    Running on your own VPS saves roughly 75% versus a comparable managed host, and the savings grow if you add more game servers to the same machine. Beyond price, self-hosting gets you:

    • 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
    The official Valheim wiki confirms the technical requirements are modest, which is why a EUR 7.99 VPS handles a full group without breaking a sweat.

    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:

    bash
    ssh root@your-server-ip

    Step 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.

    bash
    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 rsync

    Expected output (abbreviated):

    text
    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:

    bash
    sudo reboot

    Step 2: Create the steam User

    For security, never run SteamCMD or the Valheim server as root. Create a dedicated unprivileged user called steam:

    bash
    sudo useradd -m -s /bin/bash steam
    sudo passwd steam

    Switch to the new user for the remaining install steps:

    bash
    sudo -iu steam

    Your 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:

    bash
    mkdir -p ~/steamcmd && cd ~/steamcmd
    curl -sSL https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz | tar -xz

    Verify the installer:

    bash
    ls -l ~/steamcmd

    You should see steamcmd.sh and a linux32 directory. Launch SteamCMD once to pull its self-updates:

    bash
    ./steamcmd.sh +quit

    Expected output (abbreviated):

    text
    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...OK

    SteamCMD 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:

    bash
    ~/steamcmd/steamcmd.sh \
      +force_install_dir /home/steam/valheim \
      +login anonymous \
      +app_update 896660 validate \
      +quit

    The 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:

    text
    Success! App '896660' fully installed.

    Confirm the files landed correctly:

    bash
    ls ~/valheim

    You 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:

    bash
    cat > ~/valheim/start.sh <<'EOF'
    #!/usr/bin/env bash
    set -euo pipefail

    Defaults -- 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 .fwl and .db filenames 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 to 0 for 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:

    bash
    exit   # back to the admin user

    Configure UFW:

    bash
    sudo ufw allow 22/tcp comment 'SSH'
    sudo ufw allow 2456:2458/udp comment 'Valheim'
    sudo ufw --force enable
    sudo ufw status numbered

    Expected output:

    text
    Status: active
         To                         Action      From
         --                         ------      ----
    [ 1] 22/tcp                     ALLOW IN    Anywhere          # SSH
    [ 2] 2456:2458/udp              ALLOW IN    Anywhere          # Valheim

    If 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:

    bash
    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:

    bash
    sudo systemctl daemon-reload
    sudo systemctl enable valheim.service
    sudo systemctl start valheim.service

    Check status:

    bash
    sudo systemctl status valheim.service

    Expected output (abbreviated):

    text
    ● 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.9G

    Tail the live log while the world generates (first boot takes 30-60 seconds):

    bash
    sudo journalctl -u valheim.service -f

    Look 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
    Create the admin list:

    bash
    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
    EOF

    Replace 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:

    bash
    sudo systemctl restart valheim.service

    Admins can now press F5 in-game and run:

    • save -- force-save the world
    • kick <player> / ban <player>
    • banned / permitted -- reload the files from disk without restarting
    • setkey defeated_eikthyr -- manipulate world progression
    For a full command reference, see the Valheim wiki dedicated server page.

    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:

    bash
    sudo systemctl stop valheim.service

    Download and unpack the BepInEx Unix pack into the Valheim directory (check Thunderstore for the latest URL):

    bash
    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-tmp

    BepInEx 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:

    bash
    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:

    bash
    exit
    sudo systemctl start valheim.service
    sudo journalctl -u valheim.service -f | grep -i bepinex

    You 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:

    bash
    sudo tee /usr/local/bin/valheim-backup.sh > /dev/null <<'EOF'
    #!/usr/bin/env bash
    set -euo pipefail

    SRC="/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.sh

    Schedule it via cron as the steam user:

    bash
    sudo -u steam crontab -e

    Add the following line to run backups every 6 hours:

    text
    0 /6    /usr/local/bin/valheim-backup.sh >> /home/steam/backups/backup.log 2>&1

    Off-site backup (strongly recommended): pipe the backup directory to a second machine nightly:

    bash
    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:

  • Launch Valheim and select a character.
  • Choose Start Game -> Join Game -> Join IP.
  • Enter 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

    ProblemCauseSolution
    Server not visible in browserUDP 2457 blocked, or Playfab still indexingConfirm ufw status shows 2456:2458/udp open. Wait 2 - 3 minutes after first boot. Check provider-level firewall.
    Password cannot be contained in server nameValheim rejects weak passwords or substring matchesChange SERVER_PASS in valheim.service to a unique value with at least 5 chars.
    libsteam_api.so: cannot open shared object fileLD_LIBRARY_PATH not exportedVerify export LD_LIBRARY_PATH="/home/steam/valheim/linux64:..." is present in start.sh.
    Server starts then crashes with IL2CPP errorWrong SteamCMD architecture or missing lib32gcc-s1Re-run sudo apt install -y lib32gcc-s1 libsdl2-2.0-0.
    Clients see Incompatible versionServer updated after Valheim patch; client is olderRun ~/steamcmd/steamcmd.sh +login anonymous +app_update 896660 validate +quit and restart the service.
    Saves vanish after rebootDefault ~/.config/unity3d/... blocked by systemd ProtectHome=read-onlyConfirm ReadWritePaths=/home/steam/valheim /home/steam/.config is in the unit file.
    High CPU when world is emptyBepInEx plugin CPU loop or infinite logCheck ~/valheim/BepInEx/LogOutput.log and disable suspect plugins.

    Tailing Logs

    The systemd journal is your first stop:

    bash
    sudo journalctl -u valheim.service -f
    sudo journalctl -u valheim.service -n 200 --no-pager

    The 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.

    Was this article helpful?

    ← Back to Install GuidesBrowse all categories →

    Still have questions?

    Contact Support →Submit a Ticket