Team Fortress 2 Classic is a free mod of the 2007 game Team Fortress 2, developed by Eminoma and utilizing the Source engine.
Team Fortress 2 Classic is a re-imagining of the 2008-2009 era of the original Team Fortress 2, of which is what we consider the "Classic Era", featuring old features that were scrapped and worked upon, or new content such as new weapons and gamemodes.
TF2C servers require 1 port to be open, the SourceTV port can also be opened for spectators.
Port | default |
---|---|
Game/rcon | 27015 |
SourceTV | 27020 |
Name | Tag |
---|---|
ghcr.io/ptero-eggs/steamcmd:debian | ghcr.io/ptero-eggs/steamcmd:debian |
Name | Description | Environment Variable | Default Value | User Viewable | User Editable |
---|---|---|---|---|---|
Game ID | The ID corresponding to the game to download and run using SRCDS. | SRCDS_APPID | 244310 | Yes | No |
Game Name | The name corresponding to the game to download and run using SRCDS. | SRCDS_GAME | tf2classic | Yes | No |
Default Map | The default map to use when starting the server. | SRCDS_MAP | ctf_2fort | Yes | Yes |
Game Version | Version of TF2C to download. | GAMEVERSION | latest | Yes | Yes |
Max Players | The maximum amount of players allowed on the server. | MAXPLAYERS | 24 | Yes | Yes |
#!/bin/bash
# steamcmd Base Installation Script
#
# Server Files: /mnt/server
apt update
apt install -y zstd
## just in case someone removed the defaults.
if [[ "${STEAM_USER}" == "" ]] || [[ "${STEAM_PASS}" == "" ]]; then
echo -e "steam user is not set.\n"
echo -e "Using anonymous user.\n"
STEAM_USER=anonymous
STEAM_PASS=""
STEAM_AUTH=""
else
echo -e "user set to ${STEAM_USER}"
fi
## download and install steamcmd
cd /tmp
mkdir -p /mnt/server/steamcmd
curl -sSL -o steamcmd.tar.gz https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xzvf steamcmd.tar.gz -C /mnt/server/steamcmd
mkdir -p /mnt/server/steamapps # Fix steamcmd disk write error when this folder is missing
cd /mnt/server/steamcmd
# SteamCMD fails otherwise for some reason, even running as root.
# This is changed at the end of the install process anyways.
chown -R root:root /mnt
export HOME=/mnt/server
## install game using steamcmd
./steamcmd.sh +force_install_dir /mnt/server +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update ${SRCDS_APPID} $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) ${INSTALL_FLAGS} validate +quit ## other flags may be needed depending on install. looking at you cs 1.6
## set up 32 bit libraries
mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
## set up 64 bit libraries
mkdir -p /mnt/server/.steam/sdk64
cp -v linux64/steamclient.so ../.steam/sdk64/steamclient.so
## download TF2C from website
cd /mnt/server
which unzip
L_V=$(curl -s https://wiki.tf2classic.com/kachemak/versions.json | jq -r '.versions | to_entries | max_by(.key | tonumber) | .value.file') # tf2classic-2.1.3.tar.zst
if [ -z "${GAMEVERSION}" ] || [ "${GAMEVERSION}" == "latest" ]; then
DOWNLOAD_URL="https://wiki.tf2classic.com/kachemak/$L_V"
else
DOWNLOAD_URL="https://wiki.tf2classic.com/kachemak/tf2classic-${GAMEVERSION}.tar.zst"
fi
# Check if the URL returns a 404 status code
if curl -s --head "$DOWNLOAD_URL" | head -n 1 | grep "404 Not Found" > /dev/null; then
echo "URL returned 404. Setting to alternative URL."
DOWNLOAD_URL="https://wiki.tf2classic.com/kachemak/$L_V"
fi
echo "Downloading tf2classic, This will take some time"
echo "Download URL is: ${DOWNLOAD_URL}"
curl -sSL -o tf2classic.tar.zst ${DOWNLOAD_URL}
#tar -xf tf2classic.tar.zst
tar --use-compress-program=unzstd -xvf tf2classic.tar.zst
rm -rf tf2classic.tar.zst
## fix issue /w symlink
cd /mnt/server/bin
ln -s vphysics_srv.so vphysics.so
ln -s studiorender_srv.so studiorender.so
ln -s soundemittersystem_srv.so soundemittersystem.so
ln -s shaderapiempty_srv.so shaderapiempty.so
ln -s scenefilecache_srv.so scenefilecache.so
ln -s replay_srv.so replay.so
ln -s materialsystem_srv.so materialsystem.so
cd /mnt/server/tf2classic/bin
## fix server as of 2.0.4 crashing on start
rm -rf server_srv.so
ln -s server.so server_srv.so
## install end
echo "-----------------------------------------"
echo "Installation completed..."
echo "-----------------------------------------"