Core Keeper

Core Keeper

View Stats:
Sparrowhawk May 20, 2022 @ 12:56pm
Setting up a Dedicated Server in Linux
Thank you to the Core Keeper team for making the Dedicated Server available! So excited to see where this game goes, and looking forward to the June update!

I'm assuming there will be a more official tutorial at some point. I found bits and pieces on this community forum as well as discord to get a server up and running, but there were a few issues (as expected with linux. lol)

I recommend that you have some experience with linux before trying to set up a vps server, but if you understand some of the basics, it isn't too bad. There are also some docker tutorials if you are familiar with that.

I went with a VPS that lists a Ryzen 9 5959x, an SSD, and 4GB ram. I will assume that the single dedicated core and 4gb of ram won't be enough with many players, but it can be upgraded. I'll post again after some testing, but assume this would allow 5-10 players.

I did try CentOS and Debian, but found Ubuntu 20.04 worked without some of the issues on the other distros.

Here are some of the tutorials I used. I don't take credit for all of these commands and will link to pages I referenced. I'm sure there is more that could be done, and every detail I used step by step isn't included, so feel free to reply if you have questions or come across other issues.

Setting up SSH keys is always a good idea and creating a sudo user. IP Tables are also a good idea. Secure your server whatever methods you find best.

There's a guide from Steam https://developer.valvesoftware.com/wiki/SteamCMD but I found this guide to be quite useful: https://www.linode.com/docs/guides/install-steamcmd-for-a-steam-game-server/ (I don't use their service and am not affiliated with them, but what a great tutorial!)

If "sudo add-apt-repository multiverse" fails, you can install add-apt-repository using:
sudo apt update
sudo apt install software-properties-common

I looked up the steam ID, but after installing found they provided this info. in the README.txt as well:

"...You can use SteamCMD to download the server files without requiring a login:
steamcmd +login anonymous +app_update 1007 +app_update 1963720 +quit
..."


After my setup, there was a hidden .steam directory created in the home folder. This is where you will find ~/.steam/steamcmd/corekeeper (maybe only if you force named the install directory?). This is where the _launch.sh script, log file, readme, etc. are.

The README.txt was very useful and includes information for the ServerConfig.json:

"...-world 0 Which world index to use.
-worldname "Core Keeper Server" The name to use for the server.
-worldseed 0 The seed to use for a new world. Set to 0 to generate random seed.
-gameid "" Game ID to use for the server. Need to be at least 23 characters and alphanumeric, excluding Y,y,x,0,O. Empty or not valid means a new ID will be generated at start.
-datapath "" Save file location. If not set it defaults to a subfolder named "DedicatedServer" at the default Core Keeper save location.
-maxplayers 100 Maximum number of players that will be allowed to connect to server.
..."

The ServerConfig.json file was in ~/.config/unity3d/Pugstorm/Core Keeper/DedicatedServer

_launch.sh is the script provided by Core Keeper and once you run it, the "CoreKeeperServerLog.txt" file will show any issues.

One error I had was "steamclient.so: wrong ELF class: ELFCLASS32" in the CoreKeeperServerLog.txt file

Someone thankfully also had this issue with a different steam game and resolved it by creating a directory and copying the steamclient.so file over. There is probably a better solution and could be related to how I installed the 32bit files as in the tutorial:

"...Howdy, just ran into this issue tonight.
I took a wild guess that it was looking for this file: /.steam/steamcmd/linux64/steamclient.so
Made the /.steam/sdk64 directory and copied that file to it.
It worked. 👍🏻..." -https://github.com/SmartlyDressedGames/Unturned-3.x-Community/issues/2305

Once the server is running properly, I installed screen and used it to keep the server running. I may set up an easy script and control panel for other players to help restart the server if needed, but so far, the server seems stable.

There are backup files and some info. about this on Discord. Not sure how often they are created, and there was some indication that backups don't always happen. I'm sure that the Dedicated Server will receive updates and more features later on.

Enjoy!

Update:

Because Core Keeper seems to crash somewhat regularly (every day or two it seems), I set the dedicated server up as a service rather than using screen. This method may not be ideal, as you can also create service files in the user directory, and if the server has issues starting it could keep trying to restart, but so far it has been working great for us. If the server crashes, it starts right back up.

In /etc/systemd/system create a file for your service. In my case, I created "corekeeper.service" as the file name and the contents are below. I used "steam" as the user and group in this example, but replace those with whatever user/group you run the server as...and don't use root. Make sure that user has sudoers permissions.

You also need to specify the directories for your install, so check the path to where your _launch.sh file is. I also added an output file just to see what it outputs. It will list when the server starts up the server name, and could be useful if your server is crashing on startup.

[Unit]
Description=Core Keeper Service
After=network.target

[Service]
Type=simple
# Another Type: forking
User=steam
# Omit user/group if creating user service file
Group=steam
WorkingDirectory=/home/steam/corekeeper
StandardOutput=file:/home/steam/corekeeper/servicelog.txt
ExecStart=/bin/bash /home/steam/corekeeper/_launch.sh
Restart=always
# Other restart options: always, on-abort, etc

# The install section is needed to use
# `systemctl enable` to start on boot
# For a user service that you want to enable
# and start automatically, use `default.target`
# For system level services, use `multi-user.target`
[Install]
WantedBy=default.target

Then, run: systemctl daemon-reload

This reloads the configurations of the service files.

To have the service run at startup (if the linux server reboots): systemctl enable corekeeper.service

Next, start the service: systemctl start corekeeper.service


I used Restart=Always because it didn't seem to restart otherwise. You could let it crash a few times and get exit codes perhaps to specify them, but this will just restart for pretty much any reason...which is why it also could just keep trying to restart and cause issues if the core keeper server isn't starting correctly. That's where some of the options below can help.

You can also look at adding these options to the Unit section, but read up on what they do:

RestartSec=1
StartLimitBurst=5
StartLimitIntervalSec=10

More documentation: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
Last edited by Sparrowhawk; Jun 30, 2022 @ 12:14pm
< >
Showing 1-10 of 10 comments
Man of God May 21, 2022 @ 8:22am 
Renting a single core VPS and reinventing the wheel...

vs

Running an entirely headless system in Docker which is already secure by default.

Each to their own I guess.
Sparrowhawk May 21, 2022 @ 5:32pm 
Originally posted by 󠀡󠀡:
Renting a single core VPS and reinventing the wheel...

vs

Running an entirely headless system in Docker which is already secure by default.

Each to their own I guess.

A VPS is headless...and you still have to secure whatever docker is running on as well as trust that the container was created with everything up to date with no malicious software.


VPS -> Core Keeper Server

vs.

Server -> Docker -> Container -> Core Keeper Server



I suppose you could consider screen an extra step but it's really simple to use.

I'm already familiar with running steam servers this way (years ago I managed many servers for our gaming clan and hosting service we provided), so it makes sense to cut out the extra Docker software. I also wanted to configure the server anyway, so I knew I'd be digging into the config file to customize it.

Setting up steamcmd was quite easy. The Core Keeper devs even included a one liner to install it: steamcmd +login anonymous +app_update 1007 +app_update 1963720 +quit


I chose a VPS so I don't have to host it on an old machine at home and configure a vlan. It also ensures a more central location for friends in a datacenter with a great connection. I'd go with a dedicated or colocation if it wasn't more expensive, but for $13/month a VPS works just fine. I can always request more CPU cores and RAM too.

Docker seems like a great way to make it easy to share software, so if you're more comfortable with that, then go for it. :steamthumbsup:

The goal is to play Core Keeper with friends and have fun after all. :steamhappy:
Sparrowhawk Jun 29, 2022 @ 10:41am 
Updated the main post with some info. on setting up the core keeper server as a service to allow it to auto restart when it crashes. :)
CrashOverride Aug 13, 2022 @ 2:14pm 
Threw together a stackscript on Linode for this.
Might help for the exact commands or can just use it to build a new server. Don't hate me if it messes up lol.
https://cloud.linode.com/stackscripts/1041800
Used Grubheads commands links and services file lol. Thats why I thought to post it here.
Wanted to learn about docker so I made a docker image too if someone wanted to use that.
https://hub.docker.com/repository/docker/crashoverridee/corekeeper
Last edited by CrashOverride; Aug 28, 2022 @ 4:14pm
Sparrowhawk Aug 13, 2022 @ 11:23pm 
Hope it helped! I used Bloom.host for the VPS.
EaZee Oct 5, 2022 @ 1:37pm 
The service doesn't seem to run (scoped to correct user and folders). I get an error on start of "Started server process with pid 15947" followed by "_launch.sh: line 10: kill: (14703) - No such process"

Did you make update sto the launch script?
Sparrowhawk Oct 7, 2022 @ 2:54pm 
Originally posted by EaZee:
The service doesn't seem to run (scoped to correct user and folders). I get an error on start of "Started server process with pid 15947" followed by "_launch.sh: line 10: kill: (14703) - No such process"

Did you make update sto the launch script?

It's trying to kill a process that doesn't exist. Did you happen to manually specify a pid in the _launch.sh script directly? It isn't meant to be updated by the user so make sure you didn't manually set the pid in there. You can probably rename it and force a server update with the steamcmd to make sure you have a fresh copy of the script.

See if you can get it working without running it as a service first. I don't work on the game and don't make changes to the _launch.sh script. I don't believe they changed it, but it may have been updated in the latest updates.

That line 10 is looking for a variable which should contain the pid of the core keeper server. Later in the script, it uses "ckpid=$!" which should grab the last background process created, I believe.

Perhaps you have extra Core Keeper services running? You could use the "top" or "ps -A" to view the process ID's and names to see if there's a duplicate running. Then, kill the extra ones and try starting the server again.

I did find that when I go to stop the server to run an update, stopping the service doesn't seem to stop the server, so I manually kill the server as well after stopping the service. This might be because I have it set to automatically restart the server, or it's not handling the process automatically. There is a forking option for services, but I didn't go that route.

Let me know if you get it working or not. :)
Tauro Dec 4, 2022 @ 8:54am 
A symlink works as well, so you don't have to worry about duplicate files not being updated.

mkdir ~/.steam/sdk64
ln -s ~/.steam/steamcmd/linux64/steamclient.so ~/.steam/sdk64/steamclient.so
Amaris Skye Feb 16, 2023 @ 6:26am 
Originally posted by CrashOverride:
Threw together a stackscript on Linode for this.
Might help for the exact commands or can just use it to build a new server. Don't hate me if it messes up lol.
https://cloud.linode.com/stackscripts/1041800
Used Grubheads commands links and services file lol. Thats why I thought to post it here.
Wanted to learn about docker so I made a docker image too if someone wanted to use that.
https://hub.docker.com/repository/docker/crashoverridee/corekeeper

I tried to use this Stackscript today but when I enter the Game ID I created into Core Keeper, I get an error "could not find game". Am I missing a step between running the StackScript & then connecting to the game created on the server?
CrashOverride May 20, 2023 @ 7:50am 
Originally posted by Amaris Skye:
Originally posted by CrashOverride:
Threw together a stackscript on Linode for this.
Might help for the exact commands or can just use it to build a new server. Don't hate me if it messes up lol.
https://cloud.linode.com/stackscripts/1041800
Used Grubheads commands links and services file lol. Thats why I thought to post it here.
Wanted to learn about docker so I made a docker image too if someone wanted to use that.
https://hub.docker.com/repository/docker/crashoverridee/corekeeper

I tried to use this Stackscript today but when I enter the Game ID I created into Core Keeper, I get an error "could not find game". Am I missing a step between running the StackScript & then connecting to the game created on the server?

May make sure your ports are forwarded 27015-27016 in firewalls under inbound rules you will want to accept those for the steam ports.

Also they may have increased the size of the gameID I noticed I had to increase mine a bit for it to work.

I see you posted this on Feb. Me and my friends were trying to use the server for the Valentines event but for some reason I couldn't connect to it until the next update. Not sure what happened? I really didn't see any fixes about it, but I think it was something on corekeepers or steams end? So we wound up using an world on one of our pcs lol.

Hope that helps. I've been using my docker image since then since it is easier to move between servers and backup, but it has quite the learning curve.

I put together a github respoitory with my docker-compose.yml that should make it super simple.
https://github.com/maxss280/corekeeper_docker
< >
Showing 1-10 of 10 comments
Per page: 1530 50

Date Posted: May 20, 2022 @ 12:56pm
Posts: 10