Install Team Fortress 2 On Ubuntu

Updated on November 3, 2014
Install Team Fortress 2 On Ubuntu header image

This tutorial explains how to install Team Fortress 2 on the Ubuntu operating system. It was performed on Ubuntu 12.04 x86. Other versions of Debian or Ubuntu may also work without any changes.

Step 1.

Connect to your VPS using the root login details.

Step 2.

Install the necessary packages by typing:

apt-get install screen

If you are running a 64 bit system, you will also need to run:

apt-get install lib32gcc1

Notice that package ends in a 1 (one), not an L.

Step 3.

Create a new user by running the command:

adduser tf2

Follow the onscreen prompts by filling in the desired information. Note that fields regarding information such as "Full name" and "Address" are optional.

Step 4.

Reconnect to the VPS with the username tf2 and the password you selected in the user creation.

Step 5.

Create a new folder for the server copy of Steam by running the command:

mkdir steamcmd

Then enter the folder by running:

cd steamcmd

After this, SteamCMD can be downloaded by running the command:


Once the download has completed (should only take a few seconds) run the command:

tar -xvzf steamcmd_linux.tar.gz

Step 6.

Launch SteamCMD by typing:


SteamCMD should perform a self-update, then show a line saying Steam>. At this point, you need to log into Steam by running:

login anonymous

Next, at the Steam> prompt, type:

force_install_dir /home/tf2/server/

At this point, Steam is ready to download the Team Fortress 2 server files. Run the following command to begin the download. This may take some time.

app_update 232250 validate

Step 7.

Create a script to launch the server. This can be done by running:

cd /home/tf2

Then copy the following into the file:

sleep 1
screen -A -m -d -S tf2-server ./ttt/srcds_run -console -game tf2 +map cp_badlands +maxplayers 24
echo "TF2 Server Started, type screen -r to view console"

Press Ctrl + X followed by Y to save the file.

To make the file executable, run the command:

chmod +x

Step 8.

Start the server by running:


The server will then start and can be connected to in-game.

Step 9.

Customize the server by typing nano and changing the value after "+map" or "+maxplayers" to the map or player count you would like. After making those edits, press Ctrl + X followed by Y to save.

To change other config options, type:

cd server/tf/cfg
nano server.cfg

This opens the main configuration file for the server. These values can be modified in a number of ways to make your server appear different.

The first value that you should add is the "hostname". This variable is used to set the name for your server. It can be edited by adding a line saying:

hostname "My Vultr Server"

Another commonly changed variable is "mp_maxrounds". This variable is used to change the number rounds between each map change. It can be modified by adding another line to server.cfg and typing:

mp_maxrounds 5

Once you set the "mp_maxrounds" value, press Ctrl + X then Y to save and exit.

One last aspect of configuration that I will cover in this tutorial is the map cycle. The map cycle is just written as a list in the file mapcycle.txt. Open the map cycle by typing:

nano mapcycle.txt

In this file, a list is written with one map on each line. For example:


After typing all of the desired maps, press Ctrl + X then Y to save and exit. These settings will require a server restart. This can either be achieved by logging into the Vultr Member Home, and restarting the server, and reconnecting as the user tf2, and typing:


Alternatively, the TF2 Server can be restarted by typing:

screen -r

Then press Ctrl + C and type:

cd /home/tf2

Final notes

The server console can be accessed at any point by typing the following into the terminal screen.

screen -r

To leave the server console, Hold down the Ctrl key, and type AD.

At some points, the server may need updating. It will give warnings in the server console when this is necessary. An update can be performed by running:

cd /home/tf2/steamcmd/
./ +login anonymous +force_install_dir /home/tf2/server/ +app_update 232250

After a few minutes, you can restart the server and clients will be able to connect again.