Hosting your own Killing Floor 2 Server - Part 3 - Configuring the server and enabling the web interface

In part 3 we'll configure the Killing Floor 2 server to do the following:

  1. Start the game server automatically at boot in a tmux session
  2. Enable the web management interface
  3. Ensure that the WebUI runs on port 8080
  4. Set a password for the WebUI
  5. Set the game difficulty for the server
  6. Disable server takeover

Video guide

This section assumes you did a server reboot as the last step in part 2.

Instructions

  1. SSH into your server
ssh root@kf2.teachnixlab.com
  1. Switch to the steam user
su - steam
  1. Create a new tmux session
tmux

Create a startup script for the Killing Floor 2 server

vi /home/steam/startkf2

The contents of the script should be the following

#!/bin/sh
tmux new -s kf2-server -d
tmux send-keys -t "kf2-server" '/home/steam/.steam/steamcmd/kf2/Binaries/Win64/KFGameSteamServer.bin.x86_64 kf-bioticslab' Enter

Make the script executable

chmod +x /home/steam/startkf2

Create a cron job for this script to run upon reboot. Make sure you are doing this as the steam user.

crontab -e

Add a new line

@reboot /home/steam/startkf2
  1. Start the Killing Floor 2 server. The server needs to be ran once to generate the files that we are going to edit.
/home/steam/.steam/steamcmd/kf2/Binaries/Win64/KFGameSteamServer.bin.x86_64 kf-bioticslab

Kill the server with Ctrl+C once you see the DevOnline information begin to appear.

  1. Edit the KFWeb.ini file
vi /home/steam/.steam/steamcmd/kf2/KFGame/Config/KFWeb.ini

Change the following values to match the settings below

bEnabled=true
ListenPort=8080

We are setting the WebUI port to 8080 because we will be installing Nginx to serve Let's Encrypt certs via reverse proxy.

  1. Set an admin password for the WebUI
vi /home/steam/.steam/steamcmd/kf2/KFGame/Config/LinuxServer-KFGame.ini

Change the following value and set your desired password

AdminPassword=YourDesiredPassword

Change the following value to set the game difficulty
0 = Normal, 1 = Hard, 2 = Suicidal, 3 = Hell on Earth

GameDifficulty=3

Our server will run on Hell on Earth.

  1. Disable server takeover

Server Takeover is a feature that allows players who are matchmaking and choosing to start their own private game to "grab" a server that has not opted out for them to use during their play time. This will change the settings on the server to those that the players want and make it private. However it will not expose any of the private information about that server (such as admin passwords) to them. At the end of their stay in the server, the server will open back up again and await new players or another takeover request.

vi /home/steam/.steam/steamcmd/kf2/KFGame/Config/LinuxServer-KFEngine.ini

Set the following

bUsedForTakeover=FALSE

  1. Start the server back up so that we can test the web interface
/home/steam/.steam/steamcmd/kf2/Binaries/Win64/KFGameSteamServer.bin.x86_64 kf-bioticslab

Proceed to the web interface once the server has come online. Remember to do this on port 8080.

http://kf2.teachnixlab.com:8080

Username: admin
Password: ThePasswordYouSetEarlier

Once you have verified that your web interface is working, proceed to Part 4 - Configuring Let's Encrypt SSL certs