Difference between revisions of "Linux dedicated server"

From Team Fortress Wiki
Jump to: navigation, search
m
(Full re-write, major expansion.)
Line 1: Line 1:
 +
{{ambox | type = notice | contents = This guide assumes an understanding on using the command line in Linux.}}
 +
 +
Linux is one of the two platforms currently supported by Valve's dedicated server tool (HLDS), the other being [[Windows_dedicated_server|Microsoft Windows]]. Basic installation and configuration is the same for all distributions, but small details, such as package names, directories, etc. may differ from distribution to distribution. It is recommended that you check your distribution's repositories for the required packages before continueing.
 +
 +
== Reading this article ==
 +
 +
This article has been written according to standard Linux documentation syntax, meaning the following:
 +
 +
* A command prefixed by <code>#</code> (a hash) is meant to be run as '''root'''. Most distributions have a seperate root account; for other distributions such as Ubuntu, Linux Mint, Crunchbang, etc., the '''sudo''' prefix to a command will ensure the command is run as root.
 +
* A command prefixed by <code>$</code> (a dollarsign) is meant to be run as a '''user'''.
 +
* <code>./</code> means "current working directory".
 +
 +
== Requirements ==
 +
 +
A number of requirements exist in order to run a Team Fortress 2 server on the Linux platform, namely:
 +
 +
* Write-access to the current working directory
 +
* <code>glibc >= 2.3.6</code>
 +
* Approximately 5GB hard-drive space (for a barebones server with no custom maps, sounds, etc.)
 +
* In the case of a 64-bit distribution, the package '''lib32gcc1''' is required to be installed.
 +
 
== Installation ==
 
== Installation ==
  
 +
There are a number of different ways to run a dedicated server. In this article, we will assume that a specific user (''tf2server'') has been created for the sole purpose of running a Team Fortress 2 server. In order to create a user, issue the following command as root:
 +
 +
# adduser tf2server
 +
 +
You will be prompted for a name, a password, along with other information; fill this out as you please. Then log out of your current account, and log in as tf2server.
 +
 +
Next up, create a directory and change to it. You can call it anything you like; I've picked "hlds":
 +
 +
$ mkdir hlds && cd hlds
 +
 +
The next thing we need to do is to download the dedicated server update tool (hldsupdatetool.bin), and change its permissions to be executable, allowing us to download the Steam binary required to download our gameserver. Finally, we run the binary.
 +
 +
$ wget http://steampowered.com/downloads/hldsupdatetool.bin && chmod +x hldsaupdatetool.bin
 +
$ ./hldsupdatetool.bin
 +
 +
When we run the binary, we're prompted to accept Valve's Terms and Conditions for using the update tool; after reading and agreeing to the terms included, type "yes", and hit Enter. The next thing to happen is that the ''steam'' binary should extract. Run it to download the latest version of the HLDS Update Tool:
 +
 +
$ ./steam
 +
Checking bootstrapper version ...
 +
Getting version 40 of Steam HLDS Update Tool
 +
Downloading. . . . . . . . . . . .
 +
Steam Linux Client updated, please retry the command
 +
 +
Do as prompted; repeat the same command. All we need to do now is to download the gameserver files, and launch it.
 +
 +
Create another directory, which will house the actual files of the gameserver (inside /home/tf2server/hlds). We'll call this one ''gameserver''.
 +
 +
$ mkdir gameserver
 +
 +
Next up, let's ask Steam to download the Team Fortress 2 game files into that folder, using the following command.
 +
 +
$ ./steam -command update -game tf -dir gameserver/
 +
 +
This runs the ''update'' command of the game ''tf'' (Team Fortress 2) into the directory ''gameserver/''. Sit back and wait, this may take some time.
  
 +
== Running the server ==
  
sudo apt-get install lib32gcc1 (for 64-bit platform)
+
We're almost done. The server is installed. The only thing left is to run it, using a number of arguments. Change to the ''gameserver/orangebox/'' directory. There should be a script called <code>srcds_run</code>, which is what launches the game. A basic use of this script '''could''' be:
wget http://steampowered.com/download/hldsupdatetool.bin
 
chmod +x hldsupdatetool.bin
 
./hldsupdatetool.bin
 
type yes
 
./steam (twice)
 
./steam -command update -game tf -dir .
 
  
== Starting ==
+
$ ./srcds_run -game tf -autoupdate -tickrate 66 -maxplayers 24 +map cp_badlands
  
cd orangebox
+
This launches a Team Fortress 2 server with a tickrate of 66, a maximum of 24 players, on [[Badlands]]. There are many more ways of configuring the server and running it, but this covers the basics.
./srcds_run -game tf -autoupdate -tickrate 66 -maxplayers 24 +map cp_badlands
 
  
 
== Tips ==
 
== Tips ==
  
# The Dedicated Server does not need superuser (root) privileges to install or run. Consider setting up a separate user account for the Dedicated Server (eg. <tt>hlds</tt>).
 
# If your server is running a 64-bit (AMD64) Linux OS, you might need to install some packages for 32-bit binary compatibility. Under Debian, a simple <tt>sudo aptitude install ia32-libs</tt> should do the trick.
 
# Minimum glibc version required to run is 2.3.6.
 
 
# <tt>server.cfg</tt> goes in <tt>orangebox/tf/cfg</tt>. For more information on configuring your dedicated server, see [[Dedicated server configuration]].
 
# <tt>server.cfg</tt> goes in <tt>orangebox/tf/cfg</tt>. For more information on configuring your dedicated server, see [[Dedicated server configuration]].
 
# Remember to open ports 27000-27015 from your firewall, if you have one.
 
# Remember to open ports 27000-27015 from your firewall, if you have one.

Revision as of 19:40, 19 October 2010

Linux is one of the two platforms currently supported by Valve's dedicated server tool (HLDS), the other being Microsoft Windows. Basic installation and configuration is the same for all distributions, but small details, such as package names, directories, etc. may differ from distribution to distribution. It is recommended that you check your distribution's repositories for the required packages before continueing.

Reading this article

This article has been written according to standard Linux documentation syntax, meaning the following:

  • A command prefixed by # (a hash) is meant to be run as root. Most distributions have a seperate root account; for other distributions such as Ubuntu, Linux Mint, Crunchbang, etc., the sudo prefix to a command will ensure the command is run as root.
  • A command prefixed by $ (a dollarsign) is meant to be run as a user.
  • ./ means "current working directory".

Requirements

A number of requirements exist in order to run a Team Fortress 2 server on the Linux platform, namely:

  • Write-access to the current working directory
  • glibc >= 2.3.6
  • Approximately 5GB hard-drive space (for a barebones server with no custom maps, sounds, etc.)
  • In the case of a 64-bit distribution, the package lib32gcc1 is required to be installed.

Installation

There are a number of different ways to run a dedicated server. In this article, we will assume that a specific user (tf2server) has been created for the sole purpose of running a Team Fortress 2 server. In order to create a user, issue the following command as root:

# adduser tf2server

You will be prompted for a name, a password, along with other information; fill this out as you please. Then log out of your current account, and log in as tf2server.

Next up, create a directory and change to it. You can call it anything you like; I've picked "hlds":

$ mkdir hlds && cd hlds

The next thing we need to do is to download the dedicated server update tool (hldsupdatetool.bin), and change its permissions to be executable, allowing us to download the Steam binary required to download our gameserver. Finally, we run the binary.

$ wget http://steampowered.com/downloads/hldsupdatetool.bin && chmod +x hldsaupdatetool.bin
$ ./hldsupdatetool.bin

When we run the binary, we're prompted to accept Valve's Terms and Conditions for using the update tool; after reading and agreeing to the terms included, type "yes", and hit Enter. The next thing to happen is that the steam binary should extract. Run it to download the latest version of the HLDS Update Tool:

$ ./steam
Checking bootstrapper version ...
Getting version 40 of Steam HLDS Update Tool
Downloading. . . . . . . . . . . .
Steam Linux Client updated, please retry the command

Do as prompted; repeat the same command. All we need to do now is to download the gameserver files, and launch it.

Create another directory, which will house the actual files of the gameserver (inside /home/tf2server/hlds). We'll call this one gameserver.

$ mkdir gameserver

Next up, let's ask Steam to download the Team Fortress 2 game files into that folder, using the following command.

$ ./steam -command update -game tf -dir gameserver/

This runs the update command of the game tf (Team Fortress 2) into the directory gameserver/. Sit back and wait, this may take some time.

Running the server

We're almost done. The server is installed. The only thing left is to run it, using a number of arguments. Change to the gameserver/orangebox/ directory. There should be a script called srcds_run, which is what launches the game. A basic use of this script could be:

$ ./srcds_run -game tf -autoupdate -tickrate 66 -maxplayers 24 +map cp_badlands

This launches a Team Fortress 2 server with a tickrate of 66, a maximum of 24 players, on Badlands. There are many more ways of configuring the server and running it, but this covers the basics.

Tips

  1. server.cfg goes in orangebox/tf/cfg. For more information on configuring your dedicated server, see Dedicated server configuration.
  2. Remember to open ports 27000-27015 from your firewall, if you have one.

See also