Skip to content

Instantly share code, notes, and snippets.

@mmercedes
Last active October 10, 2025 00:18
Show Gist options
  • Save mmercedes/64428eac49d970d6bcac99718a0066a3 to your computer and use it in GitHub Desktop.
Save mmercedes/64428eac49d970d6bcac99718a0066a3 to your computer and use it in GitHub Desktop.
Guide for creating a dedicated valheim server on debian

recommened you do this from within tmux since the steamcmd utility creates its own repl

Install SteamCMD

taken from here

$ sudo useradd -m steam
$ sudo apt update && sudo apt-get install lib32gcc1 -y
$ sudo su - steam
$ mkdir ~/Steam && cd ~/Steam
$ curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -
$ ./steamcmd.sh

The last command should bring you into a steam client repl. From here you can login with your steam account (only required once) so Valheim can downloaded.

Steam> login <steam_username>
# this will prompt for password and two-factor auth
Steam> exit

Install Valheim server

Download Valheim from steam into steam user's homedir

$ mkdir ~/Valheim
$ ./steamcmd.sh +login <steam_username> +force_install_dir /home/steam/Valheim +app_update 896660 validate +exit

Now to make a copy of the server start script and create a systemctl service for it so can be auto ran on boot

cp ~/Valheim/start_server.sh ~/Valheim/start_server_local_copy.sh
nano ~/Valheim/start_server_local_copy.sh

Add this line to the local copy of the server start script so that it authenticates via your steam account prior to launching. Should go right after the echo "Starting server... line and fill in the value for your steam username

/home/steam/Steam/steamcmd.sh +login <steam_username> +force_install_dir /home/steam/Valheim +app_update 896660 +quit

Next edit the values for -name -world and -password in the line that looks like this:

./valheim_server.x86_64 -name "My server" -port 2456 -world "Dedicated" -password "secret"

Save the file and exit nano

Create and start systemd service

touch ~/valheim.service
nano ~/valheim.service

In Nano, paste and save the following

[Unit]
Description=Valheim service
Wants=network.target
After=syslog.target network-online.target

[Service]
Type=simple
Restart=on-failure
RestartSec=10
User=steam
WorkingDirectory=/home/steam/Valheim
ExecStart=/bin/bash /home/steam/Valheim/start_server_local_copy.sh

[Install]
WantedBy=multi-user.target

Now to actually create/start the systemd service, switch back to a user with root access as the steam user will not

sudo cp /home/steam/valheim.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl start valheim

after a few seconds, you can check the status of the server process with

sudo systemctl status valheim

once its looks good, enable the service to run automatically at boot

sudo systemctl enable valheim

Enable port forwarding

Out of the scope of this as its highly dependent on your setup, but you will need to open port 2456 for public traffic before users will be able to connect to your server remotely

Copying worlds

you can simply copy/replace the entire worlds folder if you want to transfer your current world to the new server

Windows location:

C:\Users\snipe\AppData\LocalLow\IronGate\Valheim\worlds

Linux location:

~/.config/unity3d/IronGate/Valheim/worlds
@martinskalicky
Copy link

Another note (crossplay enabled)

If you encounter problem that you can see server, you are able to join and then receive DC (you see empty map pretty much).

It was a problem with VPN. After pausing it, all works fine. Another solution might be to switch off firewall (I do not recommend). I did it for troubleshooting.

@Akorian
Copy link

Akorian commented Apr 25, 2025

Hi, just used this to launch my first Valheim Server - but I also like to keep my stuff updated. So how do I install updates to the game AND to the steamcmd? Can I just re-execute the commands to download it or will that overwrite to much?

@martinskalicky
Copy link

martinskalicky commented Apr 25, 2025

@Akorian

$ mkdir ~/Valheim
$ ./steamcmd.sh +login <steam_username> +force_install_dir /home/steam/Valheim +app_update 896660 validate +exit

This will give you that update. I recommend backup for every update.
You can easily get custom config + world and then re-create whole thing using install commands. That's easy way.

@oddzag
Copy link

oddzag commented Oct 9, 2025

Was not working for me out of the box. (Debian 12) Sharing my experience.

Error I was fighting:

Connecting anonymously to Steam Public...OK
Waiting for client config...OK
Waiting for user info...OK
Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
Error! App '896660' state is 0x2 after update job.

Log error output:

AppID 896660 state changed : Update Required,Update Queued, (No connection)
AppID 896660 state changed : Update Required, (Update delayed for 30 secs)
AppID 896660 scheduler finished : removed from schedule (result No connection, state 0xa)

I had to install steamcmd with

sudo apt update; sudo apt install software-properties-common; sudo apt-add-repository non-free; sudo dpkg --add-architecture i386; sudo apt update
sudo apt install steamcmd

Switching to steam user and running

/usr/games/steamcmd +force_install_dir /home/steam/Valheim +login anonymous +app_update 896660 validate +quit

Success! App '896660' fully installed.

If anyone else is dealing with this, but that suggestion didn't work, check /home/[your_username]/.local/share/Steam/logs/content_log.txt, I was getting this:

HTTPS (SteamCache,441) - cache2-den-iwst.steamcontent.com ([2607:dc0::5]:443 / [2607:dc0::5]:443, host: cache2-den-iwst.steamcontent.com): cache2-den-iwst.steamcontent.com/depot/1006/manifest/5587033981095108078/5/7885596384734351785 - received 0 (Invalid) HTTP response

I assumed it was an IPv6 thing so I disabled IPv6 in sysctl.conf (just to test it) with:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

After applying the changes with sudo sysctl -p, I could then install Valheim. No idea why it didn't like IPv6. This was on an OVHCloud dedicated VPS with Debian 12. Hopefully this is useful to someone else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment