How to create a Valheim server on Linux

How to create a Valheim server on Linux

If you're not looking for a how-to guide or don't want to deal with the setup, skip to the end of the article to find details on managed Valheim server hosting.


The first thing you're going to need is a Linux machine, this could be a virtual private server or dedicated server, just as long as it is running a Linux distro. In this example we're going to be running Ubuntu 20.04, but this process will be very similar regardless of your distribution. For this walkthrough we're going to be using a VPS from Vultr.

Let's start by getting connected to our Linux machine by SSH. Our first task will be to install the Steam Command package - to do this you can enter the following commands - this command will install the SteamCMD package to your /usr/games/ directory.

dpkg --add-architecture i386; apt update;apt-get install steamcmd -y; ln -s /usr/games/steamcmd steamcmd;

You will be prompted with a screen that looks like this - it may look a little overwhelming but it's just the Steam license agreement. Simply press the right arrow key and then the enter button. On the next screen press "I Accept".

Just wait for the program to be fully installed and setup, and then proceed to the next step. SteamCMD has now been installed, and we need to download the Valheim server - to do this you need to run the following.

./steamcmd +force_install_dir /usr/games/valheim +login anonymous +app_update 896660 validate +quit

After a short while (depending on your download speed) the server software will be downloaded to your machine- what you do next will heavily depend on the environment you're running this server in. If you're running this server on a general purpose VPS or dedicated server you won't need to make any network changes, however if you're running this on your desktop you will need to research port forwarding for your router.

Perfect! We've got our server downloaded, but how exactly are we going to run it? This will be heavily dependant on how technical you are; you could setup a system service or you could use screen to run the server in the background. For this example, and for ease, we're going to use screen.

Start by typing the word "screen" into your command line SSH to your server, press enter, and enter again. Your window will now look almost identical to how it did a moment ago, the main difference is you are now inside a screen window that will remain running even when you disconnect from SSH - this means you can leave the game running in the background. So next let's start the game. Run the following commands:

cd /usr/games/valheim

./start_server.sh

Your server will now be up and running! You can disconnect from the server SSH by pressing Ctrl+A followed by Ctrl+D. Your server is now in the background and you can close your SSH window. To return to your server you can type: "screen -r" into the command line.

You can now connect your Valheim client directly to your servers IP address and get playing!


Don't want the hassle of hosting the server yourself?

We can help! Valheim Server Hosting is available on ServerFlex and with plans starting from $9/month (£7, €8) it is even cheaper than running on Vultr!

ServerFlex

ServerFlex

Hi there - we're the ServerFlex team!