Guide to raising a dedicated server in Team Fortress 2


Hello everybody! I share the most detailed guide for creating a server in TF2 on Ubuntu/Debian-like systems.

System preparation

So, to begin with, you need to install the necessary libraries for the server. We add the architecture:

sudo dpkg --add-architecture i386

We update packages:

sudo apt update

We install the update:

sudo apt upgrade

Well, actually, we install the libs themselves:

sudo apt install lib32z1 libncurses5:i386 libbz2-1.0:i386 lib32gcc1 lib32stdc++6 libtinfo5:i386 libcurl3-gnutls:i386 libsdl2-2.0-0:i386

If you need debug mode, then install gdb:

sudo apt install gdb

The community is now in Telegram

Subscribe and stay up to date with the latest IT news

Sign up

Server installation

After installing everything you need, you need to create a user and directory of our server, since the server does not work from root:

adduser <имя_пользователя>

We create a directory. This folder will contain the server itself.

mkdir <ваше_название>

Enter the directory:

cd <ваше_название>

Now you need to load the server. To download it, you need to download SteamCMD, which is the console version of Steam.


We unpack the downloaded archive:

tar zxf steamcmd_linux.tar.gz

Well, we install the server itself:

./ +force_install_dir ./tf2 +login anonymous +app_update 232250 +quit

Here I will explain in more detail:

  • ./ – SteamCMD startup file. If you simply type ./, the SteamCMD console will open before you.
  • +force_install_dir – directory for installing server files. In this case, /tf2 means that the TFky server will be on the way ~/<ваша_назва>/tf2.
  • + login anonymous – enter Steam without a password using an anonymous account.
  • +app_update 232250 – update the application with the number 232250, that is, the Team Fortress 2 server. Client code TF2 – 440, HL2 – 220. This code is on the link to the game page in the Steam store. For example, here is the HL2 link:
  • +quit – Quit SteamCMD.

All these commands can be executed one by one in SteamCMD after execution ./

Now we wait for the installation… When the installation is complete, SteamCMD will output something like:

Success! App '232250' is up to date.

TF2 server settings

The server is installed, now you can start the configuration. The directory structure of the server is not very different from the TFka client. We create server.cfg:

nano ~/<ваше_название>/tf2/tf/cfg/server.cfg

In this config, all server settings are stored, such as the server name in the game browser, port, rcon settings (server control from the TF2 client) and much more. Here are the main server.cfg commands:

hostname "<название_вашего_сервера>" // По стандарту "Team Fortress".
hostport "<порт>" // По стандарту "27050". Этот параметр нужно указать в строке запуска
sv_region <число>   // По стандарту "*ничего*". Значения: -1 — мир, 0 — США восток, 1 — США запад, 2 — Южная Америка, 3 — Европа, 4 — Азия, 5 — Австралия, 6 — Ближний Восток, 7 — Африка
mp_timelimit "<время_отведенное_на_карту_в_минутах>" // По стандарту "0". 0 - бесконечное кол-во. После истечения карта принудительно сменится, без доигрывания раунда до конца.

In server.cfg, you can write anything, except commands with the postscript “cl_:”.

To avoid confusion, I recommend outputting different settings to different files. Example:


hostname "RomaRomaMolodetz"
hostport "27015"
sv_pure 1
exec map.cfg
exec network.cfg


sv_allowupload 1    // Разрешает клиенту загружать файлы на сервер (например, спреи)
sv_allowdownload 1   // Разрешает клиенту скачивать файлы с сервера (например, карты или звуки)
net_maxfilesize 100   // Максимально разрешенный размер файла в мегабайтах
sv_downloadurl "   //Откуда клиентам качать файлы с сервера


mp_enableroundwaittime 1  // Включает таймер ожидания между раундами
mp_bonusroundtime 8  // Время после победы в раунде до нового раунда
mp_restartround 0  // Если не 0, то новый раунд будет перезагружен через данное кол-во секунд
mp_stalemate_enable 1  // Включает внезапную смерть
mp_stalemate_timelimit 300  // Время внезапной смерти (в секундах)
mp_timelimit 0  // Время отведенное на карту в минутах

This helps if you have a huge server.cfg.

You still need to create the mapcycle.txt file. It is optional, but preferred. It describes the order of cards that will be on the server:

nano ~/<ваше_название>/tf2/tf/cfg/mapcycle.txt

We write the full names of the cards there. Example:


One line is one card.

Starting the server

Everyone put it – you can check it. Go to the user’s home folder:


We try to run:

./hlserver/tf2/srcds_run -console -game tf +map ctf_2fort +maxplayers 16 +sv_setsteamaccount <токен> -port 27015 -debug

Let me explain:

  • ./hlserver/tf2/srcds_run – Team Fortress 2 server startup file.
  • -console and – game tf – these parameters cannot be taken away.
  • + map <назва карти> – the card that will be on the server. It can be changed with the map command (drops players from the server) or changelevel (does not drop).
  • +maxplayers <число> – the maximum number of players on the server (up to 32).
  • +sv_setsteamaccount [токен] – Optional, but highly desirable. This variable allows you to officially make the server yours, the token can be obtained here. This is necessary so that the server does not disappear from the favorites when moving to another IP.
  • -port <число> – the port on which the server will wait for a connection.
  • -debug – debugging mode. This requires gdb. Almost an unnecessary thing, but I prescribe it.

If there are no errors, the server will start and be available.


The server is up and running, now you can install the plugin to install plugins. It sounds strange, but yes.

Download sourcemod and metamod archives. There you need to select the system where your server is running. You also need to make a metamod.vdf, for this we go here, select the game and press “Generate metamod.vdf”. Choose Game Folder no need.

Now we unpack everything in one place to combine the addons folders from the metamod and sourcemod archives. Metamod.vdf needs to be dragged into addons with replacement. After all this, through SSH, SCP or FTP, drag the resulting files to the server in the directory:


Now you need to register yourself as an administrator. This is done in the andmins_simple.ini file. This can be done in three ways: by PI, SteamID and nickname. Open the file:

sudo nano ~/<ваше_название>/tf2/tf/addons/sourcemod/configs/admins_simple.ini

Scroll to the end and enter the line according to the example:

"STEAM_0:0:000000000" "99:z"  //По STEAMID  
"" "99:z" //По IP
"Nickname" "99:z" //По нику

It works like this: “NICK, IP or STEAMID” “Right”.

If everything is quite clear with the first, then with the second – not so much. There are definitions in the admin_levels.cfg file, but they are in English. I’ll explain everything here:

b - Все остальное, не перечисленное ниже
c - Кикать
d - Банить
e - Разбанивать
f - Шлепать людей
g - Менять карту
h - Изменять значения консольных переменных сервера
i - Изменять конфиги
j - Некоторые привелегии к чату
k - Запускать голосования
l - Ставить пароль на сервер
m - Удаленная консоль (rcon)
n - Менять состояние sv_cheats 
z - Полный доступ
z:<число> - Приоритет (10 не может кикнуть 20) (только у админов с опцией z)

Restart the server and you can play!


You can also create a firewall. Let’s setap ufw!


sudo apt install ufw

We add the rules:

sudo ufw allow <порт_вашего_сервера>
sudo ufw allow <rcon_порт_(если_есть)>
sudo ufw allow <ssh_порт_(по_стандарту_22)>

Let’s launch!

sudo ufw enable


I’ve detailed how to get your Team Fortress 2 server up on Linux. If you have any questions, write in the comments.

Useful links:

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2022 - Theme by WPEnjoy · Powered by WordPress