Skip to main content
← All guides

Opening a Valheim dedicated server (Ubuntu)

Here's how to open a Valheim dedicated server for playing with friends on an Ubuntu or Debian server. The world stays open even when your PC is off, and we'll set it up to restart automatically if the server goes down.

Before you start

If it's hard to do yourself, you can leave the setup to Nevv Tech Support. A server set up through tech support can be managed on the web from the game console on the server detail page — start, stop, update and back up.

1. Install SteamCMD

The Valheim server files are downloaded with Valve's SteamCMD. SteamCMD needs 32-bit libraries.

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y curl lib32gcc-s1 lib32stdc++6
mkdir -p ~/steamcmd && cd ~/steamcmd
curl -fsSL https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz | tar -xz

2. Download the Valheim server

The Steam app ID for the Valheim dedicated server is 896660.

~/steamcmd/steamcmd.sh +force_install_dir ~/valheim +login anonymous +app_update 896660 validate +quit
mkdir -p ~/valheim/saves

If you see Success! App '896660' fully installed., it worked.

3. Set it to start automatically (systemd)

Replace Nevv Server (server name), nevv (world name) and change-me (join password) in the command below with the values you want, then run it.

  • The join password must be at least 5 characters of letters and numbers, and must not contain the server name (a Valheim rule — if you don't follow it, the server won't start).
  • With -public 1, the server appears in the in-game community server list. To keep it off the list, change it to -public 0.
sudo tee /etc/systemd/system/valheim.service > /dev/null <<EOF
[Unit]
Description=Valheim server
After=network-online.target
Wants=network-online.target

[Service]
User=$USER
WorkingDirectory=$HOME/valheim
Environment=LD_LIBRARY_PATH=$HOME/valheim/linux64
Environment=SteamAppId=892970
ExecStart=$HOME/valheim/valheim_server.x86_64 -nographics -batchmode -name "Nevv Server" -port 2456 -world "nevv" -password "change-me" -public 1 -savedir $HOME/valheim/saves
Restart=always
RestartSec=10
KillSignal=SIGINT
TimeoutStopSec=90

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now valheim

Check that it's running. The first start can take a few minutes while it creates the world (leave the journalctl screen with Ctrl + C).

systemctl status valheim
journalctl -u valheim -f

KillSignal=SIGINT is the setting that makes the server save the world before it shuts down. Don't remove it.

4. Connect

Valheim uses UDP ports 2456–2458. If you've turned on the firewall (ufw), open them. (Opening firewall ports)

sudo ufw allow 2456:2458/udp

On the game's server join screen, click the Join IP button, enter the address as below, then enter the join password you set.

ip-address:2456

5. Change settings

The server name, world name, password and public setting are on the ExecStart line from step 3. After changing them, reload and restart.

sudo nano /etc/systemd/system/valheim.service
sudo systemctl daemon-reload
sudo systemctl restart valheim

If you change the -world name, a new world is created. The original world isn't deleted and stays in the saves folder, so changing the name back opens it again.

6. Update

If players can't connect after the game updates, update the server too.

sudo systemctl stop valheim
~/steamcmd/steamcmd.sh +force_install_dir ~/valheim +login anonymous +app_update 896660 validate +quit
sudo systemctl start valheim

7. Back up the world

The world is in the ~/valheim/saves folder. It's safest to compress it while the server is stopped.

sudo systemctl stop valheim
tar -czf ~/valheim-backup-$(date +%Y%m%d-%H%M).tar.gz -C ~/valheim saves
sudo systemctl start valheim

To download the archive to your PC, see Uploading and downloading files on your server; to back up automatically every day, see Backing up your server data.

Common problems

SymptomWhat to check
The server keeps starting and stoppingWhether the join password is at least 5 characters and doesn't contain the server name — check with journalctl -u valheim -n 50
Join IP doesn't workWhether you opened the firewall for UDP (opening it as TCP won't work), and whether the port at the end of the address is 2456
Can't connect on a server with a service portIt needs several consecutive ports, which are hard to match — a KT-⁠B server is recommended
Lags badly as more players joinCheck memory and CPU usage — Checking a slow server

If your problem isn't solved, open a ticket on our Discord.

Opening a Valheim dedicated server (Ubuntu) - Nevv Guides