Why a dedicated server?[]
Running a dedicated server can be a great way to play games like Core Keeper with friends. When playing with multiple people, one person typically hosts the game session on their PC. However, this can be problematic if that person is unable to keep their computer running 24/7 or if they experience technical difficulties that prevent others from connecting at any given time. By running a dedicated server, you can ensure that your game is always available for others to join, regardless of whether the host is online or experiencing issues.
Setup on an Arch-based distro[]
If you are planning to set up a server on an Arch-based distribution, there are a few things you should know. Arch Linux is a popular rolling release distribution that provides a lightweight and customizable base system. However, it may not be the most obvious choice for a server, as rolling release distributions are generally considered less stable than standard release distributions like Debian. That being said, if you're comfortable with Linux and would like to install Arch, you can find a guide here. Do note that Arch is notoriously difficult to install, so it's recommended that you have some experience with Linux beforehand.
This guide will continue with the assumption you have successfully connected to your server through ssh.
Housekeeping[]
Assuming that you have successfully installed Arch and connected to your server, the first step in setting up your server would be to update your system. You can do this by running the following command in the terminal:
# pacman -Syu
This command will update all of the installed packages on your system to their latest versions. It's important to keep your system up-to-date to ensure that you have the latest security patches and bug fixes.
Packages[]
You will need to install the following: git
(to download SteamCMD), xvfb
(to run the server)
You can use:
# pacman -S git xorg-server-xvfb
SteamCMD[]
Without AUR helper[]
Assuming you don't have an AUR helper like yay
or paru
installed, we will install SteamCMD from the AUR manually.
First, clone SteamCMD with git and cd
into it.
$ git clone https://aur.archlinux.org/steamcmd.git && cd steamcmd
Make the package with makepkg
.
$ makepkg -si
System user[]
It's generally considered good practice to create new user accounts for services running on your server, especially for a dedicated game server like Core Keeper. This is because running services under the same user account as the rest of the system can pose a security risk. In the event that the service is compromised, running under a privileged user account could allow an attacker to gain full access to the system. By creating a separate user account for the service, you can limit the potential damage that can be done in case of a security breach.
To create a new user account named corekeeper-server
specifically for the Core Keeper game server, you can use the adduser
command in the terminal. First, log in to the server as the root user and then run the following command:
# useradd -mrU -s /usr/sbin/nologin corekeeper-server
This creates a new system user that cannot login.
Installing the server[]
SteamCMD[]
Now we can install the server using steamcmd. Here is a command using sudo
that will execute the command as the corekeeper-server
user.
$ sudo -u corekeeper-server -s /bin/bash -c "steamcmd +force_install_dir /home/corekeeper-server +login anonymous +app_update 1007 validate +app_update 1963720 validate +quit"
If you are having trouble, you might interactively use SteamCMD following commands:
$ sudo -u corekeeper-server -s /bin/bash -c steamcmd
Steam>force_install_dir /home/corekeeper-server
Steam>login anonymous
...
...
Waiting for user info...OK
Steam>app_update 1007 validate
...
...
Success! App '1007' fully installed.
Steam>app_update 1963720 validate
...
...
Success! App '1963720' fully installed.
Steam>quit
Modifying launch scripts[]
The included launch.sh
and _launch.sh
have problems. They are unhelpful for servers, and not meant for Arch, respectively. We need to make some modifications.
Open up _launch.sh
in your favorite text editor. For example, to open in vim
, use:
$ sudo -u corekeeper-server -s /bin/bash -c "vim /home/corekeeper-server/_launch.sh"
Delete the part that checks and installs requirements:
for r in "${requirements[@]}"
do
echo "Checking for required package: $r"
if ! (dpkg -l $r >/dev/null); then
echo "Installing missing package: $r"
sleep 1
$sudo apt-get update -yy && $sudo apt-get install -yy "$r"
fi
done
You should be able to launch the server now using _launch.sh
Systemd service[]
At this point, you can can run your server, but usually people want to have the server restart automatically on failure and on startup. We can make a Systemd service to do both.
Edit a new file /etc/systemd/system/corekeeper-server.service
.
Again, using vim
, the command would be:
# vim /etc/systemd/system/corekeeper-server.service
Put the following in the file:
[Unit]
Description=CoreKeeper Dedicated Server
After=network.target
[Service]
Type=simple
User=corekeeper-server
WorkingDirectory=/home/corekeeper-server
ExecStart=/home/corekeeper-server/_launch.sh
KillMode=process
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Execute the following:
# systemctl daemon-reload
Execute the following to start the service:
# systemctl start corekeeper-server.service
Execute the following to make the service autostart on boot:
# systemctl enable corekeeper-server.service
Connecting[]
If you are using a Systemd service, you will be able to check the output for the server with
# journalctl -u corekeeper-server.service -f
Though, if the server is running correctly, you will be able to find the game ID to connect to in the server directory in GameID.txt
Setup on a Debian based distro (Debian/Ubuntu/Mint/etc.)[]
This section has been copied from the 'Arch-based' install guide, with some relevant parts modified.
Housekeeping[]
Assuming that you have successfully installed Debian or one of its derivative distributions and connected to your server, the first step in setting up your server would be to update your system. You can do this by running the following command in the terminal:
# apt-get update && apt-get upgrade
This command will update all of the installed packages on your system to their latest versions. It's important to keep your system up-to-date to ensure that you have the latest security patches and bug fixes.
Packages[]
The launch script for the server will install any missing dependencies. The only thing you will need to install is SteamCMD. The official doucmentation can be found here:
https://developer.valvesoftware.com/wiki/SteamCMD#Linux
System user[]
It's generally considered good practice to create new user accounts for services running on your server, especially for a dedicated game server like Core Keeper. This is because running services under the same user account as the rest of the system can pose a security risk. In the event that the service is compromised, running under a privileged user account could allow an attacker to gain full access to the system. By creating a separate user account for the service, you can limit the potential damage that can be done in case of a security breach.
To create a new user account named corekeeper-server
specifically for the Core Keeper game server, you can use the adduser
command in the terminal. First, log in to the server as the root user and then run the following command:
# useradd -mrU -s /usr/sbin/nologin corekeeper-server
This creates a new system user that cannot login.
Installing the server[]
SteamCMD[]
Now we can install the server using steamcmd. Here is a command using sudo
that will execute the command as the corekeeper-server
user.
$ sudo -u corekeeper-server -s /bin/bash -c "steamcmd +force_install_dir /home/corekeeper-server +login anonymous +app_update 1007 validate +app_update 1963720 validate +quit"
If you are having trouble, you might interactively use SteamCMD following commands:
$ sudo -u corekeeper-server -s /bin/bash -c steamcmd
Steam>force_install_dir /home/corekeeper-server
Steam>login anonymous
...
...
Waiting for user info...OK
Steam>app_update 1007 validate
...
...
Success! App '1007' fully installed.
Steam>app_update 1963720 validate
...
...
Success! App '1963720' fully installed.
Steam>quit
You should be able to launch the server now using _launch.sh
Systemd service[]
At this point, you can can run your server, but usually people want to have the server restart automatically on failure and on startup. We can make a Systemd service to do both.
Edit a new file /etc/systemd/system/corekeeper-server.service
.
Again, using vim
, the command would be:
# vim /etc/systemd/system/corekeeper-server.service
Put the following in the file:
[Unit]
Description=CoreKeeper Dedicated Server
After=network.target
[Service]
Type=simple
User=corekeeper-server
WorkingDirectory=/home/corekeeper-server
ExecStart=/home/corekeeper-server/_launch.sh
KillMode=process
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Execute the following:
# systemctl daemon-reload
Execute the following to start the service:
# systemctl start corekeeper-server.service
Execute the following to make the service autostart on boot:
# systemctl enable corekeeper-server.service
Connecting[]
If you are using a Systemd service, you will be able to check the output for the server with
# journalctl -u corekeeper-server.service -f
Though, if the server is running correctly, you will be able to find the game ID to connect to in the server directory in GameID.txt
Mechanics | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|