Configuring the Raspberry Pi to Run the Valheim Server - Raspberry Pi Projects, Tutorials, Learning DIY Electronics - Makergenix

Breaking

 


Configuring the Raspberry Pi to Run the Valheim Server

 We'll demonstrate how to set up a specific Valheim server on the Raspberry Pi in this project.

Configuring the Raspberry Pi to Run the Valheim Server

A sandbox and tough survival video game called Valheim is set in a made-up Viking realm where the dead warriors must prove their worthiness for Valhalla. You must construct, create, and battle to survive in the game.

Even multiplayer with up to 10 additional players are supported in the game. Of course, your Raspberry Pi will be useful for this multiplayer support.

You will learn how to run a specific Valheim server on the Raspberry Pi in this post.


When coupled with a quick SD card or USB 3.0 device, the Pi shows that it is a respectably capable device for running the Valheim server software.


Even while the Valheim server hasn't been natively developed for the ARM architecture of the Pi, we can still run it by using a few pieces of software.


Before we continue, a Raspberry Pi 4 or newer is required for this project. The software that will be used to host the dedicated Valheim server does not yet function on earlier Pi models.

The tools we needed to set up a Valheim server on our Raspberry Pi are listed below.

Recommended

Optional

On a Raspberry Pi 400 running the most recent version of Raspberry Pi OS Lite, we tested this guide (Buster).

Putting your Raspberry Pi into Valheim Server mode


Please be aware that a 64-bit operating system is required in order to run a Valheim server on a Raspberry Pi. So, for the sake of this article, we'll concentrate on utilizing the 64-bit version of Raspberry Pi OS.

We strongly advise configuring your Raspberry Pi as headless in order to get the most out of your Valheim server's performance.

We need to do a few steps in order to get the Valheim development team's server to work on our Raspberry Pi because they haven't offered an ARM build of it.

Installing the Raspberry Pi's x86 and x64 emulators

Because the software we're utilising in this article isn't specifically designed for the ARM architecture of the Raspberry Pi, we'll need to utilise both an x86 and an x64 emulator.

Installing "box86" for the "SteamCMD" programme and "box64" for the specialised Valheim server are both necessary.

1. The Raspberry Pi must first have Box86 installed. We may use this piece of software to run "SteamCMD" on our computer.

We'll use SteamCMD to download the most recent version of the dedicated Valheim server to our Raspberry Pi.

Please refer to our instructions for using Box86 on the Raspberry Pi to create and install this software.

Make careful to obtain the most recent "tagged" release and avoid cloning the master copy of the code while following this instruction. When using the master version of Box86, there were problems executing "SteamCMD" at the time of writing.

2. You must additionally install Box64 after Box86 has been set up. While still being used to execute x64 applications on our ARM64 hardware, this programme is identical to Box86.

Since there are no native binaries for ARM, this programme will enable us to operate the Valheim dedicated server on our Raspberry Pi.

Ensure that you adhere to our instructions for installing Box64 on the Raspberry Pi.

Putting SteamCMD on the Raspberry Pi


Now that Box86 and Box64 have been installed on your Raspberry Pi, we may proceed to installing the last component.

We must utilise the Steam command-line tool "steamcmd" to download the Valheim dedicated server to our Raspberry Pi.

You may install and run SteamCMD on your Raspberry Pi by following the procedures shown below.

1. We need to create a directory to house the SteamCMD programme as our first step. Under our instance, we'll save this in the "pi" user's home directory under a directory named "steamcmd."

Using the following instructions on your Raspberry Pi, you may create this directory and change to it.
mkdir /home/pi/steamcmd
cd /home/pi/steamcmd

2. Using the command below, we can download and unpack SteamCMD now that we are in the directory.

This command will download the file using curl, then use a pipe (|) to deliver it directly to the tar programme. We may use a pipe to extract the data supplied by curl with only one command.
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -

3. Let's make sure SteamCMD is now functional before setting up the Valheim dedicated server on our Raspberry Pi.

By executing the script with the command listed below, we can confirm that the programme is operating properly.
./steamcmd.sh

The "steamcmd" programme will self-update and get ready for usage during its initial run.

4. When SteamCMD has finished upgrading, use the following command on your device to exit the application.
quit

Valheim Server installation on a Raspberry Pi

After getting our Raspberry Pi ready, we can set up the dedicated server for Valheim.

To do this, we will download the most recent release using the SteamCMD programme that we configured in the previous step.

1. Use the following command to confirm that we are in the same directory as where we downloaded SteamCMD.
cd /home/pi/steamcmd

2. Now that we are in the right spot, we can use SteamCMD to download the dedicated server for Valheim.

The following command may be used to start the server's download using SteamCMD.
./steamcmd.sh +@sSteamCmdForcePlatformType linux +login anonymous +force_install_dir /home/pi/valheim_server +app_update 896660 validate +quit

With this, we are sending the Steam command line a number of different commands. We'll briefly go through this so you understand what each step accomplishes.

  • +@sSteamCmdForcePlatformType linux We are requiring the platform type to be Linux by using this portion of the programme.
By doing this, the command-line tool is prevented from selecting the wrong platform.
  • +login anonymous - The "anonymous" user choice will allow us to log onto the Steam network.
The anonymous is useful for downloading freely downloadable software because it doesn't require a password.
  • +force_install_dir /home/pi/valheim_server The location of the server may be selected using this option in SteamCMD.
In our scenario, "/home/pi/valheim_server" will be where we install the Valheim dedicated server.

  • This section, +app_update 896660, allows us to choose what we wish to download.

The dedicated Valheim server's app ID in this instance is "896660".

3. The start-server script for Valheim will be changed so that you may customize it to meet your needs.

Use the nano text editor to start altering the "start server.sh" script by entering the following command.
nano /home/pi/valheim_server/start_server.sh

4. You need to change one line in particular in this file. This code will launch our Raspberry Pi's dedicated Valheim server.

To search for this line in nano, press CTRL + W.
./valheim_server.x86_64 -name "My server" -port 2456 -world "Dedicated" -password "secret"

Once you've located the line mentioned above, replace it with the next sentence.
./valheim_server.x86_64 -nographics -batchmode -port 2456 -public 0 -name "My Server Name" -world "MyWorldName" -password "MySecretPassword" -savedir "/home/pi/valheim_data"


You might wish to adjust a few settings before typing this new line. We shall now swiftly go through them.

  • -port 2456 The dedicated Valheim server's port will be specified using the port option. Generally speaking, unless another application is utilising it, it is safe to leave this set to the default.
Make care to port forward this port if your computer is protected by a firewall.
  • -public 0 You may choose whether you want your server to show up on the in-game server browser with this option.
This option's default value is 0, which means it won't be displayed. If you want it to be listed in the browser, set this to 1.

  • -name "My Server Name" The name you wish your server to appear under when listed in the server browser is saved using this option.
  • -word "MyWorldName" To define the name of your Valheim world, use this option.
Make sure this name doesn't include any file extensions, such .db or .fwl 

  • -password "MySecretPassword" This option allows you to define a password that players must input in order to access the game. This choice is optional and removeable.
Make sure your password has at least five characters before you input it.
  • -savedir "/home/pi/valheim_data" We may choose a location on our Raspberry Pi for the storage of the Valheim world data using this option.    
By default, we will save this world in a directory called "valheim_data" under our "pi" user's home.

5. After making these modifications to the file, you may save it and exit by clicking CTRL + X, Y, and ENTER.

How to use your Raspberry Pi Dedicated Server for Valheim


We can now launch our Valheim server on the Raspberry Pi by issuing a single command after installing and setting it up.

The server will be created with your modifications to the "start_server.sh" script that we edited before.

1. Make sure you are in the location where you installed the Valheim server before starting it on your Raspberry Pi.

On your device, use the following command to change to the proper directory.
cd /home/pi/valheim_server/

2. Once we are in the proper directory, we can use the following command to launch the Valheim dedicated server.

Using the help of this command, we may start the server with the pre-configured settings.
./start_server.sh

Please be aware that starting up the Valheim servers might take a long time. This is so that it can generate the game environment, a list of locations, and other necessary items.

3. Within Valheim, select "Join by IP" to connect to your server.

The hostname command may be used to find your Raspberry Pi's local IP address if you don't know it.
hostname -I

4. Press CTRL + C to exit the Valheim server when you are through using it.

The server will disconnect from all connections, save the world, and then shut down if you press these keys.

How to Start the Valheim Server at Boot


We need to build a service file on our Raspberry Pi in order to get the Valheim server to launch at boot.

You must keep in mind the settings you previously provided when you changed the "start_server.sh" script for this file.

1. On your device, run the following command to start building this new service.

We will call the new service we are developing "valheim."
sudo nano /etc/systemd/system/valheim.service

2. You must type the upcoming lines into this file. These lines specify the service and how to launch the Valheim server.
[Unit]
Description=Valheim Dedicated Server
Wants=network-online.target
After=network-online.target

[Service]
Environment=SteamAppId=892970
Environment=LD_LIBRARY_PATH=/home/pi/valheim_server/linux64:$LD_LIBRARY_PATH
Type=simple
Restart=on-failure
RestartSec=10
KillSignal=SIGINT
User=pi
Group=pi
WorkingDirectory=/home/pi/valheim_server
ExecStart=/home/pi/valheim_server/valheim_server.x86_64 -nographics -batchmode -port 2456 -public 0 -name "My Server Name" -world "MyWorldName" -password "MySecretPassword" -savedir "/home/pi/valheim_data"

[Install]
WantedBy=multi-user.target

You must ensure that the "ExecStart" line in these new lines is changed to reflect the same settings as the "start_server.sh" file you previously amended.

3. After creating the service to your satisfaction, save it by clicking CTRL + X, then Y, and finally ENTER.

4. By activating the service that we just built, you may make your Raspberry Pi so that the Valheim server starts when it boots.

Use the following command to activate our brand-new "valheim" service.
sudo systemctl enable valheim

5. We may manually start the service to avoid having to wait for our Raspberry Pi to restart.

You must provide the following command to manually start the "valheim" service.

sudo systemctl start valheim

6. To make sure the Valheim service is operating, you may check its status.

To get the service's status, use the command shown below on your device.
sudo systemctl status valheim

The status should be "Active: active (running)" if your Valheim dedicated server is functioning properly.

Updating your Valheim Server on the Raspberry Pi


The procedure of updating your Valheim dedicated server is rather simple and mostly entails utilising the "steamcmd" program that we previously set up in this guide.

1. Make sure your server is shut off before moving forward. The Valheim server cannot be updated while it is in use.

By using the command shown below, you can stop the Valheim dedicated server utilising our service.
sudo systemctl stop valheim

2. After the server has been halted, you may update the dedicated server by entering the following command.

The "steamcmd" utility will be invoked by this command, forcing it to download the most recent version of the software.
/home/pi/steamcmd/steamcmd.sh +@sSteamCmdForcePlatformType linux +login anonymous +force_install_dir /home/pi/valheim_server +app_update 896660 +quit

3. The most recent version of your server should now be installed. If you aren't utilising the service, you might need to modify the "start_server.sh" script once again because the update process can override it.

You may now restart the service we established in the previous step if you use it by executing the command below.

sudo systemctl start valheim


You must have your Raspberry Pi's dedicated Valheim server functioning at this point in the course.

Running a Valheim server on the Pi is a somewhat efficient and competent method. You should thus enjoy a good gaming experience on the server; the only hiccups we encountered were during the startup and save processes.


 


Most Viewed Posts

Write For Us

Name

Email *

Message *

All Blogs