- Table of Content
⚠️ Disclaimer⚠️ - Credit
- Instructions
- Pre-requisite
- OCI (Oracle Cloud Infrastructure)
- Connecting to the VM Instance
- Installing the Valheim Dedicated Server
- Configuring the Valheim Server
- Starting the Valheim Server
- Updating the Valheim Server
- Crossplay (Console / Game Pass)
- Modding
- Installer Self-update
- Adding Pre-existing worlds
- Troubleshooting
- Changing versions
- Oracle and Reclamation of Idle Compute Instances
- TODOs
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
This install script has now been updated with a configuration for box64 which has been tested to work for a few weeks and by different people using this guide.
If you have made any changes to the ~/.box64rc
configuration file for the [valheim_server.x86_64]
section, please remove it and run the setup script.
If you should experience any issues, please leave a comment.
This script / procedure for setting up a Valheim server on ARM is currently broken as of 7th of November 2023.
(https://www.valheimgame.com/news/patch-0-217-28/)
This unfortunately also includes the rollback procedure.
Check comments for any updates regarding this issue.
The original guide is from Reddit user That_Conversation_91 on r/Valheim.
Original post can be found here
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
To connect to the server in the section Connecting to the VM Instance we need to do some preparation.
- First of all we need an SSH client, namely Putty
- Head on over to https://www.putty.org/ and click on the Download PuTTY link
- Scroll down to Alternative binary files
- click on putty.exe (64-bit x86)
- next scroll down and you'll find puttygen click on puttygen.exe (64-bit x86)
- Open up puttygen
- Press Generate
- Copy the whole SSH key starting at ssh-rsa, we'll need this in the next section when Creating the VM Instance
- Press Save public key and save it to f.ex your Desktop
- 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.
Verify that we have a set of SSH key pairs
- Open a terminal
- Run the command
ls -l ~/.ssh/
.
If you see the filesid_rsa
andid_rsa.pub
, you can continue on with OCI (Oracle Cloud Infrastructure) - 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.
- 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.
- From the Getting Started dashboard, scroll down a bit and click the Create a VM instance
- On the right hand side of Image and shape click Edit
- 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 - Click Change shape and set the following:
- Instance type:
Virtual machine
- Shape series:
Ampere
- Shape:
VM.Standard.A1.Flex
- OCPUs:
4
- Memory:
24GB
- Instance type:
- Click Change image and choose a Canonical Ubuntu 22.04 Minimal aarch64 and confirm with the Select image button.
- On the right hand side of Networking click Edit
- Select Create new virtual cloud network and leave the values as is.
- On the right hand side of Add SSH keys click Edit
- If you're f.ex on Linux or 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
- If you're f.ex on Linux or Mac you can find your SSH keys under
- Click Create.
Note: If you get a warning about Out of Capacity, scroll up to the Placement section and try another Domain (AD 1, AD 2 or AD 3), and try again.
This will take a couple of minutes while the instance is being provisioned / set up.
While we wait for it we'll go back to the dashboard and set up the networking.
Click on the ORACLE Cloud header or click here to go back to the Getting started page.
- At the top of the Getting started page, click on Dashboard
- Under Resource explorer, click Virtual Cloud Networks, then click the network (f.ex
vcn-20221120-1500
) - On the left hand side, click on Security Lists, then the
Default Security List for NETWORKNAME
- We will be creating a rule so that we can connect to the server from Valheim.
- Under Ingress Rules, click Add Ingress Rules:
- Source Type:
CIDR
- Source CIDR:
0.0.0.0/0
- IP Protocol:
UDP
- Source Port Range:
All
- Destination Port Range
2456-2459
- Source Type:
- Under Ingress Rules, click Add Ingress Rules:
- Click on the ORACLE Cloud header or click here to go back to the Getting started page.
- Navigate back to the Dashboard, under the Resource explorer click on Instances then the instance (f.ex
instance-20221120-1503
) - On the right hand side you'll see Instance access, click Copy to the right of Public IP address, we need this in the next step.
The IP Address we copied in the previous step will be referenced here as IP_ADDRESS
- Start putty which we downloaded in Pre-requisite for Windows
- 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
- Host Name (or IP address):
- Next in the navigation tree to the left go to Connection > SSH > Auth > Credentials
- Under Private key file for authentication click Browse... and navigate to the Private key we saved using puttygen
- Go back up in the navigation tree to Session and click Save
- Then click Open
- You should within a couple of seconds see a prompt along the lines of
ubuntu@instance-20221120-1503:~$
- You're now good to go to Installing the Valheim Dedicated Server
- On Mac and Linux we already have an SSH client installed.
- Open up a terminal then execute
ssh ubuntu@IP_ADDRESS
- You should within a couple of seconds see a prompt along the lines of
ubuntu@instance-20221120-1503:~$
- You're now good to go to Installing the Valheim Dedicated Server
-
Run the following command:
wget https://gist.githubusercontent.com/husjon/c5225997eb9798d38db9f2fca98891ef/raw/setup_valheim_server.sh
This will download the installation script onto your server allowing it to set up everything which is needed.
-
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. -
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.
- Open up the server_credentials file with
nano ~/server_credentials
(or text editor of choice) - 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. - When done, Press
Ctrl+X
, theny
and finallyEnter
.
Note: Mac users might need to use theCmd
button instead ofCtrl
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
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
Note: Crossplay on ARM architecture is currently experimental (thanks to @bitdo1).
During setup you will be asked if crossplay should be enabled or disabled.
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!
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
PS: If you're willing to try to install mods on your ARM instance and are able to so successfully, please do let me know.
As for a guide to install mods, here is one.
https://www.youtube.com/watch?v=h2t9cSFidt0
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://gist.github.com/husjon/c5225997eb9798d38db9f2fca98891ef/raw/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.
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.
- 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
- Windows:
- Stop the Valheim Server with
valheim_server stop
- With an SFTP client (f.ex FileZilla), upload the
.db
and.fwl
file to the folder:/home/${USER}/valheim_data
- Edit the
~/server_credentials
and update theWORLD_NAME
parameter to the name of your World files.
F.ex if you world file wasMy_Valheim_World.db
andMy_Valheim_World.fwl
, set it toWORLD_NAME="My_Valheim_World"
- Start the Valheim Server with
valheim_server start
- Within a few moments the server should be back up and running with the world you uploaded.
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:
- 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. - Download the
install_valheim_server.log
andvalheim_server.systemd.log
file located under/home/ubuntu
using f.ex FileZilla.
Note: Use port 22 for SFTP/SSH. - 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. - 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.
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
This could be useful in case the public version breaks something. Make sure you create a backup of the server before switching versions.
- 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
- 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). - Start the game and connect to your server as normal.
- 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
- 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).
Ifpublic-test
is not in the list, type inyesimadebackups
in the Input field below and press Check Code. - Start the game and connect to your server as normal.
- 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
- 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). - Start the game and connect to your server as normal.
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.
-
Add ability to update the Valheim server prior to starting the server.
Tue, 24 Jan 2023 23:01:18 +0100
Now part of thevalheim_server
helper command. -
Add information about adding pre-existing worlds
Tue, 24 Jan 2023 22:47:19 +0100 -
Add support for users other thanubuntu
Tue, 24 Jan 2023 22:33:56 +0100
Made it so that the install script no longer is tied to theubuntu
user.
Good morning,
for a few days the server has been giving me the same error and this causes it to restart, normally it happens after half an hour.
https://gist.github.com/ManuelROAL/493026e74f1dfe63b23de823a2ed5483