Skip to content

husjon/valheim_server_oci_setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

Table of Content

⚠️ Disclaimer ⚠️

Self-upgrade not working (14th Jan 2025 - 9th Sept 2025)

The installer self-upgrade have had a bug in it since 14th of January 2025 where I introduced halt-on-error (see commit 52f55a8f), due to this, the self-upgrade functionality have not worked properly.

If you've used the script since, prior to today (9th of September 2025), you'll have to manually upgrade the script. This can be done by following the first steps in Installing the Valheim Dedicated Server.

Default x86_64 emulator

The default x86_64 emulator up until now (21th Sept 2025) has been Box86 and Box64, with the Call to Arms update for Valheim I've decided to replace Box with FEX. This has been considered for a while as it does seem very stable and in the future should allow for using mods (see Modding).
It is possible to switch back to using Box by setting the USE_BOX environment variable.

For further discussions, please do join my Discord server.

Ubuntu version

Currently the only supported version of Ubuntu is Ubuntu 22.04 LTS, please make sure the image Canonical Ubuntu 22.04 Minimal aarch64 is selected during the setup procedure.

This is because changes was done in preparation to how timestamps will be handled prior to 2038.
This was added last minute prior to the Ubuntu 24.04LTS release cycle feature feeeze, which unfortunately impacted armhf which we rely on here, more information can be found at the ubuntu mailing list: https://lists.ubuntu.com/archives/ubuntu-devel-announce/2024-March/001344.html

Credit

The original guide is from Reddit user That_Conversation_91 on r/Valheim.
Original post can be found here

Instructions

Note: For this guide a free account is required on the Oracle Cloud Infrastructure allowing us to spin up a server which is decently specced.

In this guide, we'll:

  • Set up a Virtual Machine using the Oracle Cloud Infrastructure, including firewall rules
  • Prepare and use SSH to connect to the Virtual Machine
  • Update the Operating System and install the Valheim Dedicated Server software
  • Finally we'll use Systemd to allow the server to run automatically.

If you have the knowledge of setting up a server on an alternative cloud provider or your own hardware you may skip ahead to Installing the Valheim Dedicated Server

Pre-requisite

Windows

To connect to the server in the section Connecting to the VM Instance we need to do some preparation.

  1. First of all we need an SSH client, namely Putty
  2. Head on over to https://www.putty.org/ and click on the Download PuTTY link
  3. Scroll down to Alternative binary files
    1. click on putty.exe (64-bit x86)
    2. next scroll down and you'll find puttygen click on puttygen.exe (64-bit x86)
  4. Open up puttygen
    1. Press Generate
    2. Copy the whole SSH key starting at ssh-rsa, we'll need this in the next section when Creating the VM Instance
    3. Press Save public key and save it to f.ex your Desktop
    4. Press Save private key and save it to f.ex your Desktop
      It will ask about password protecting the key, this isn't necessary for this setup.

Mac / Linux

Verify that we have a set of SSH key pairs

  1. Open a terminal
  2. Run the command ls -l ~/.ssh/.
    If you see the files id_rsa and id_rsa.pub, you can continue on with OCI (Oracle Cloud Infrastructure)
  3. If you did not see these files, you can run the command ssh-keygen -N '' -f ~/.ssh/id_rsa Now you can re-run the command from step 2 and you should see both files.

OCI (Oracle Cloud Infrastructure)

  1. Head on over to https://cloud.oracle.com/ to sign up for a free account.
    After logging in you will be shown a Get Started page.
    All subsequent section starts from Getting Started.

Creating the VM instance

  1. From the Home dashboard, scroll down a bit and click the Create a VM instance
  2. Create compute instance
    1. Basic information

      1. Give the instance a name, for example Valheim Server
      2. Leave compartment default unless you already have another compartment set up that you'd like to use.
      3. Leave placement default.
        Note: you might need to change it if it complains about placement allocation during deployment.
      4. Under Image click Change image and choose a Canonical Ubuntu 22.04 Minimal aarch64 and confirm with the Select image button.
        Note: make sure you select aarch64 which is aimed at ARM server
      5. Under Shape click Change shape and set the following:
        • Instance type: Virtual machine
        • Shape series: Ampere
        • Shape: VM.Standard.A1.Flex
      6. Expand the little triangle next to the shape name to set the following:
        • OCPUs: 4
        • Memory: 24GB
      7. Click Select shape
      8. Click Next
    2. Security

      1. Leave everything default
      2. Click Next
    3. Networking

      1. Select Create new virtual cloud network and leave the values as is.
      2. At the bottom you'll find Add SSH keys
        • For Linux and Mac you can find your SSH keys under ~/.ssh/id_rsa.pub
          In this case you can select Upload public key files (.pub) then navigate to ~/.ssh/id_rsa.pub
        • For Windows, the SSH public key we copied in Pre-requisite for Windows can be pasted in by under Paste public keys
      3. Click Next
    4. Storage

      1. Leave everything default
      2. Click Next
    5. Review Here you'll get a final summary of what will be set up, review as needed, when ready, click Create.
      This will take a couple of minutes while the instance is being provisioned / set up.
      Note: If you get a warning about Out of Capacity, Go back to the Placement section under Basic Information and try another Domain (AD 1, AD 2 or AD 3), and try again.

      While we wait for it to be provisioned we'll go back to the dashboard and set up the networking.
      Click on the Cloud header or click here to go back to the Getting started page.

Configuring the Network and firewall rules

  1. At the top of the Home dashboard, click on Hamburger menu in the top left corner
  2. Under Networking, click Virtual Cloud Networks, then click the network (f.ex vcn-20221120-1500)
  3. At the top under the network name, click on Security, then the Default Security List for NETWORKNAME
  4. We will be creating a rule so that we can connect to the server from Valheim, click on Security rules.
    1. Under Ingress Rules, click Add Ingress Rules:
      • Source Type: CIDR
      • Source CIDR: 0.0.0.0/0
      • IP Protocol: UDP
      • Source Port Range: All or leave blank
      • Destination Port Range 2456-2459
  5. Click on the Hamburger menu and navigate to Compute, then Instances
  6. In the table next to the name of your instance, you'll see the Public IP. Copy this as we will need this in the next step.

Connecting to the VM Instance

The IP Address we copied in the previous step will be referenced here as IP_ADDRESS

Windows

  1. Start putty which we downloaded in Pre-requisite for Windows
  2. We'll configure the following parameters:
    • Host Name (or IP address): IP_ADDRESS
    • Port: 22
    • Saved Sessions: Valheim Server
    • Close window on exit: Never
    • Click Save
  3. Next in the navigation tree to the left go to Connection > SSH > Auth > Credentials
    1. Under Private key file for authentication click Browse... and navigate to the Private key we saved using puttygen
  4. Go back up in the navigation tree to Session and click Save
  5. Then click Open
  6. You should within a couple of seconds see a prompt along the lines of ubuntu@instance-20221120-1503:~$
  7. You're now good to go to Installing the Valheim Dedicated Server

Mac / Linux

  1. On Mac and Linux we already have an SSH client installed.
  2. Open up a terminal then execute ssh ubuntu@IP_ADDRESS
  3. You should within a couple of seconds see a prompt along the lines of ubuntu@instance-20221120-1503:~$
  4. You're now good to go to Installing the Valheim Dedicated Server

Installing the Valheim Dedicated Server

  1. Run the following command:

    wget https://raw.githubusercontent.com/husjon/valheim_server_oci_setup/refs/heads/main/setup_valheim_server.sh

    This will download the installation script onto your server allowing it to set up everything which is needed.

  2. Then run the following command:

    bash ./setup_valheim_server.sh

    The first time this is run, the setup script will update the operating system and then reboot. If you get notification about kernel upgrades, or restarting services you may just press Enter, allowing the default values be. After it's done you will be disconnected, wait about 15-20 seconds then reconnect to the server.

  3. Run the same command again

    bash ./setup_valheim_server.sh

    Note: If you're playing on Console or Xbox Game Pass / Microsoft Game Pass, please enable Crossplay.
    Also, read the Crossplay section.

    The installation will take a couple of minutes to complete as the script installs all the necessary packages and set up the server with initial values.
    Once it finishes it let you know that we need to make a small edit to one file then start the server.

Configuring the Valheim Server

  1. Open up the server_credentials file with nano ~/server_credentials (or text editor of choice)
  2. Adjust the SERVER_NAME, WORLD_NAME PASSWORD, PUBLIC as you see fit.
    Note: The setup script populated the password field automatically with a random decently strong password.
  3. When done, Press Ctrl+X, then y and finally Enter.
    Note: Mac users might need to use the Cmd button instead of Ctrl

Starting the Valheim Server

To start the server, run the command valheim_server start
This will take a couple of minutes as the world is being generated.

From within the game, it might not show in the Select Server list, instead click the Add server button and type in the address IP_ADDRESS:2456 (Using the IP address fromConfiguring the Network and firewall rules)

More information can be found in the attached Readme.md file and can be viewed with cat ~/Readme.md

Updating the Valheim Server

Whenever the Valheim client updates, the server also needs to be updated.
To do this, log onto the VM then run the command valheim_server update
This will stop the running server and update the server files.
Once done, you must start the server using valheim_server start

Crossplay (Console / Game Pass)

Note: Crossplay on ARM architecture is currently experimental (thanks to @bitdo1).

During setup you will be asked if crossplay should be enabled or disabled.
The question for enabling crossplay has been disabled due to instability.
If however you'd like to try it out, the following command can be run:

CROSSPLAY_SUPPORT=true bash ./setup_valheim_server.sh

This will configure the server to allow for crossplay support.
Do keep in mind that this is experimental and might cause the server to crash.
If this is the case, re-running the install script as described in Installing the Valheim Dedicated Server will restore it.

If you'd like to enable / disable this after the first setup, you can change it by rerunning the setup script. You will need to restart the server for this to take effect using valheim_server restart

After crossplay has been enabled, the join procedure is the same as normal using IP:port, however you can now also join by using a 6 digit code which can be found in the logs after the server has started (using the valheim_server logs-live command).
Example log message:
Session "My Valheim server" with join code 295265 and IP 12.34.56.78:2456 is active with 0 player(s)

Note: Do keep in mind that the join code will change every time the server is restarted!

Modding

BepInEx currently do not support ARM, hence modding currently seem to not be possible.
If this changes in the future, this section will be updated to reflect that.
An issue has been raised with BepInEx and can be found here BepInEx/BepInEx#336

As the default emulation layer has been changed to FEX, modding should now be possible.
If you're feeling comfortable editing the systemd service file that is currently used, you're more than welcome to, do however keep in mind that re-running the setup script does revert these changes, unless you're using overrides.

If you're willing to try to install mods on your ARM instance and are able to so successfully, please do let us know in the Discord server.

As for a guide to install mods, here is one.
https://www.youtube.com/watch?v=h2t9cSFidt0

Installer Self-update

The setup_valheim_server.sh now has a self-update feature which allow it to update itself and apply any bugfixes that should be necessary whenever the script is run.

After updating, it will show what have changed, update itself, then ask the user to restart the setup script.
It is not retroactively applied, hence the script will need to be downloaded again f.ex with:

wget https://raw.githubusercontent.com/husjon/valheim_server_oci_setup/refs/heads/main/setup_valheim_server.sh -O ~/setup_valheim_server.sh

This will overwrite the existing script.

This feature was added Thu, 15 Dec 2022 19:56:51 +0100.

Adding Pre-existing worlds

If you already have a world you've played on (f.ex hosted on your own computer) and you'd like to continue using it with this server,
the following steps can be used.

  1. Locate your save folder, navigate to this folder:
    The files we are interested in are the .db and .fwl files. _ Windows: %userprofile%/AppData/LocalLow/IronGate/Valheim/Worlds _ Linux: $HOME/.config/unity3d/IronGate/Valheim/worlds
  2. Stop the Valheim Server with valheim_server stop
  3. With an SFTP client (f.ex FileZilla), upload the .db and .fwl file to the folder: /home/${USER}/valheim_data
  4. Edit the ~/server_credentials and update the WORLD_NAME parameter to the name of your World files.
    F.ex if you world file was My_Valheim_World.db and My_Valheim_World.fwl, set it to WORLD_NAME="My_Valheim_World"
  5. Start the Valheim Server with valheim_server start
  6. Within a few moments the server should be back up and running with the world you uploaded.

Troubleshooting

In case you should experience any issues and would need some assistance, the install logs and server logs are helpful to troubleshoot the issue.

To help with this the following steps should be followed:

  1. Create a log output of the running server using the following command:
    journalctl --no-pager --since=-1d --user -u valheim_server > ~/valheim_server.systemd.log
    This will take a snapshot of the logs from the Valheim Server from the last 24 hours.
    In case the Valheim server was never started, this can be omitted.
  2. Download the install_valheim_server.log and valheim_server.systemd.log file located under /home/ubuntu using f.ex FileZilla.
    Note: Use port 22 for SFTP/SSH.
  3. Go to https://gist.github.com/, click Add File for each file, then Create Public / Secret Gist
    This creates a gist (similar to this guide) which we can go through to troubleshoot.
  4. Copy the URL to the gist and create a comment down below describing the issue and adding the link to the gist.

I might be delayed due to work / timezones etc, but hoping to get you going as quickly as possible.

Discord

I've decided to open up my discord server so if you need help or would like to suggest improvements or similar, please tag along.
https://discord.gg/ExnzM4E7pE

Changing versions

This could be useful in case the public version breaks something. Make sure you create a backup of the server before switching versions.

Switcing to the Previous Stable Version

  1. Run SteamCMD to change to the default_old branch
cd ~/steamcmd

./steamcmd.sh \
    +@sSteamCmdForcePlatformType linux \
    +force_install_dir "/home/$USER/valheim_server" \
    +login anonymous \
    +app_update 896660 -beta default_old validate \
    +quit
  1. In Steam, right-click the game, open Properties, go to Betas and select default_old from the dropdown and wait for the game to update (this might take a few minutes).
  2. Start the game and connect to your server as normal.

Switching to the Public Beta Branch

  1. Run SteamCMD to change to the public-test branch
cd ~/steamcmd

./steamcmd.sh \
    +@sSteamCmdForcePlatformType linux \
    +force_install_dir "/home/$USER/valheim_server" \
    +login anonymous \
    +app_update 896660 -beta public-test -betapassword yesimadebackups validate \
    +quit
  1. In Steam, right-click the game, open Properties, go to Betas and select public-test from the dropdown and wait for the game to update (this might take a few minutes).
    If public-test is not in the list, type in yesimadebackups in the Input field below and press Check Code.
  2. Start the game and connect to your server as normal.

Reverting back to the public version

  1. Run SteamCMD to change to the public branch
cd ~/steamcmd

./steamcmd.sh \
    +@sSteamCmdForcePlatformType linux \
    +force_install_dir "/home/$USER/valheim_server" \
    +login anonymous \
    +app_update 896660 -beta public validate \
    +quit
  1. In Steam, right-click the game, open Properties, go to Betas and select None from the dropdown and wait for the game to update (this might take a few minutes).
  2. Start the game and connect to your server as normal.

Oracle and Reclamation of Idle Compute Instances

Oracle have a policy on their Always Free instances whichs allows them to reclaim instances that are idle or using less than a certain percentile (See: Always_Free_Resources).

For the most part using the server should not trigger this.

If the server should be flagged for reclaimation, you'll receive an email saying that it has been flagged for being idle for the last 7 days.
Next it will say that if it continues for another 7 days, the server will be stopped.
This gives us ample time to either back up the data or continue playing.

The only thing needed to do is to log onto your Oracle Cloid Infrastructure, go to your Instances and click the Restart button, this will pause the reclaimation.

TODOs

  • Add ability to update the Valheim server prior to starting the server.
    Tue, 24 Jan 2023 23:01:18 +0100
    Now part of the valheim_server helper command.

  • Add information about adding pre-existing worlds
    Tue, 24 Jan 2023 22:47:19 +0100

  • Add support for users other than ubuntu
    Tue, 24 Jan 2023 22:33:56 +0100
    Made it so that the install script no longer is tied to the ubuntu user.

About

Setup instructions for running Valheim on Oracle Cloud Infrastructure using Arm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages