Team Fortress 2 Dedicated Server In Linux

Now that Team Fortress 2, or TF2 for the sake of this article, is free to play just about everyone with some sense of computer gaming has played it. A dedicated server allows you to have control over the server and invite all your friends to play! In this guide we will set up a TF2 server in CentOS Linux.

Setting up TF2 in Linux is quite simple. Follow the steps below and you should be playing with your friends in no time. If you run into trouble, just leave a comment and I’ll try to give you a hand.

Step One

You are going to need terminal access to your Linux server. This means either using SSH or opening a terminal through your GUI.

Once we are in a terminal we will create a new user just for TF2. Although not required it provides extra security measures for your server.

Type the following to create a new user for TF2. Change the password accordingly.

useradd tf2server

Now we will create a password for this new user.

passwd tf2server

Finally switch to that user by typing:

su tf2server


Step Two

Now we will install the server!

Type cd ~ to change the current directory to the users home directory.

Now type mkdir hlds and then cd hlds to switch to the directory for the TF2 installation.

Now execute the following commands, in order, to install the server:
chmod +x hldsupdatetool.bin
Type yes when prompted.
chmod +x steam
./steam -command update -game "tf" -dir .
You may have to run the previous command a few times to fully complete the installation. I would run it at least three times.

Your server is now installed!

Step Three

Now we must create a configuration file for the server.

Create a file at called server.cfg in /home/tf2server/hlds/orangebox/tf/cfg

Paste the dedicated server configuration example from this website into that file. Be sure to edit the appropiet fileds like hostname and rcon password.

Step Four

Launch your new TF2 server!

Use this command to start the server.
./srcds_run -console -game tf +maxplayers 24 +map ctf_2fort


Congratulations on your new Team Fortress 2 server!