• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Arch

Setup a Team Fortress 2 Server on Arch Linux

How VPS by How VPS
February 13, 2020
in Arch, Uncategorized
0
0
SHARES
82
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Before You Begin
  2. Install SteamCMD
  3. Install The Team Fortress 2 Server
  4. Configuring
  5. Running Your Server
  6. Running With systemd
  7. Final Notes
  8. Want to contribute?


This tutorial explains how to setup a Team Fortress 2 server on Arch Linux. I assume that you are logged in with a non-root user account that has sudo access. This tutorial uses AUR to build packages, and that operation should not be performed from the root account.

Before You Begin

It is very important that you have the multilib repository enabled if and only if you are on a 64-bit (amd64) server. If it isn’t enabled, then SteamCMD cannot run and you cannot even download the server files. To do this, you must uncomment the following lines in /etc/pacman.conf.

[multilib]
Include = /etc/pacman.d/mirrorlist

If you are on 32-bit (i686) Arch, you can safely ignore this.

Install SteamCMD

There is an AUR package for SteamCMD and it is one of the easiest ways to install SteamCMD on Arch. There are a couple odd things about it though:

  • All relative paths are relative to /usr/share/steamcmd.
  • To upgrade SteamCMD itself, you must be root.

If you are on a 64-bit server, you must install the package lib32-gcc-libs.

sudo pacman -Sy lib32-gcc-libs

Now we must build the package. Using curl, download the tarball for the package.

curl -O http://media.steampowered.com/installer/steamcmd_linux.tar.gz

Once the download finishes, extract and change to the directory created.

tar -xvzf steamcmd.tar.gz
cd steamcmd

Now, using makepkg, build the package.

makepkg -ci

If you didn’t pass the -i flag to the makepkg command, use pacman to install it.

sudo pacman -U *.pkg.tar.xz

You now have SteamCMD installed and ready to download Team Fortress 2 server.

Install The Team Fortress 2 Server

This guide uses a separate user to run the server, so we will create a new tf2 user and group with it’s own home folder in /var/lib.

sudo groupadd tf2
sudo mkdir /var/lib/tf2
sudo useradd -d /var/lib/tf2 -g tf2 -s /bin/bash tf2
sudo chown tf2.tf2 -R /var/lib/tf2

Now to install the server.

sudo -u tf2 steamcmd +login anonymous +force_install_dir ~tf2/server +app_update 232250 validate +quit

Once that finishes downloading, you have the server installed.

Configuring

Although you can run the server, some configuration should be done so that the server isn’t too generic. The main file that we put settings in is the server.cfg file. Below is a very basic server.cfg file.

To open/create the file, use your favorite editor. Here vim is used, but you can use any text editor like nano.

sudo -u tf2 vim ~tf2/server/tf/cfg/server.cfg

Add the following. More settings can be found on the Team Fortress 2 wiki and Valve developer page. Be sure to change some of the settings to suit your needs.

hostname "Server Name"
rcon_password "password"
sv_password ""
sv_contact "[email protected]"
sv_tags ""
sv_region "255"
sv_lan "0"

exec banned_user.cfg
exec banned_ip.cfg
writeid
writeip

Running Your Server

It is known that you need a multiplexer like GNU Screen or tmux to run your server unattended. Here we are going to use tmux to run the server, but if you prefer and know how to use screen, feel free to use it.

Install tmux by using pacman.

sudo pacman -Sy tmux

You can start the server with the following command. You can change the map and maxplayers if desired.

sudo -u tf2 tmux new-session -d -s tf2-console -d '~tf2/server/srcds_run -console -game tf +map cp_dustbowl +maxplayers 24'

If you ever need to attach to the console, run the following.

sudo -u tf2 tmux attach -t tf2-console

You can leave the server console by typing CTRL + B then releasing those keys and then pressing D.

Running With systemd

Running the server with systemd is convenient for many reasons. The main one is that you can have it start when the VPS starts. This requires a script and a systemd unit to be written. Even though this is a good idea, it is optional.

The first thing to write is the start script. To create the script, use your favorite editor. Here vim is used, but you can use any text editor like nano.

sudo -u tf2 vim ~tf2/server/tf2.sh

Add the following.

#!/bin/sh

USER=$2

if [ -z $2 ]; then
  USER="tf2"
fi

case "$1" in
  start)
    sudo -u $ tmux new-session -d -s tf2-console -d '/var/lib/tf2/server/srcds_run -console -game tf +map cp_dustbowl +maxplayers 24'
    ;;

  stop)
    sudo -u $ tmux send-keys -t tf2-console 'say Server shutting down in 10 seconds!' C-m
    sleep 10
    sudo -u $ tmux send-keys -t tf2-console 'quit' C-m
    sleep 5
    ;;

  *)
    echo "Usage: $0  user"
esac

exit 0

Now you need to make the systemd unit. To create the unit, use your favorite editor. Here vim is used, but you can use any text editor like nano.

sudo vim /usr/lib/systemd/system/tf2.service

Add the following.

[Unit]
Description=Team Fortress 2 Server (SRCDS)
After=local-fs.target network.target

[Service]
ExecStart=/var/lib/tf2/server/tf2.sh start
ExecStop=/var/lib/tf2/server/tf2.sh stop
Type=forking

[Install]
WantedBy=multi-user.target

Now make sure the tf2.sh file is executable.

sudo chmod +x ~tf2/server/tf2.sh

After all that, you can use systemctl to start and stop the server. Also you can use it to make it start on boot.

To start:

sudo systemctl start tf2.service

To stop:

sudo systemctl stop tf2.service

To restart:

sudo systemctl restart tf2.service

To enable at boot:

sudo systemctl enable tf2.service

To disable at boot:

sudo systemctl disable tf2.service

Even though systemd is handling starting and stopping the server, you can still access the console with the following command:

sudo -u tf2 tmux attach -t tf2-console

Final Notes

SteamCMD is installed in an area where only root can change files (see note in “Install SteamCMD”). If you ever need to upgrade SteamCMD itself, just run it as root.

sudo steamcmd +quit

If you need to update the server. First stop the server and then use SteamCMD to update (using the same command to install).

sudo systemctl stop tf2.service
sudo -u tf2 steamcmd +login anonymous +force_install_dir ~tf2/server +app_update 232250 validate +quit
sudo systemctl start tf2.service

There are a lot more configuration topics that are not covered in this tutorial. If you need more information, please refer to the Team Fortress 2 Wiki and the Valve Developer Wiki.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

Setup Spigot Server on Arch Linux

Next Post

Setup a Counter-Strike: Global Offensive (CSGO) Server on Arch Linux

Next Post

Setup a Counter-Strike: Global Offensive (CSGO) Server on Arch Linux

Leave a Reply Cancel reply

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

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet