Windows dedicated server
Download and install the SteamCMD Tool
It is recommended you create a separate user to install and run game servers. It is also recommended you use the non-beta version of the Steam client, otherwise, it won't be able to locate Steam libraries.
- Download steamcmd.zip
- Unzip steamcmd.zip to a directory, for example 'C:\TF2server'.
Create a SteamCMD script
- Create a file called tf2_ds.txt in the folder where you installed the tool. In this example, that is 'C:\hlserver'
- Edit the file with this text:
@ShutdownOnFailedCommand 1 @NoPromptForPassword 1 login anonymous force_install_dir c:\TF2server\ app_update 232250 quit
If you want to opt for the prerelease version of the TF2 dedicated server, add this line after the app_update ID, in the same line:
Create an updating batch file
- Create a file called update.bat in the folder where you installed the tool.
- Edit the file with this text:
@echo off steamcmd +runscript tf2_ds.txt
Start the download/update
- Run the update.bat to start the download. This may take several hours as dedicated server content is 8.45 GB as of June 10, 2021.
- You may need to run the file *multiple* times until the message "Success! App '232250' fully installed." displays.
Create/Update server files
- Create a file called server.cfg in 'C:\TF2server\steamapps\common\Team Fortress 2 Dedicated Server\tf\cfg\'
- Edit the file with these details:
// The server name that players will see in the server browser and in the scoreboard hostname "Your server's name" // Leave empty if you do not want a password sv_password "" // Password to enable rcon access from the console rcon_password "Your_Rcon_Password" // Time per map in the rotation, in minutes. 0 to never rotate the map on a timer. mp_timelimit 30 // Maximum number of rounds to play per map before forcing a mapchange mp_maxrounds 10 // Allow clients to upload customization files (e.g. sprays) sv_allowupload 1 // Allow clients to download files (e.g. sprays, custom maps, custom content, etc.) sv_allowdownload 1 // Maximum allowed file size for uploading in MB (Optional) net_maxfilesize 15
An example with more cvars (console variables) can be found in Example Server.cfg for TF2 dedicated server.
- Create the files motd.txt and mapcycle.txt in 'C:\TF2server\steamapps\common\Team Fortress 2 Dedicated Server\tf\cfg'
- You may want to use the motd_default.txt and mapcycle_default.txt as references
- Create a file called pure_server_whitelist.txt in 'C:\TF2server\steamapps\common\Team Fortress 2 Dedicated Server\tf\cfg'
- It is advised that you copy and paste the contents of the pure_server_whitelist_example.txt file into your file first, and then apply any modifications you may want
Create a file to run the server
- Create a shortcut that references to the file 'C:\TF2server\srcds.exe'. Name the shortcut an appropriate name,
- Right click on the shorcut, select properties,
- Set Target to:
"C:\TF2server\srcds.exe" -console -game tf +sv_pure 1 +map ctf_2fort +maxplayers 24
- Set Start in to:
- Windows may not allow this though.
- Run the shortcut you have created to start your server.
Other command line options
Some other common command-line options for TF2 are:
-ip 126.96.36.199- Bind to a specific IP address. By default, the server listens on all network interfaces.
-port 27015- Bind to a different port (27015 is the default).
-strictportbind- If a server is already running on the specified port, the server will shut down instead of moving to the next available port.
+randommap- Use instead of +map to select a map at random when starts the server.
+servercfgfile- Which tf\cfg\ file to execute on map change, defaults to
+mapcyclefile- Which tf\cfg\ file contains this server's mapcycle, defaults to
mapcycle.txt. Will also look in tf\
replay.cfgand adds an additional slot for the replay bot, but removes it from the player count.