Deploy a dedicated Team Fortress 2 server for free-to-play team-based combat with custom maps, game modes, and SourceMod plugin support.
Grab the automated bash script from GitHub to follow along with the video.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/gaming/tf2/tf2-ubuntu.sh
chmod +x tf2-ubuntu.sh
sudo bash tf2-ubuntu.sh
The script installs Docker if needed, downloads TF2 via SteamCMD, and starts the server container. The game files are approximately 15 GB — allow time for the initial download to complete.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/gaming/tf2/tf2-ubuntu.sh
chmod +x tf2-ubuntu.sh
sudo bash tf2-ubuntu.sh
Edit the server configuration to set hostname, password, player limit, RCON credentials, and game mode.
# Edit server.cfg
nano /opt/tf2/tf/cfg/server.cfg
# Key settings to configure:
hostname "My TF2 Server"
sv_password ""
maxplayers 24
rcon_password "your_rcon_password_here"
tf_gamemode_payload 1
Open TF2 and find your server through the community browser or connect directly using the console.
# Option 1: In-game console (press ~)
connect <your-server-ip>:27015
# Option 2: Community browser
# TF2 → Find a Game → Community Servers → search name
Use RCON or SourceMod admin commands to manage maps, players, and server behavior.
# RCON from TF2 console
rcon_address <your-server-ip>:27015
rcon_password your_rcon_password_here
# Common RCON commands
rcon status # list players
rcon changelevel pl_badwater # change map
rcon kick <player_name> # kick a player
rcon sm_ban #<userid> 60 "reason" # ban via SourceMod
rcon mp_restartgame 1 # restart game
| Port | Purpose |
|---|---|
| 27015 UDP | Game traffic & server query |
| 27020 UDP | SourceTV broadcast |
Team Fortress 2 is Valve's classic team-based multiplayer FPS with distinct character classes. A TF2 dedicated server lets you host private matches, community servers with custom configs, or Sourcemod-powered fun servers with plugins.
Self-hosting a TF2 server lets you run private scrimmage matches for competitive teams, set up custom fun servers (dodgeball, achievement maps, surf), and use Sourcemod plugins without restrictions imposed by community server hosts.
TF2 uses UDP port 27015 for game connections. Open UDP 27015 in your firewall. The Steam server browser query also uses this port. RCON uses TCP 27015 — keep this accessible only from trusted IPs.
Alternatives include using the built-in valve matchmaking, playing on existing community servers, and using community hosting services. Self-hosting is best for competitive practice, custom game modes, and plugin development.
Avoid self-hosting TF2 if you just want to play casually — existing community servers are plentiful. Self-hosting is best when you need specific control over rules, plugins, and player access for competitive or custom play.
PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.
First install Metamod:Source (TF2 requires it for Sourcemod). Download Metamod from sourcemm.net and extract to the tf directory. Then download Sourcemod from sourcemod.net and extract it to the tf directory as well. Restart the server and verify both are loaded with the meta version and sm version console commands.
Yes. Download and configure a competitive config such as the ETF2L or RGL match configs. These configs set the correct max players, weapon bans, and tournament settings. Install Sourcemod plugins like STV Demo recording and a pause plugin for proper competitive match management.
Place custom .bsp map files in the tf/maps directory. Add the maps to your mapcycle.txt or maplist.txt. For clients to automatically download custom maps, enable sv_allowdownload 1 and sv_allowupload 1, or set up a FastDL web server for faster custom content distribution.
FastDL is a web server that serves custom maps, sounds, and textures to clients faster than the in-game download system. Without FastDL, custom content downloads slowly via the game connection. If you run a server with many custom maps, set up a FastDL web server and configure sv_downloadurl to point to it.
Yes. Install the TF2 Dodgeball Sourcemod plugin, set your server to Arena mode on dodgeball maps, and configure the plugin settings. Dodgeball is one of the most popular custom TF2 game modes — Pyros deflect rockets back and forth. Many dedicated dodgeball maps and configs are available from the community.