Skip to content

Instantly share code, notes, and snippets.

@1010101110
Last active April 1, 2023 01:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save 1010101110/28848ba86407aa137de73ca41e82a86d to your computer and use it in GitHub Desktop.
Save 1010101110/28848ba86407aa137de73ca41e82a86d to your computer and use it in GitHub Desktop.
Valheim Linux server google cloud setup full
==first==
download+install putty to your pc
download+install winscp to your pc
start menu type PuttyGen
hit generate
hit save private key
hit save public key
to somewhere safe, this will be like your encrypted password to the server.
don't share the private key with anyone
if you don't have a text editor i would suggest visual studio code
==console.cloud.google.com==
enter your info, free 300$ credits for new people!
==ssh key setup (server authentication)==
click compute engine in menu
go to Metadata in left menu
click sshkeys tab
hit edit
hit add item
if you don't still have puttygen open... open it back up and load your key
where it says public key for pasting into openssh authorized_keys
copy that and paste it into the browser
at the end you will notice " rsa-key-date"
replace that with your username seen on above keys
(mines my gmail without the @xxx)
save
==creating your server==
menu > compute engine
create vm instance
machine = e2 (or larger if you want)
region closest to you
Bootdisk hit change button
select operating system ubuntu
select version ubuntu 16.04 LTS
select
create
wait for it to come up
copy the external ip
yay your ubuntu server is now online in google's datacenter
==allow valheim ports in network==
vpc
add port allow 2456-2458
==open putty==
hostname or ip address enter the external ip
on left pick connection > ssh > Auth
privatekeyfile for authentication pick your private key file you saved earlier
on left go back to top
hit save (name whatever u want)
then hit open button
hit yes about trusting server keys
it should log you in as your admin account yey
this is your command line interface to the ubuntu server
now when you want to connect you can just hit load on your saved session then hit open
==open winscp==
select new site
hostname = external ip from your server
username = your admin username
hit advanced
on left select SSH > Authentication
put your private key file
hit ok
hit save
hit login
trust server cert
==show hidden files
menubar options
preferences
select Panels on left
show hidden files checkbox
yay now you have access to the file system
==installing valheim server==
we will use this tool to make install easy
https://linuxgsm.com/lgsm/vhserver/
you don't need to make a separate account like they say in tutorial, it will make everyting harder.
we already have our admin account that is perfect for this.
=install dependencies
sudo dpkg --add-architecture i386; sudo apt update; sudo apt install curl wget file tar bzip2 gzip unzip bsdmainutils python util-linux ca-certificates binutils bc jq tmux netcat lib32gcc1 lib32stdc++6 steamcmd
=install the linux gsm script
wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh vhserver
=install the server
./vhserver install
=install nodejs
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt update && sudo apt install -y nodejs
=install gamedig
npm install gamedig -g
woo that was easy!
==configuring valheim server==
since we are using linux gsm to run this we will use their config files
=look at the default config file (in winscp double click it)
lgsm/config/_default.cfg
=and copy these lines
servername="Valheim Server"
# Minimum password length is 5.
serverpassword=""
port="2456"
gameworld="${selfname}"
public="1"
=open safe place to config
lgsm/config-lgsm/vhserver/common.cfg
paste from above
change the values to what you would like
here's mines for example:
# this is the name it shows up on game list
servername="EXAMPLE"
# Minimum password length is 5.
serverpassword="ilikegames"
# if you change this you will need to update firewall rules
port="2456"
#this is the name of the world file
gameworld="20200218"
public="1"
save the file and winscp should automatically upload to the server for you.
==valheim server details==
take note of these file locations
=home directory
/home/yourusername
this is where everything is
=valheim world files
.config/unity3d/IronGate/Valheim
here's your world files in case you want to back them up
also your admin, ban, whitelist
=valheim server files
serverfiles folder.. lol
this is where the actual valheim install is
==running server
in your putty console window type
to see what you can do
./vhserver help
./vhserver start
./vhserver stop
./vhserver details
are the most useful
if you get in some weird state where you don't know whats going on
sudo reboot
will reboot your server and you can call ./vhserver start again
==using existing world files
=find your world files .db .fwl
in windows it's C:\Users\YOURUSERNAME\AppData\LocalLow\IronGate\Valheim\worlds
or get them from your existing server
for example:
myserver.db myserver.fwl
=open winscp, connect to server, and go to worlds folder
/home/SERVERUSERNAME/.config/unity3d/IronGate/Valheim/worlds
drag your myserver.db myserver.fwl world files into the server folder to upload them
=change your config to use new world files
make sure your server is stopped
./vhserver stop
open your config file lgsm/config-lgsm/vhserver/common.cfg
change
gameworld="myserver"
(or whatever your world filename is)
now start the server and it should be using your existing world
./vhserver start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment