

Script and Instructions to setup a Valheim Dedicated Server using Oracle Cloud I...
source link: https://gist.github.com/husjon/c5225997eb9798d38db9f2fca98891ef
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Table of Content
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.
- 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.
Mac / Linux
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.
OCI (Oracle Cloud Infrastructure)
- 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
- 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 Canonical Ubuntu and confirm with the Select image button.
- 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:
- 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.
Configuring the Network and firewall rules
- 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.
Connecting to the VM Instance
The IP Address we copied in the previous step will be referenced here as IP_ADDRESS
Windows
- 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
Mac / Linux
- 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
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
This will take a couple of minutes to complete.
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
- 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
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
Crossplay (playing with console players)
By re-running the setup script you will be asked if crossplay should be enabled or disabled.
You will need to restart the server for this to take effect using valheim_server restart
Note: Crossplay is unfortunately not yet supported on servers running ARM architecture.
It might be in the future.
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
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
Self-updating
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.
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.
- 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.
TODOs
-
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.
Recommend
-
22
Valheim Docker If you are looking for a guide on how to get started click here
-
2
The best video games of 2021 (so far): from Outriders to Valheim Sci-fi looter shooters, Viking purgatory and jazz-fuelled gumshoe yarns spanning all of creation; the best games of 2021 are an eclectic lot
-
10
How do I set up a server status script on a VPS or Dedicated Server? Overview If you have a
-
4
Valheim Food Graph Sep 27, 2021 • LJ MIRANDA | 2 min read (308 words) Instruction: What you see above i...
-
17
Set up a server status script on a VPS or Dedicated server Overview If you have a
-
5
Nightingale is an alt-history, multiverse-jumping Valheim
-
13
Pre-requests CS:GO is a popular FPS game that has been around for over 10 years. This article will show you how to setup CS:GO dedicated server on Azure using a Windows VM and Storage Account. The server will be able to let clients...
-
7
recommened you do this from within tmux since the steamcmd utility creates its own repl Install SteamCMD taken from here $...
-
3
Microsoft’s premium game service is the best in the industry
-
6
Configuring AWS ECS to have access to AWS EFS If you would like to persist data from your ECS containers, i.e. hosting databases like MySQL or MongoDB with Docker, you need to ensure that you can mount the data directory of the d...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK