{{tag>howto supertuxkart game server debian}}
\\
This howto, for Fedora Linux, can be found [[pages:howtos:fedora:fedora-supertuxkartserver|here]].
====== How To Build and Run your own SuperTuxKart Server On Debian 11 ======
How to build and run your own [[https://supertuxkart.net/|SuperTuxKart]] server on [[https://www.debian.org/|Debian GNU Linux]] 11. [[https://supertuxkart.net/|SuperTuxKart]] is a 3D open-source arcade racer with a variety characters, tracks, and modes to play.
===== Sources =====
* https://github.com/supertuxkart/stk-code/blob/master/INSTALL.md
* https://github.com/supertuxkart/stk-code/blob/master/NETWORKING.md
* https://manpages.debian.org/testing/supertuxkart/supertuxkart.6.en.html
===== Hardware Sizing =====
I've been running a SuperTuxKart server for 8 players including AI-bots on the smallest available VPS package (CX11) at [[https://www.hetzner.com/cloud|Hetzner]] with just a single 2.2 GHz core, 2 GB RAM and 20 GB HDD.
===== Installation =====
Create a user account to run SuperTuxKart with
useradd -m -s /bin/bash supertuxkartuser
passwd supertuxkartuser
Install the required packages for building the SuperTuxKart server
apt update
apt -y install build-essential cmake libbluetooth-dev libsdl2-dev libcurl4-openssl-dev libenet-dev libfreetype6-dev libharfbuzz-dev libjpeg-dev libogg-dev libopenal-dev libpng-dev libssl-dev libvorbis-dev libmbedtls-dev pkg-config zlib1g-dev
Add a little convenience and structure
apt -y install git subversion tmux vim-nox
mkdir -pv /home/supertuxkartuser/repos/
Both stk-code and stk-assets must be in the same directory, otherwise the build will fail!
Clone the SuperTuxKart and SuperTuxKart-Assets repositories.
cd /home/supertuxkartuser/repos/
git clone https://github.com/supertuxkart/stk-code.git stk-code
svn co https://svn.code.sf.net/p/supertuxkart/code/stk-assets stk-assets
Compile the server and install it system wide
cd /home/supertuxkartuser/repos/stk-code
mkdir -pv /home/supertuxkartuser/repos/stk-code/cmake_build
cd /home/supertuxkartuser/repos/stk-code/cmake_build
cmake -DBUILD_RECORDER=off -DSERVER_ONLY=ON ..
make -j$(nproc)
make install
===== online.supertuxkart.net User Account =====
A user account at online.supertuxkart.net is required to run the server. You can sign up/create it [[https://online.supertuxkart.net/register.php|here]]. You will receive an e-mail with a link to confirm your e-mail address (yes, you should click that link before proceeding).
===== User Initialization And SuperTuxKart Server Configuration =====
Either log in to your Debian box with the user for running the server or //su// to it.
su - supertuxkartuser
Use the following command to initialize your installation with your local run-user (named 'supertuxkartuser').
supertuxkart --init-user --login= --password=
Now create the configuration file with the following command
vim /home/supertuxkartuser/supertuxkart_config.xml
===== Running The Server And Connecting Bots To It =====
Log in to your Debian box as the run-user ('supertuxkartuser') and start the SuperTuxKart server in [[https://wiki.nanoscopic.de/doku.php/pages/cheatsheets/tmux|tmux]]
tmux
supertuxkart --server-config=supertuxkart_config.xml --network-console
Create a new tmux shell by pressing C+b followed by c. To add some AI-bots, use the following command
supertuxkart --connect-now=127.0.0.1:2759 --network-ai=7 --server-password=
You can use C+b - n to switch between the two shells and C+b - d to disconnect from tmux (the shells will keep running). To reattach to tmux, use the command
tmux attach
You can terminate the SuperTuxServer processes by pressing C+c.
----
~~DISCUSSION~~