How to setup a dedicated server for Team Fortress 2
Publisher: Psychz Networks, February 26,2021Sequel to one of the most popular games of its time, Team Fortress, developed and published by Valve in 1996, Team Fortress 2 is the successor with the same multiplayer first-person shooter game option.
In the following article, we will step by step setup Team Fortress 2 on a Ubuntu 18 server.
Requirement
To install Team Fortress Dedicated Server on Linux, you'll need:
- Server with Ubuntu 18
- Root access
- 8GB
- 20 GB Storage space
Note: Team Fortress 2 uses certain ports that must be open on your server to connect users outside your own local network. UDP 27015 is the main port used by the server browser and allows the client to connect. This port is also used for RCON (Remote connect).
Update Ubuntu 18 for latest libraries
If you have recently performed a fresh Ubuntu installation, you will have to update repositories and install a few requirements.
# sudo apt-get update
Output
Get:2 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [1,228 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [1,913 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [394 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [256 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [34.3 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1,718 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [1,561 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [363 kB]
Get:12 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:13 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1,109 kB]
Fetched 8,828 kB in 19s (462 kB/s)
Reading package lists... Done
If you are using 64-bit distribution, you need to install a package named lib32gcc1 or ia32-libs. This is because Steam is compiled for i386 architecture only.
# sudo dpkg --add-architecture i386
# sudo apt-get install lib32z1 libncurses5:i386 libbz2-1.0:i386 lib32gcc1 lib32stdc++6 libtinfo5:i386 libcurl3-gnutls:i386
Download and install the SteamCMD Tool
It is recommended you create a separate user (such as "tf2server") to install and run game servers.
Create a user named "tf2server"
# adduser tf2server
Create a directory in which SteamCMD will be installed, eg './hlserver':
# mkdir ./hlserver
Change the current working directory to hlserver:
# cd hlserver
Download steamcmd_linux.tar.gz :
Use the tar command to uncompress the archive into the working directory:
# tar zxf steamcmd_linux.tar.gz
Download Team Fortress 2 Server
Use this command to download the latest server:
# ./steamcmd.sh +login anonymous +force_install_dir ./hlserver +app_update 232250 +quit
Note: 232250 is Team Fortress 2 App ID
You can update the server in the future by executing this command again.
Creating/Updating server configuration files
Now, change the current working directory to ~/hlserver/tf2/tf/cfg:
# cd ~/hlserver/tf2/tf/cfg
Create a file named server.cfg:
# nano server.cfg
Add the following content into your server.cfg (see Windows dedicated server for more information):
Note: You can add a name to your server in this file. This will be displayed when users will look for your server.
Running TF2 server
We will create a shell script which you can run to start your Team Fortress 2 Server, Create a file in './hlserver/tf2.sh' with the following contents:
Name this file 'tf2.sh' to make it executable.
# chmod u+x tf2.sh
Run ./tf2.sh to launch the server:
# ./tf2.sh
This will start the server. You can now invite players to join and play on your server.
We hope you have found this guide helpful and could successfully deploy Team Fortress 2 on your Ubuntu server. Please click on the up-vote button to show your appreciation.