Valheim is a Norse-inspired survival game supporting co-op multiplayer. You can host your own persistent server on Linux so you and friends can explore and build together anytime.
Prerequisites
- A Linux VPS (Ubuntu 20.04 LTS or later recommended)
- SteamCMD installed (see Install SteamCMD on Linux for setup)
- At least 10 GB of free disk space
- Port 2456–2458 (UDP) open in your firewall/security group
Step 1: Download Valheim server files
Log in as the steam user and download the server binaries. Valheim server's app ID is 896660:
su - steam
cd ~/steamcmd
./steamcmd.sh +login anonymous +app_update 896660 validate +quit
Wait for the download to complete (around 800 MB). You'll see "Success!" when finished.
Step 2: Verify the installation
Check that the server files are in place:
ls -la ~/Steam/steamapps/common/Valheim_dedicated_server/
You should see valheim_server.x86_64 executable and supporting files.
Step 3: Create a startup script
Valheim server is controlled via environment variables and command-line options. Create a script:
nano ~/valheim_start.sh
Paste the following, replacing your_server_name and your_password:
#!/bin/bash
export LD_LIBRARY_PATH=~/Steam/steamapps/common/Valheim_dedicated_server/linux64:$LD_LIBRARY_PATH
cd ~/Steam/steamapps/common/Valheim_dedicated_server
./valheim_server.x86_64 \
-name "your_server_name" \
-port 2456 \
-world "MyWorld" \
-password "your_password" \
-crossplay
Make it executable:
chmod +x ~/valheim_start.sh
Step 4: Open firewall ports
Open the required ports from your main user account:
sudo ufw allow 2456:2458/udp
sudo ufw reload
For cloud providers (AWS, Azure, etc.), add inbound UDP rules for ports 2456–2458 from 0.0.0.0/0.
Step 5: Start the server
From the steam user account, run the startup script:
su - steam
~/valheim_start.sh
You should see output like:
CODE7
Step 6: Connect from the game client
On your personal PC:
1. Launch Valheim
2. Click Start Game
3. Select Join Game
4. Select Community (or Friends, if your friend is on your friend list)
5. Enter your server IP (your-server-ip:2456) in the address box, and the password you set
Running the server in the background
Use screen to keep it running after you disconnect:
su - steam
screen -S valheim-server
~/valheim_start.sh
Detach with Ctrl+A, then D. Reattach with screen -r valheim-server.
For automatic restart on server reboot, add to the steam user's crontab (crontab -e):
@reboot sleep 30 && cd /home/steam && /home/steam/valheim_start.sh >> /home/steam/valheim.log 2>&1 &
Step 7: Manage and update the server
### View server logs
CODE10
### Update the server
CODE11
Stop the server, update, then restart it.
Tips and Notes
- Save data: The server stores world data at
~/.config/unity3d/IronGate/Valheim/worlds/. Back this up regularly. - Server name: Keep it under 32 characters to avoid display issues in the game's server list.
- Player limit: Valheim servers support up to 10 players by default. Performance degrades significantly beyond that.
- Crossplay: The
-crossplayflag allows both PC and console players to join (when on supported platforms). - Performance: A typical co-op server uses 500 MB–1 GB RAM. Monitor CPU usage; heavily developed worlds consume more resources.
- Persistence: The world persists even when no players are logged in—progress is saved to disk continuously.