Hosting a dedicated Valheim server on a pure, non-GUI Ubuntu Linux server environment (headless) is the optimal foundation for seamless cooperative Viking survival. The underlying Unity server executable runs with minimal overhead, dedicating all available CPU cores and memory strictly to structural physics calculations, environmental weather simulations, and networked zone data objects (zDO).
This comprehensive technical guide details the installation of essential runtime dependencies and SteamCMD on Ubuntu 22.04/24.04, deploying the dedicated server package (AppID 896660), opening UDP firewall ports for Xbox crossplay, and authoring a resilient systemd daemon with atomic shutdown save handling.
Installing Host Dependencies and SteamCMD#
The valheim_server.x86_64 binary is built on the Unity game engine and dynamically references libraries for atomic memory operations and audio subsystem routines, even when operating in dedicated non-GUI headless mode.
Install the requisite packages via Ubuntu's Advanced Package Tool:
sudo apt update && sudo apt install -y libatomic1 libpulse-dev libgl1-mesa-glx steamcmd curl
Establish an unprivileged steam user account to host and execute the server process safely:
sudo useradd -r -m -d /home/steam -s /bin/bash steam && sudo -u steam steamcmd +force_install_dir /home/steam/valheim_server +login anonymous +app_update 896660 validate +quit
This command downloads the official Valheim dedicated server (Steam AppID 896660) into /home/steam/valheim_server and verifies the cryptographic integrity of all game assets.
Firewall Configuration and UDP Port Allocation#
Valheim's network stack communicates across two consecutive UDP transport ports:
- Port
2456/udp— Main game traffic port handling player movements and entity updates. - Port
2457/udp— Steam Master Server Query port handling server listing discovery.
Permit inbound traffic across this port range within Ubuntu's UFW:
sudo ufw allow 2456:2457/udp
If you prefer operating a high-performance Valheim realm without manual Linux terminal administration, specialized Valheim server hosting delivers automated SteamCMD updates when patches release, scheduled world snapshots, and an intuitive web management console.
Authoring the systemd Service with Crossplay#
When authoring the systemd unit configuration, three critical parameters must be included:
Environment="LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH"— Links the native 64-bit Steamworks libraries.-crossplay— Enables the PlayFab backend network relay, allowing cross-platform joins from Xbox One and Xbox Series X/S consoles.ExecStop=/bin/kill -s INT $MAINPIDwithTimeoutStopSec=60— Transmits a clean SIGINT signal, giving the Unity engine adequate time to serialize large.dbworld structures to persistent storage before process termination.
Create the service unit file at /etc/systemd/system/valheim.service:
[Unit]
Description=Valheim Dedicated Headless Server
After=network.target
[Service]
Type=simple
User=steam
Group=steam
WorkingDirectory=/home/steam/valheim_server
Environment="LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH"
ExecStart=/home/steam/valheim_server/valheim_server.x86_64 -name "MyValheimServer" -port 2456 -world "Dedicated" -password "SecretPassword123" -public 1 -crossplay
ExecStop=/bin/kill -s INT $MAINPID
Restart=on-failure
RestartSec=15s
TimeoutStopSec=60
[Install]
WantedBy=multi-user.target
Reload the systemd daemon, configure the unit to boot automatically upon host restart, and start the game server:
sudo systemctl daemon-reload && sudo systemctl enable --now valheim && sudo systemctl status valheim
Monitor world generation and player connectivity logs using journalctl -u valheim -f. A successful initialization confirms server operational status with the log entry Game server connected and displays your server's join code.




