Docs / Game Servers / How to Set Up a Team Fortress 2 Server

How to Set Up a Team Fortress 2 Server

By Admin · Mar 1, 2026 · Updated Apr 23, 2026 · 27 views · 2 min read

Overview

Team Fortress 2 (TF2) is a free-to-play team shooter. Hosting a dedicated server lets you run custom maps, game modes, and community plugins.

Requirements

  • A Breeze with at least 2 GB RAM
  • 15 GB disk space

Step 1: Install

sudo useradd -r -m -d /opt/tf2 tf2server
sudo -u tf2server steamcmd +force_install_dir /opt/tf2/server \
  +login anonymous \
  +app_update 232250 validate \
  +quit

Step 2: Create a Start Script

sudo -u tf2server tee /opt/tf2/start.sh <<'EOF'
#!/bin/bash
cd /opt/tf2/server
./srcds_run -game tf \
  +map cp_dustbowl \
  +maxplayers 24 \
  +sv_setsteamaccount YOUR_GSLT \
  -port 27015
EOF
chmod +x /opt/tf2/start.sh

Step 3: Server Configuration

sudo -u tf2server tee /opt/tf2/server/tf/cfg/server.cfg <<EOF
hostname "My TF2 Server"
sv_password ""
rcon_password "adminpass"
mp_timelimit 30
mp_maxrounds 5
sv_pure 1
EOF

Step 4: Create a Systemd Service

sudo tee /etc/systemd/system/tf2.service <<EOF
[Unit]
Description=Team Fortress 2 Server
After=network.target

[Service]
User=tf2server
WorkingDirectory=/opt/tf2
ExecStart=/opt/tf2/start.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now tf2

Firewall

sudo ufw allow 27015/tcp
sudo ufw allow 27015/udp

Adding SourceMod and MetaMod

For plugin support, install MetaMod:Source and SourceMod into the tf/ directory. This enables admin controls, custom commands, and thousands of community plugins.

Was this article helpful?