Team Fortress 2 on Debian and Ubuntu
Updated by Linode
Team Fortress 2 is a team-based, first-person shooter, where you and a team of fellow players can play a variety of game modes. From capture the flag, to a battle pitting your team against a robotic horde, there are numerous options to choose. Setting up a personal game server puts you in control of what game modes and maps you use, as well as a variety of other settings to customize your experience.
Before You Begin
Complete our guide: Install SteamCMD for a Steam Game Server. This will get SteamCMD installed and running on your Linode and this guide will pick up where the SteamCMD page leaves off.
This guide is written for a non-root user. Commands that require elevated privileges are prefixed with
sudo. If you’re not familiar with the
sudocommand, you can check our Users and Groups guide.
Prerequisites for Team Fortress 2
From the SteamCMD guide, two additional steps are needed specifically for TF2.
Add an iptables firewall rule. This command assumes that you have only the iptables rules in place from the SteamCMD guide. This inserts a rule after the pre-existing iptables rules for SteamCMD.
sudo iptables -I INPUT 7 -p udp -m udp --dport 26900:27030 -j ACCEPT
After entering the above rule, run iptables-persistent again. You’ll be asked if you want to save the current IPv4 and IPv6 rules. Answer
yesfor IPv4 and
sudo dpkg-reconfigure iptables-persistent
Install an additonal 32-bit package:
sudo apt-get install lib32tinfo5
Install Team Fortress 2
Be sure you are in the directory
~/Steam, then access the
cd ~/Steam && ./steamcmd.sh
From the SteamCMD prompt, login anonymously:
Or log in with your Steam username:
Install TF2 to the
Steamuser’s home directory:
force_install_dir ./tf2 app_update 232250
This can take some time. If the download looks as if it has frozen, be patient. Once the download is complete, you should see this output:
1 2 3
Success! App '232250' fully installed. Steam>
To update TF2, run the above 4 commands again.
Configure Team Fortress 2
You can select from a variety of maps on which you can play Team Fortress 2, a number of which are already installed to the server.
In order to create a custom list of maps for your server, create
mapcycle.txt within the
tf2/tf/cfg directory. The best way to do this is to copy the example file and edit it to include your chosen maps.
cp mapcycle_default.txt mapcycle.txt
Open the file and add or remove maps as desired.
Message of the Day
The “Message of the Day” appears when joining a server. This can be a message to your normal group of players, a statement about the server’s settings, or anything else. Configure this by editing the files:
motd_default.txt file can contain HTML and is displayed as a website upon loading the server in-game. The
modt_text_default.txt file should be the text copy, with no additional code.
~/Steam/tf2/tf/cfg/server.cfg is what contains all of the settings you need to customize the loadout of your game. A
server.cfg file is not needed to run the game but we have a sample config file here which you can edit for your own use.
For the configuration of this file,
0means off and
Create a startup script for TF2 with the following contents:
1 2 3 4
#!/bin/sh cd ./Steam/tf2 screen -S "Team Fortress 2 Server" ./srcds_run -game tf +map ctf_2fort.bsp
When run, the script will change directories to
~/Steam/tf2and execute TF2 in a Screen session.
cft_2fort.bspwith the name of your chosen map’s file, or replace
+randommapfor a randomized map selection.
Make the script executable:
chmod +x ~/starttf2.sh
Using the Server
Now that your server is installed and configured, it can be launched by running the
starttf2.shscript from your
steamuser’s home directory.
cd ~/ && ./starttf2.sh
From this point, do not press the Control+C keys while in the console unless you want to stop TF2.
To detach from the screen session running the server console, press these two key combinations in succession:
To bring the console back, type the following command:
To stop the server, bring back the TF2 console and press CONTROL + C.
RCON allows you to make changes to your server from inside of the game.
To start using RCON, go to the Options setting in the game, and then select Advanced…
From here, check Enable developer console and apply these settings.
To make changes in-game, it is recommended that you switch to spectator mode, and then press the backtick button (
`) to access the developer’s console.
Log in to RCON by typing in
rcon_passwordfollowed by your password.
The commands for RCON are as follows:
rcon sv_password: Add a server password
rcon users: Display a list of users on the server
rcon kick: Boot user from server
rcon banid: Ban a user by their ID
rcon banip: Ban a user by their IP
rcon removeid: Remove a user from the ID ban list
rcon removeip: Remove a user from the IP ban list
rcon maps: Displays the maps available to your server
rcon changelevel [mapname]: Change to set map
server.cfg options can also be altered through RCON using the same values. For example, should you want to enable friendly fire, enter
rcon mp_friendlyfire 1.
This guide is published under a CC BY-ND 4.0 license.