How to Create a Valheim Server
Complete guide to create a dedicated Valheim server on a VPS or dedicated Linux server: installation with SteamCMD, password, administrators, crossplay, systemd service and world backup.
On this page
Your values
Enter them once and the commands in this guide update.
This guide explains how to install a dedicated Valheim server on your VPS or dedicated Linux server, protect it with a password, appoint administrators and back up your world. Iron Gate, the game's studio, provides a native Linux version of the server.
Order a Server
To host your Valheim world, HostMyServers offers several suitable options:
- Performance VPS - Dedicated resources and fast processors, ideal for Valheim
- NVMe VPS - For a server with friends
- Eco Dedicated Servers - For several servers or a very busy world
- Performance Dedicated Servers - Maximum performance
Prerequisites
- SSH access as root or user with sudo privileges
- 64-bit x86_64 Linux system (Debian 12/13 or Ubuntu 22.04/24.04)
- Active firewall: nftables, iptables or ufw (use only one tool at a time)
- Ports 2456 and 2457 UDP accessible
- The Valheim game on Steam to connect
Required Configuration
Iron Gate does not publish minimum requirements for the server. The values below are guidelines: consumption increases with the number of players and the size of the bases built.
| Players | CPU | RAM | Storage |
|---|---|---|---|
| 2 to 5 | 2 fast cores | 4 GB | 10 GB SSD |
| 6 to 10 | 4 fast cores | 8 GB | 20 GB NVMe SSD |
The server takes up about 2 GB on disk. Allow extra space for the world and its backups.
System Update
sudo apt update && sudo apt upgrade -yInstalling Dependencies
lib32gcc-s1 is required by SteamCMD, and the libatomic1, libpulse-dev and libpulse0 packages are requested by the official server manual:
sudo apt install -y curl tar ca-certificates lib32gcc-s1 libatomic1 libpulse-dev libpulse0Creating a Dedicated User
The server must never run as root. Create a dedicated user:
sudo adduser --disabled-password --gecos "" valheimPorts Used
| Port | Protocol | Usage |
|---|---|---|
| 2456 | UDP | Game (value of -port) |
| 2457 | UDP | Next port, also used by the server |
Valheim uses the port chosen with -port and the next port. The server does not offer RCON or a web administration interface: no other port needs to be opened.
Firewall Configuration
With UFW
sudo ufw allow 2456:2457/udp
sudo ufw reloadWith iptables
sudo iptables -A INPUT -p udp --dport 2456:2457 -j ACCEPT
sudo iptables-save | sudo tee /etc/iptables/rules.v4Saving the rules across reboots requires the iptables-persistent package.
With nftables
These commands use the inet filter table and the input chain, present by default in /etc/nftables.conf on Debian.
sudo nft add rule inet filter input udp dport 2456-2457 accept
(echo "flush ruleset"; sudo nft list ruleset) | sudo tee /etc/nftables.confInstalling SteamCMD
Log in as the valheim user and prepare the folders:
sudo -iu valheim
mkdir -p ~/steamcmd ~/valheim-server ~/valheim-data
cd ~/steamcmd
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar -xzf -Downloading the Valheim Server
Start the server installation (application ID 896660):
~/steamcmd/steamcmd.sh +force_install_dir /home/valheim/valheim-server +login anonymous +app_update 896660 validate +quitWhen it finishes, the message Success! App '896660' fully installed. is displayed. If the installation stops with an error, run the same command again.
Launch Script
The provided start_server.sh file is replaced with every update. As Iron Gate recommends, work on your own script, placed outside the server folder:
nano ~/start-valheim.sh#!/bin/bash
cd /home/valheim/valheim-server || exit 1
export LD_LIBRARY_PATH="./linux64:$LD_LIBRARY_PATH"
export SteamAppId=892970
exec ./valheim_server.x86_64 \
-name "My Valheim Server" \
-port 2456 \
-world "MyWorld" \
-password "ChangeThisPassword" \
-savedir /home/valheim/valheim-data \
-public 1 \
-saveinterval 1800 \
-backups 4 \
-backupshort 7200 \
-backuplong 43200Protect the file, because it contains the password:
chmod 700 ~/start-valheim.shMain Parameters
| Parameter | Description |
|---|---|
-name |
Name displayed in the server list |
-port |
First port used (2456 by default) |
-world |
World name, created if it does not exist |
-password |
Server password |
-savedir |
Folder for worlds and access lists |
-public |
1: visible in the list, 0: accessible by IP address only |
-saveinterval |
World save interval, in seconds (1800 by default) |
-backups |
Number of automatic backups kept (4 by default) |
-backupshort |
Delay before the first automatic backup, in seconds (7200 by default) |
-backuplong |
Delay between subsequent backups, in seconds (43200 by default) |
-crossplay |
Enables crossplay (see below) |
World Modifiers (optional)
| Parameter | Possible values |
|---|---|
-preset |
Normal, Casual, Easy, Hard, Hardcore, Immersive, Hammer |
-modifier combat |
veryeasy, easy, hard, veryhard |
-modifier deathpenalty |
casual, veryeasy, easy, hard, hardcore |
-modifier resources |
muchless, less, more, muchmore, most |
-modifier raids |
none, muchless, less, more, muchmore |
-modifier portals |
casual, hard, veryhard |
-setkey |
nobuildcost, playerevents, passivemobs, nomap |
Place -preset before -modifier, because a preset overwrites the modifiers defined before it.
First Launch
Still as the valheim user, launch the server to check that it starts and to create the world:
~/start-valheim.shThe server is ready when the message Game server connected appears. Then stop it with Ctrl+C, without abruptly closing the session, and exit the valheim user:
exitConfiguration as systemd Service
Create Service File
sudo nano /etc/systemd/system/valheim.serviceFile content:
[Unit]
Description=Valheim Dedicated Server
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=valheim
Group=valheim
WorkingDirectory=/home/valheim/valheim-server
ExecStart=/home/valheim/start-valheim.sh
KillSignal=SIGINT
TimeoutStopSec=120
Restart=on-failure
RestartSec=20
LimitNOFILE=100000
[Install]
WantedBy=multi-user.targetKillSignal=SIGINT reproduces the Ctrl+C that Iron Gate requires to stop the server cleanly.
Enable and Start Service
sudo systemctl daemon-reload
sudo systemctl enable valheim.service
sudo systemctl start valheim.serviceManagement Commands
# Check status
sudo systemctl status valheim.service
# Stop server
sudo systemctl stop valheim.service
# Restart server
sudo systemctl restart valheim.service
# View logs
sudo journalctl -u valheim.service -fVerify the Server
Wait for the startup message in the logs:
sudo journalctl -u valheim.service | grep 'Game server connected'Then check that the ports are listening:
sudo ss -ulpn | grep -E ':(2456|2457)\b'Connecting to Server
- Launch Valheim and choose your character.
- Open the tab for joining a server.
- Use Join IP and enter
SERVER_IP:2456. - Enter the server password.
With -public 1, the server can also appear in the community list after a few minutes.
Enabling Crossplay (optional)
Without any particular option, the server uses the Steam network: only Steam players can join it. To welcome players from other platforms, such as Xbox or Game Pass, add -crossplay at the end of the command in start-valheim.sh, adding \ to the previous line:
-backuplong 43200 \
-crossplayRestart the service, then retrieve the join code from the logs:
sudo journalctl -u valheim.service | grep -i 'join code'With crossplay, traffic goes through a relay service: opening the ports is no longer necessary. You can connect with the public IP address and port, the join code or the server list. A local address does not work.
Administration
Access Lists
Three text files are located in /home/valheim/valheim-data:
| File | Role |
|---|---|
adminlist.txt |
Administrators |
bannedlist.txt |
Banned players |
permittedlist.txt |
Allowed players |
Add one ID per line, in the Platform_UserID format, respecting uppercase letters. For a Steam player, this gives for example:
Steam_76561198000000000The ID appears in the F2 panel in game and in the server logs. Edit these files as the valheim user:
sudo -u valheim nano /home/valheim/valheim-data/adminlist.txtRestart the server if a change is not taken into account.
In-Game Commands
Administrators open the console with F5. If it does not open, add the -console option to Valheim's launch options in Steam.
| Command | Description |
|---|---|
Kick NAME |
Kick a player |
Ban NAME |
Ban a player |
Unban NAME |
Unban a player |
Banned |
Show banned players |
File Structure
| Path | Description |
|---|---|
/home/valheim/valheim-server/ |
Server files, replaced by updates |
/home/valheim/start-valheim.sh |
Your launch script |
/home/valheim/valheim-data/worlds_local/ |
Worlds (.db and .fwl) and automatic backups |
/home/valheim/valheim-data/*.txt |
Access lists |
Importing an Existing World
Each world consists of two files, .db and .fwl, which must be kept together.
-
Stop the server:
sudo systemctl stop valheim.service -
On your Windows PC, find the world in
%USERPROFILE%\AppData\LocalLow\IronGate\Valheim\worlds_local. -
Upload both files to
/home/valheim/valheim-data/worlds_local/, for example with SFTP. -
Give ownership back to the
valheimuser:Terminalsudo chown -R valheim:valheim /home/valheim/valheim-data -
Enter the world name, without its extension, in
-world, then restart the server.
Server Update
Players and the server must use the same version of the game. After a Valheim update, you therefore need to update the server:
sudo systemctl stop valheim.service
sudo -iu valheim /home/valheim/steamcmd/steamcmd.sh +force_install_dir /home/valheim/valheim-server +login anonymous +app_update 896660 validate +quit
sudo systemctl start valheim.serviceYour script and data are outside the server folder: the update does not change them.
World Backup
Built-in Backups
The server itself keeps copies in worlds_local, with _backup_auto- in their name. By default, it keeps one copy that is 2 hours old and three copies spaced 12 hours apart. They are on the same disk as the world: complement them with an external backup.
Backup Script
This script briefly stops the server to get a consistent copy, then restarts it:
sudo nano /usr/local/sbin/backup-valheim.sh#!/bin/bash
set -euo pipefail
umask 027
BACKUP_DIR="/home/valheim/backups"
DATE=$(date +%Y-%m-%d_%H-%M-%S)
ARCHIVE="$BACKUP_DIR/valheim_$DATE.tar.gz"
install -d -o valheim -g valheim -m 750 "$BACKUP_DIR"
systemctl stop valheim.service
trap 'systemctl start valheim.service' EXIT
tar -czf "$ARCHIVE" -C /home/valheim valheim-data start-valheim.sh
chown valheim:valheim "$ARCHIVE"
# Delete backups older than 7 days
find "$BACKUP_DIR" -name "valheim_*.tar.gz" -mtime +7 -deletesudo chmod 750 /usr/local/sbin/backup-valheim.sh
sudo /usr/local/sbin/backup-valheim.sh
sudo ls -lh /home/valheim/backupsSchedule Backup
sudo nano /etc/cron.d/valheim-backup# Backup every night at 5:30 AM
30 5 * * * root /usr/local/sbin/backup-valheim.shRegularly copy these archives off the server. They contain your launch script, and therefore the server password.
Restore a Backup
sudo systemctl stop valheim.service
sudo mv /home/valheim/valheim-data /home/valheim/valheim-data.old
sudo -u valheim tar -xzf /home/valheim/backups/valheim_DATE.tar.gz -C /home/valheim
sudo systemctl start valheim.serviceReplace DATE with the date of the archive.
Troubleshooting
Server won't start
- Check the logs:
sudo journalctl -u valheim.service -n 100 - Check that the script is executable:
ls -l /home/valheim/start-valheim.sh - Check the password: at least 5 characters, and not contained in the server name
- Check the disk space and memory:
df -handfree -h
error while loading shared libraries
A library is missing, for example libatomic.so.1 or libpulse. Reinstall the dependencies:
sudo apt install -y libatomic1 libpulse-dev libpulse0version GLIBC_2.29 not found
The server requires at least GLIBC_2.29 and GLIBCXX_3.4.26. Your system is too old: upgrade to Debian 12/13 or Ubuntu 22.04/24.04.
steamclient.so Error
If the logs report that steamclient.so cannot be found, create the expected link:
sudo -iu valheim
mkdir -p ~/.steam/sdk64
ln -sf ~/valheim-server/linux64/steamclient.so ~/.steam/sdk64/steamclient.so
exitPlayers can't connect
- Wait for
Game server connectedin the logs - Check that ports 2456 and 2457 are open on UDP
- Check that the server is listening:
sudo ss -ulpn | grep -E ':(2456|2457)\b' - Check that
permittedlist.txtis empty or does contain the player - If the connection still fails, also open port 2458 on UDP: the script provided by Iron Gate mentions the 2456-2458 range
Incompatible version
The game and the server do not have the same version. Update the server, then update the game in Steam.
My world has disappeared
The name passed to -world probably no longer matches the existing world, or -savedir has changed. List the worlds present:
sudo ls -l /home/valheim/valheim-data/worlds_localWithout -savedir, the server saves to ~/.config/unity3d/IronGate/Valheim.