How to install Valheim on Ubuntu Server

Published on March 18, 2023 · Updated on March 18, 2023
How to install Valheim on Ubuntu Server

In this guide, we will show you how to install and configure a Valheim server on a dedicated Linux Server. We will be using Ubuntu 22.04 Jammy and LinuxGSM in this tutorial.

LinuxGSM is a command-line tool which makes it simple to deploy install and configure a lot of game servers on Linux.

How much Server resources do I need for Valheim server? 

If you are gaming with just a few friends, lets say 2-3 people then 2 vCPUs with 2-4GiB RAM is defenetely enough. For more than 10+ slots I would suggest to go for at least 4 CPU and 8GiB of RAM. In most cases the Network seems the bottleneck of the gameserver. Its recommended to have a network connection of at least 100Mbps, 1Gbps is even better.

The game seems to spike during the world save every 20 minutes for about 1-2 seconds, otherwise it usually uses about 40% of 1 CPU core.

Is a cloud provider like DigitalOcean good for a valheim dedicated server? 

Wheter to use a cloud provider like digitalocean, Linode or Hetzner or run it on your own Hardware in a VM is up to you.

When installing your Valheim server at home, be aware that you might have to forward ports in your router, so others can join your server. Also make sure to use enough resources for your server, otherwise it might lag.

Prerequisites 

  • An Ubuntu 18.04, 19.10 or 22.04 Server with root or sudo privileges
  • Basic knowledge of the Linux command line

Connect to server 

Before we can start the installation process we have to connect to our server via SSH. In order to connect to the server we need a SSH Client. In this example I will be using Termius, you can however follow this tutorial with any SSH client of your choice.

Installation guide for Valheim Server 

In this guide we will be using a fresh minimal Ubuntu 22.04 cloud image (the same that the popular cloud service provider use), so that we can give you the best copy and paste guide experience to follow along, regardless of which hoster you use.

  1. Enable support for 32-bit architecture and update all packages in the apt-repository. {.group}
sudo dpkg --add-architecture i386 && sudo apt update
  1. We need the following necessary packages which we can install using apt: tmux, curl, wget, unzip, bzip2 as well as steamcmd and other dependencies.
sudo apt install curl wget file tar bzip2 gzip unzip bsdmainutils python3 util-linux ca-certificates binutils bc jq tmux netcat lib32gcc-s1 lib32stdc++6 libsdl2-2.0-0:i386 steamcmd libc6-dev 

When prompted for the steam LICENSE Agreement, we need to agree and click OK. To navigate in the popup, we can use the arrow keys or by pressing TAB on the keyboard.

3) Install GameDig 

GameDig is an module which uses the game server console commands to query live game data. This make its possible to verify and monitor the game server status in real time.

GameDig requires NodeJS to be installed on the system. There are a few ways to install nodeJS on our Ubuntu machine, we will be using the NVM method, this allows use to easily switch between node versions on our system with ease.

3.1) Install Node 

To get the NVM script we can use curl to download and pipe into bash to run the script directly.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

The script clones the nvm repository to ~/.nvm and attemts export a few enviroment variables to the correct profile file for your shell on the system.

To load the profile we can either close the terminal window and start a new user session or we just copy and paste the command that the install script gave us.

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

Now we can install and manage node installation with ease. To install the latest lts node version we simply run:

nvm install --lts

3.2) Install GameDig

Now we can install GameDig using npm with the following command:

sudo npm install gamedig -g 

Create a dedicated user 

For security reason, we should create a dedicated user to manage the valheim server.

sudo adduser vhserver

The system will ask us for a password for the user. As well as for the user data. Type in a password and confirm it, for the user information you can leave it for default by pressing ENTER 5 times. Afterwards confirm with Y.

A user with the username vhserver was succesfully created! To switch to the new user use the following command:

su - vhserver

Install LinuxGSM 

To install the Latest LinuxGSM script we can use the following command:

wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh vhserver 

Now we can install valheim using linuxGSM:

./vhserver install

Configure Valheim server 

Before we start the gaming server, we need to configure it correclty.

FAQ Valheim dedicated Server on Linux

Which

Load Comments