Running your own dedicated Valheim server

Running your own dedicated Valheim server

Valheim is a new "brutal exploration and survival game" that is "set in a procedurally-generated purgatory inspired by viking culture". This is a guide on how to run your own dedicated Valheim server.

Valheim on Steam
A brutal exploration and survival game for 1-10 players, set in a procedurally-generated purgatory inspired by viking culture. Battle, build, and conquer your way to a saga worthy of Odin’s patronage!


A Digital Ocean droplet with at least 2 vCPUs and 4Gb of Memory (or equivalent) is necessary in order to support 10 concurrent players (currently the games maximum).

Use my Digital Ocean referral link to receive $100 in credit (that's 5 free months to run this server!):

Getting started

Once you've got your server provisioned you can follow these dedicated server installation instructions to install and run the Valheim dedicated server binary.

Valheim Installer and Menu System for managing your Valheim Dedicated Server. Supports Vanilla or Mod modes. Built on Ubuntu 20.04. - Nimdy/Dedicated_Valheim_Server_Script

One of the last steps will have you expose traffic to UDP ports on your server so game clients can connect. Here's how you can do this on a Digital Ocean droplet running Ubuntu:

sudo ufw allow ssh
sudo ufw allow 2456:2458/udp
printf 'y' | sudo ufw enable
This allows SSH access on port 22 and UDP access on ports 2456 through 2458.
Don't skip the first command in the block above, otherwise you'll lock yourself out of your server via SSH.


Once your server has been rebooted you can now connect with a game client and invite your friends to do the same. Be sure to give them the following:

  • The server name (Incase they want to search via the in-game interface)
  • The server IP address (Incase they want to connect directly via IP)
  • The server password (If you setup a private server rather than public)

Admin access

Want to grant your friends in-game admin access to the server?

Find your friends Steam ID and append it to this file:

echo "${STEAM_ID}" >> /home/steam/.config/unity3d/IronGate/Valheim/adminlist.txt


If something happens to your server you definitely don't want to lose all the time and effort you and your friends have put into your world. Luckily you can use a few readily available tools to backup your world data in order to prevent this scenario.

You could always backup your world data by using scp to copy the /home/steam/.config/unity3d/IronGate/Valheim/worlds directory to some other machine, but if you want to bullet-proof this you should archive these backups in the cloud.

Assuming you've got an AWS account and an S3 bucket, first wire up the credentials on your server:

cat << EOF > /etc/environment
Set your AWS CLI credentials as system-wide environment variables on your server.

Here's how to backup your world data to S3 using tar and gzip:

tar c /home/steam/.config/unity3d/IronGate/Valheim/worlds | gzip | aws s3 cp - s3://${S3_BUCKET_NAME}/$(date +%Y-%m-%d-%H.%M.%S).tar.gz
Package up your world data, compresses it, and ship it to your S3 bucket.

If you want to automate this just add the command above to your crontab:

sudo apt install cron
sudo systemctl enable cron
crontab -l | { cat; echo "@daily tar c /home/steam/.config/unity3d/IronGate/Valheim/worlds | gzip | aws s3 cp - s3://${S3_BUCKET_NAME}/$(date +%Y-%m-%d-%H.%M.%S).tar.gz"; } | crontab -
Install and add a crontab entry to backup your world data to s3 every day.


Luckily the scripts included in the dedicated server installation instructions handle upgrades automatically, however the valheimserver.service needs to be restarted via systemctl each time there is a client release. This can be especially annoying when you wake up to a slew of messages from your fellow vikings when they can't connect to your server.

Here's how to manually restart your Valheim server:

sudo systemctl stop valheimserver.service && \
    sleep 60 && \
    sudo systemctl start valheimserver.service
Show Comments