Difference between revisions of "Linux dedicated server/fr"

From Team Fortress Wiki
Jump to: navigation, search
m (added tux)
 
(34 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{trans}}
+
{{DISPLAYTITLE:Linux dedicated server}}
{{DISPLAYTITLE:Serveur Dédié Linux}}
+
{{ambox | type = notice | image = TuxMascot.png| contents = This guide assumes that the reader has a basic understanding of using the Linux command line.}}
{{ambox | type = notice | image = Ambox_notice.png | contents = '''Ce guide''' prend en compte que vous savez comment utiliser la '''ligne de commande sous Linux'''.}}
 
  
Linux est l'une des deux plates-formes actuellement prises en charge par l'outil de Valve serveur dédié (HLDS), l'autre étant [[Windows Dedicated Server|Microsoft Windows]]. L'installation de base et la configuration d'un '''serveur dédié Linux''' est la même pour toutes les distributions, mais de petits détails, tels que les noms de paquets, répertoires, etc peuvent différer d'une distribution à l'autre. Il est recommandé que vous vérifiez les dépôts de votre distribution pour les paquets nécessaires avant de continuer.
 
  
== Comment lire cet article ==
+
== Introduction ==
Cet article a été écrit selon la syntaxe de documentation Linux standard, ce qui signifie que:
 
  
* Une commande préfixée par <code>#</code> est destinée à être exécuté comme '''root'''. La plupart des distributions ont un compte root séparée; pour d'autres distributions comme Ubuntu, Linux Mint, CrunchBang, etc le préfixe '''sudo''' assure que la commande est exécutée en tant que root.
+
Cet article va traiter autant d'aspects que possible sur l'hébergement serveur [[Main page|Team Fortress 2]] sur un Linux.<br />
* Une commande préfixée par <code> $ </ code> est destinée à être exécuté comme '''utilisateur'''.
+
<br />
* <code>./</code> signifie "répertoire courant".
+
Cet article a été écrit pour Debian (Jessie).<br />
 
+
<br />
== Configuration requise ==
+
Valve semble avoir utilisé Ubuntu 12.04 32bits comme leur environnement de développement principal. Cela signifie que si vous utilisez Ubuntu Server 12.04 32bits, vous aurez moins de mauvaises surprises. Vous pouvez bien sûr utiliser une version plus récente d'Ubuntu et qui devrait également être compatible.<br />
Un certain nombre d'exigences existent afin d'exécuter un serveur ''Team Fortress 2'' sur la plate-forme Linux:
+
<br />
 
+
Ce guide est écrit avec une distribution basée sur Debian Jessie.<br />
* Accès en écriture au répertoire de travail courant
+
<br />
* <code>Glibc >= 2.3.6</ code>
+
== Pré-requis ==
* Environ 9 Go d'espace disque disponible (pour un serveur barebones sans cartes personnalisées, des sons, etc)
+
<br />
* Dans le cas d'une distribution '''64-bit''' les packages '''lib32gcc1''' ou '''ia32-libs''' doivent être installés:
+
Assurez-vous que vous remplissez les conditions suivantes avant de commencer:<br />
Sur CentOS 64-bits exécuter:
+
<br />
 
+
* Un utilisateur qui permet d'exécuter le serveur en tant que («valve» est recommandé, avec le répertoire /home/valve)<br />
<code> # yum install libgcc.i686 glibc.i686 </code>
+
* Suffisamment d'espace disque pour le contenu que vous souhaitez installer<br />
 
+
* Un terminal de ligne de commande ouvert en lançant l'utilisateur "valve" (su valve) ou une session SSH avec l'utilisateur "valve" connecté.<br />
Sur Debian/Ubuntu/Linux Mint 64-bit exécuter:
+
* Une expérience avec l'utilisation de base en ligne de commande sur Linux.<br />
 
+
<br />
<code> $ sudo apt-get install ia32-libs lib32gcc1 </code>
+
== Installationde SteamCMD ==
 
+
<br />
Sur ArchLinux 64-bit exécuter:
+
Le script suivant va télécharger SteamCMD, extraire et mettre à jour. SteamCMD est nécessaire pour télécharger et mettre à jour Team Fortress 2.<br />
 
+
<br />
<code> $ sudo pacman-Sy lib32gcc1 ia32-libs</code>
+
  cd ~
 
+
mkdir bin
* Si vous effectuez l'installation sur CentOS, vous devrez utiliser cette commande avant <code>yum install ncompress</ code>
+
cd bin
* Si vous effectuez l'installation sur FreeBSD (ce qui n'est pas du tout Linux), vous devez activer la compatibilité avec Linux dans le noyau et installer un système de base via la collection des ports. Instructions pour vous aider à démarrer sont situés [http://www.ian-justman.com/wiki/index.php?title=HowTos:SRCDS_under_FreeBSD ici].
+
  wget http://media.steampowered.com/client/steamcmd_linux.tar.gz
 
+
  tar -xvzf steamcmd_linux.tar.gz
== Installation ==
+
  ./steamcmd.sh +login anonymous +quit
Il y a un certain nombre de façons différentes de faire fonctionner un serveur dédié. Dans cet article, nous supposons qu'un utilisateur spécifique (''tf2server'') a été créé dans le seul but de gérer un serveur de Team Fortress 2. Pour créer un utilisateur, exécutez la commande suivante en tant que root:
+
<br />
 
+
== Installation de Team Fortress 2 ==
# adduser tf2server
+
<br />
 
+
Le script suivant va télécharger la dernière version de Team Fortress 2 pour vous avec une seule commande.<br />
Vous serez invité à entrer un nom, un mot de passe, ainsi que d'autres informations; remplir ce formulaire comme il vous plaît. Puis changez d'utilisateur, en utilisant la commande '''su''':
+
<br />
 
+
Nous utilisons l'éditeur de texte "nano" pour cela, mais vous pouvez utiliser votre propre si vous préférez un autre éditeur.<br />
  $ su -l tf2server
+
<br />
 
+
Tout d'abord, nous allons aller dans répertoire personnel de l'utilisateur.<br />
Prochaine étape, créer un répertoire et y entrer. Vous pouvez l'appeler comme vous voulez, j'ai choisi "hlds" (pour Half-Life Dedicated Server):
+
<br />
 
+
  cd ~
  $ mkdir hlds && cd hlds
+
<br />
 
+
Pour créer le script, utilisez votre outil éditeur de texte préféré. Dans cet exemple, nous utilisons «nano», mais tout autre comme "vi", "vim", "pico" ou "emacs" fonctionnera également.<br />
La prochaine chose que nous devons faire est de télécharger l'outil de mise à jour serveur dédié (hldsupdatetool.bin), et changer les permissions pour être exécutable, ce qui nous permet de télécharger le binaire Steam nécessaire pour télécharger notre server. Enfin, nous lançons le binaire.
+
<br />
 
+
  nano update_tf2.sh
  $ wget http://storefront.steampowered.com/download/hldsupdatetool.bin && chmod +x hldsupdatetool.bin
+
<br />
  $ ./hldsupdatetool.bin
+
Collez le script suivant dans nano :<br />
 
+
<br />
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:
+
update_server() {
 
+
  $ ./steam
+
APP_ID=$1
Checking bootstrapper version ...
+
DIR=$2
Getting version 50 of Steam HLDS Update Tool
+
Downloading. . . . . . . . . . . .
+
if ( [ ! -d "$HOME/$DIR" ]; ) then
Steam Linux Client updated, please retry the command
+
mkdir -p "$HOME/$DIR"
 
+
fi
Do as prompted; repeat the same command. All we need to do now is to download the gameserver files, and launch it.
+
 
+
if ( [ ! -d "$HOME/$DIR" ]; ) then
Create another directory, which will house the actual files of the gameserver (inside /home/tf2server/hlds). We'll call this one ''gameserver''.
+
echo "ERREUR! Impossible de créer le répertoire $HOME/$DIR!"
 
+
$ mkdir gameserver
+
exit 1
 
+
fi
Next up, let's ask Steam to download the Team Fortress 2 game files into that folder, using the following command.
+
 
+
./bin/steamcmd.sh +login anonymous +force_install_dir "$HOME/$DIR" +app_update $APP_ID validate +quit
$ ./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.
+
 
+
update_server 232250 "server_1"
== 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 <code>gameserver/orangebox/</code> directory. In this folder, create a file called <code>steam_appid.txt</code> and put in there only the following number:
+
 
+
exit 0
  440
+
<br />
 
+
Maintenant, nous enregistrer le fichier. Dans nano, enregistrer un fichier se fait en appuyant sur <code>Ctrl + O</code>, suivi par <code>Entrée</code>. Maintenant, nous fermons le dossier en appuyant sur <code>Ctrl + X</code>.<br />
Next, in the same <code>orange box</code> folder, there should be a script called <code>srcds_run</code>, which is what launches the game. A basic use of this script '''could''' be:
+
<br />
 
+
Avant que nous puissions exécuter ce fichier, nous avons besoin de lui donner les droitspour que l'utilisateur puisse l'executer. Cela se fait avec la commande suivante:<br />
$ ./srcds_run -game tf -autoupdate -steambin /home/tf2server/hlds/steam -maxplayers 24 +map cp_badlands
+
<br />
 
+
chmod + x ./update_tf2.sh
This launches a ''Team Fortress 2'' server with a maximum of 24 players on [[Badlands (Control Point)|Badlands]] which will download updates automatically. There are many more ways of configuring the server and running it, but this covers the basics.
+
<br />
 
+
Maintenant, on met à jour le serveur.<br />
=== screen ===
+
<br />
Many server operators choose to run the server under [http://www.gnu.org/software/screen/ <code>screen</code>], as it allows you to switch between the console and the shell at will, as well as end your SSH session without killing the server. It can be installed via your distribution's package manager. The server can then be run with:
+
./update_tf2.sh
 
+
<br />
  $ screen -m -S {{botignore|tf2}} ./srcds_run ''parameters''
+
Le serveur va maintenant télécharger le contenu nécessaire. Steam va vous montrer le pourcentage de progrès qu'il réalise avec le téléchargement.<br />
 
+
<br />
where ''parameters'' is your normal <code>srcds_run</code> parameters. You can use {{key|Ctrl}}+{{key|A}}+{{key|D}} to minimize the console, and <code>screen -r tf2</code> to bring it back up. {{key|Ctrl}}+{{key|D}} will terminate the session (make sure you use the killserver console command first) and {{key|Ctrl}}+{{key|A}}+{{key|[}} will allow you to scroll through it. See the [http://www.gnu.org/software/screen/manual/screen.html manual] for more commands and parameters.
+
== Démarrage du serveur ==
 
+
La commande ci-dessous démarre le serveur avec 24 slots sur ctf_2fort.<br />
=== Automated startup at server boot ===
+
<br />
In the event of unexpected power outages, it might be usefull to automatically restart your server. The following example Debian LSB init script can be used to automatically restart the server. Note that  <code>screen</code> is used. This script should be named TF2-server and can be put in the folder /etc/init.d. After doing that, run:
+
<code>~ /server_1/srcds_run -game tf + maxplayers 24 + carte ctf_2fort</code>
 
+
<br />
$ update-rc.d TF2-server defaults
+
== Mise à jour du serveur ==
 
+
<br />
This should ensure a proper startup of the server after each reboot.
+
Pour mettre à jour le serveur, ou de mettre à jour le contenu du serveur, nous démarerons simplement notre script de mise a jour. Vous devez vous assurer que vos serveurs sont éteints, sinon ls mise à jour échouera.<br />
 
+
<br />
<pre>
+
Mettre à jour le serveur :<br />
#!/bin/sh
+
<br />
 
+
./update_tf2.sh
### BEGIN INIT INFO
+
<br />
# Provides:          tf2server
+
== Autre ==
# Required-Start:    $remote_fs
+
<br />
# Required-Stop:    $remote_fs
+
'''Binaires 32 bit'''s<br />
# Default-Start:    2 3 4 5
+
<br />
# Default-Stop:      0 1 6
+
Si vous utilisez une version 64 bits de Linux, vous avez besoin de 32 bits binaires, car SteamCMD est uniquement disponible en 32 bits.<br />
# Short-Description: Team Fortress 2 server
+
<br />
# Description:      Starts a Team Fortress 2 server
+
Si vous obtenez le message d'erreur suivant :<br />
### END INIT INFO
+
<br />
 
+
<code>./steamcmd.sh: ligne 29:home/$ USER/vapeur/linux32/steamcmd: Aucun fichier ou répertoire</code>
NAME="Team Fortress 2"
+
<br />
USER="tf2server"
+
Alors vous utilisez probablement un système 64 bits et donc les binaires 32 bits sont manquent.<br />
SCREENREF="tf2"
+
<br />
BINARYPATH="/home/tf2server/hlds/gameserver/orangebox"
+
Pour ce faire, vous devez installer ia32-libs. Pour ce faire, exécutez le code suivant:<br />
BINARYNAME="srcds_run"
+
<br />
PIDFILE="tf2server.pid"
+
dpkg --add-architecture i386
 
+
apt-get update
OPTS="-game tf -autoupdate -steambin /home/tf2server/hlds/steam +maxplayers 32 +ip 0.0.0.0 +map mvm_decoy"
+
apt-get install ia32-libs
 
+
[[Category: Servers/fr]]
cd "$BINARYPATH"
 
 
 
running() {
 
    if [ -n "`pgrep -f $BINARYNAME`" ]; then
 
        return 0
 
    else
 
        return 1
 
    fi
 
}
 
 
 
start() {
 
    if ! running; then
 
        echo -n "Starting the $NAME server... "
 
        start-stop-daemon --start --chuid $USER --user $USER --chdir $BINARYPATH --exec "/usr/bin/screen" -- -dmS $SCREENREF $BINARYPATH/$BINARYNAME $OPTS
 
        pgrep -f $BINARYNAME > $PIDFILE
 
        if [ -s $PIDFILE ]; then
 
            echo "Done"
 
        else
 
            echo "Failed"
 
            rm $PIDFILE
 
        fi
 
    else
 
        echo "The $NAME server is already started."
 
    fi
 
}
 
 
 
stop() {
 
    if running; then
 
        echo -n "Stopping the $NAME server... "
 
        kill `cat $PIDFILE`
 
        while running; do
 
            sleep 1
 
        done
 
        rm $PIDFILE
 
        echo "Done"
 
    else
 
        echo "The $NAME server is already stopped."
 
    fi
 
}
 
 
 
case "$1" in
 
    start)
 
        start
 
    ;;
 
    stop)
 
        stop
 
    ;;
 
    restart)
 
stop
 
        start
 
    ;;
 
    status)
 
        if running; then
 
            echo "The $NAME server is started."
 
        else
 
            echo "The $NAME server is stopped."
 
        fi
 
    ;;
 
    *)
 
        echo "Usage: $0 (start|stop|restart|status)"
 
        exit 1
 
esac
 
exit 0
 
</pre>
 
 
 
== iptables rules ==
 
<pre>
 
-A INPUT -i venet0 -p tcp -m tcp --dport 27015 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p tcp -m tcp --dport 27005 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p udp -m udp --dport 27015 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p udp -m udp --dport 27005 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p tcp -m tcp --dport 27016 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p tcp -m tcp --dport 27017 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p tcp -m tcp --dport 27018 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p tcp -m tcp --dport 27019 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p tcp -m tcp --dport 27020 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p udp -m udp --dport 27016 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p udp -m udp --dport 27017 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p udp -m udp --dport 27018 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p udp -m udp --dport 27019 -m state --state NEW,ESTABLISHED -j ACCEPT
 
-A INPUT -i venet0 -p udp -m udp --dport 27020 -m state --state NEW,ESTABLISHED -j ACCEPT
 
</pre>
 
 
 
*Note: may be shortened if you have multiports extension.
 
 
 
== Troubleshooting ==
 
; My server doesn’t show up in the LAN tab of my client’s server browser.
 
; I cannot access my loadout when playing on this server.
 
: Are you still able to connect using <code>[https://developer.valvesoftware.com/wiki/List_of_TF2_console_commands_and_variables#C connect <ip-address>]</code> in the [https://developer.valvesoftware.com/wiki/Console Developer Console]?
 
: During startup, does your server report the following?
 
* Unable to load Steam support library.*
 
* This server will operate in LAN mode only.*
 
: When you connect with your client, does the server say the following?
 
NULL ISteamGameServer in ConnectClient. Steam authentication may fail.
 
 
Cannot verify load for invalid steam ID […]
 
: If so, then both of these problems have the same solution: Make sure you have a <code>steam_app.txt</code> file containing the number <code>440</code> in your <code>orange box</code> folder. See ''[[#Running the server|Running the server]]'', above.
 
 
 
; My server doesn’t auto-update on startup.
 
: When starting up, does your server say the following?
 
WARNING: Failed to locate steam binary.
 
WARNING: Could not locate steam binary:, ignoring.
 
: If so, then you need point <code>srcds_run</code> to the location of your Steam binary, using the <code>-steambin</code> argument. See ''[[#Running the server|Running the server]]'', above.
 
 
 
== Tips ==
 
# The first run of <tt>./steam</tt> may hang while checking the bootstrap version.  You will need to retry several times until it completes.
 
# <tt>server.cfg</tt> goes in <tt>orangebox/tf/cfg</tt>. For more information on configuring your dedicated server, see [[Dedicated server configuration]].
 
# If you want people outside of your network to be able to connect – that is, you’re not just running a LAN server – remember to open ports 27000-27015 to incoming traffic in your firewall .
 
# If you don't have a firewall, get one. Exposing your server to the internet without a firewall is very risky.
 
# Get an error like: "-bash: ./hldsupdatetool.bin: No such file or directory"? If on Debian, try installing lib32gcc1. "apt-get install lib32gcc1"
 
 
 
== See also ==
 
* [[Windows dedicated server]]
 
* [[Dedicated server configuration]]
 
 
 
[[Category: Servers]]
 

Latest revision as of 05:36, 25 October 2021


Introduction

Cet article va traiter autant d'aspects que possible sur l'hébergement serveur Team Fortress 2 sur un Linux.

Cet article a été écrit pour Debian (Jessie).

Valve semble avoir utilisé Ubuntu 12.04 32bits comme leur environnement de développement principal. Cela signifie que si vous utilisez Ubuntu Server 12.04 32bits, vous aurez moins de mauvaises surprises. Vous pouvez bien sûr utiliser une version plus récente d'Ubuntu et qui devrait également être compatible.

Ce guide est écrit avec une distribution basée sur Debian Jessie.

Pré-requis


Assurez-vous que vous remplissez les conditions suivantes avant de commencer:

  • Un utilisateur qui permet d'exécuter le serveur en tant que («valve» est recommandé, avec le répertoire /home/valve)
  • Suffisamment d'espace disque pour le contenu que vous souhaitez installer
  • Un terminal de ligne de commande ouvert en lançant l'utilisateur "valve" (su valve) ou une session SSH avec l'utilisateur "valve" connecté.
  • Une expérience avec l'utilisation de base en ligne de commande sur Linux.


Installationde SteamCMD


Le script suivant va télécharger SteamCMD, extraire et mettre à jour. SteamCMD est nécessaire pour télécharger et mettre à jour Team Fortress 2.

cd ~
mkdir bin
cd bin
wget http://media.steampowered.com/client/steamcmd_linux.tar.gz
tar -xvzf steamcmd_linux.tar.gz
./steamcmd.sh +login anonymous +quit


Installation de Team Fortress 2


Le script suivant va télécharger la dernière version de Team Fortress 2 pour vous avec une seule commande.

Nous utilisons l'éditeur de texte "nano" pour cela, mais vous pouvez utiliser votre propre si vous préférez un autre éditeur.

Tout d'abord, nous allons aller dans répertoire personnel de l'utilisateur.

cd ~


Pour créer le script, utilisez votre outil éditeur de texte préféré. Dans cet exemple, nous utilisons «nano», mais tout autre comme "vi", "vim", "pico" ou "emacs" fonctionnera également.

nano update_tf2.sh


Collez le script suivant dans nano :

update_server() {
	
	 APP_ID=$1
	 DIR=$2
	
	 if ( [ ! -d "$HOME/$DIR" ]; ) then
		 mkdir -p "$HOME/$DIR"
	 fi
	
	 if ( [ ! -d "$HOME/$DIR" ]; ) then
		 echo "ERREUR! Impossible de créer le répertoire $HOME/$DIR!"

		 exit 1
	 fi

	 ./bin/steamcmd.sh +login anonymous +force_install_dir "$HOME/$DIR" +app_update $APP_ID validate +quit
}


update_server 232250 "server_1"


exit 0


Maintenant, nous enregistrer le fichier. Dans nano, enregistrer un fichier se fait en appuyant sur Ctrl + O, suivi par Entrée. Maintenant, nous fermons le dossier en appuyant sur Ctrl + X.

Avant que nous puissions exécuter ce fichier, nous avons besoin de lui donner les droitspour que l'utilisateur puisse l'executer. Cela se fait avec la commande suivante:

chmod + x ./update_tf2.sh


Maintenant, on met à jour le serveur.

./update_tf2.sh 


Le serveur va maintenant télécharger le contenu nécessaire. Steam va vous montrer le pourcentage de progrès qu'il réalise avec le téléchargement.

Démarrage du serveur

La commande ci-dessous démarre le serveur avec 24 slots sur ctf_2fort.

~ /server_1/srcds_run -game tf + maxplayers 24 + carte ctf_2fort

Mise à jour du serveur


Pour mettre à jour le serveur, ou de mettre à jour le contenu du serveur, nous démarerons simplement notre script de mise a jour. Vous devez vous assurer que vos serveurs sont éteints, sinon ls mise à jour échouera.

Mettre à jour le serveur :

./update_tf2.sh


Autre


Binaires 32 bits

Si vous utilisez une version 64 bits de Linux, vous avez besoin de 32 bits binaires, car SteamCMD est uniquement disponible en 32 bits.

Si vous obtenez le message d'erreur suivant :

./steamcmd.sh: ligne 29:home/$ USER/vapeur/linux32/steamcmd: Aucun fichier ou répertoire
Alors vous utilisez probablement un système 64 bits et donc les binaires 32 bits sont manquent.

Pour ce faire, vous devez installer ia32-libs. Pour ce faire, exécutez le code suivant:

dpkg --add-architecture i386
apt-get update
apt-get install ia32-libs