Learn How To Install Team Fortress 2 On Ubuntu
Table of Contents
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.
Connect to your VPS using the root login details.
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
Create a new user by running the command:
Follow the onscreen prompts by filling in the desired information. Note that fields regarding information such as “Full name” and “Address” are optional.
Reconnect to the VPS with the username
tf2 and the password you selected in the user creation.
Create a new folder for the server copy of Steam by running the command:
Then enter the folder by running:
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
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:
Next, at the
Steam> prompt, type:
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
Create a script to launch the server. This can be done by running:
cd /home/tf2 nano start_tf2.sh
Then copy the following into the file:
#!/bin/sh 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 start_tf2.sh
Start the server by running:
The server will then start and can be connected to in-game.
Customize the server by typing
nano start_tf2.sh 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 IT Web Services 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:
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:
In this file, a list is written with one map on each line. For example:
cp_badlands cp_granary cp_degrootkeep
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 IT Web Services Member Home, and restarting the server, and reconnecting as the user
tf2, and typing:
Alternatively, the TF2 Server can be restarted by typing:
Then press Ctrl + C and type:
cd /home/tf2 ./start_tf2.sh
The server console can be accessed at any point by typing the following into the terminal screen.
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/ ./steamcmd.sh +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.
Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!