> For the complete documentation index, see [llms.txt](https://studycorp.gitbook.io/studycorp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://studycorp.gitbook.io/studycorp/vps/installer-un-serveur-fivem.md).

# Installer un serveur FiveM

Prérequis : Avoir un VPS / Serveur dédié fonctionnel.

## Installation

La première étape est de mettre à jour votre VPS/Dédié à l'aide de la commande suivante

```
apt update && apt upgrade
```

Rendez vous ensuite dans le dossier qui contiendra votre serveur, par exemple /home/serveurfivem/.\
\
Vous devez télécharger le script d'installation de FiveM. Rendez vous sur <https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/>. \
Choisissez la version que vous souhaitez et faites clic droit + copier le lien. Vous devriez avoir un lien se terminant par .tar.xz

```
wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/5090-dedb7b5fc18ebf891c6fb9458e67541a501176c5/fx.tar.xz
```

Il faut ensuite extraire l'archive avec la commande suivante

```
apt install xz-utils && tar xvfJ fx.tar.xz && rm fx.tar.xz
```

Vous devrez ensuite installer CitizenFX avec la commande

```
apt install git -y && git clone https://github.com/citizenfx/cfx-server-data.git server-data
```

## Configuration & Démarrage

Nous allons créer le fichier de configuration de votre serveur FiveM. Utilisez la commande suivante...

```
nano server.cfg
```

... et copiez la configuration par défaut du server.cfg

> ```
> # Only change the IP if you're using a server with multiple network interfaces, otherwise change the port only.
> endpoint_add_tcp "0.0.0.0:30120"
> endpoint_add_udp "0.0.0.0:30120"
>
> # These resources will start by default.
> ensure mapmanager
> ensure chat
> ensure spawnmanager
> ensure sessionmanager
> ensure basic-gamemode
> ensure hardcap
> ensure rconlog
>
> # This allows players to use scripthook-based plugins such as the legacy Lambda Menu.
> # Set this to 1 to allow scripthook. Do note that this does _not_ guarantee players won't be able to use external plugins.
> sv_scriptHookAllowed 0
>
> # Uncomment this and set a password to enable RCON. Make sure to change the password - it should look like rcon_password "YOURPASSWORD"
> #rcon_password ""
>
> # A comma-separated list of tags for your server.
> # For example:
> # - sets tags "drifting, cars, racing"
> # Or:
> # - sets tags "roleplay, military, tanks"
> sets tags "default"
>
> # A valid locale identifier for your server's primary language.
> # For example "en-US", "fr-CA", "nl-NL", "de-DE", "en-GB", "pt-BR"
> sets locale "root-AQ" 
> # please DO replace root-AQ on the line ABOVE with a real language! :)
>
> # Set an optional server info and connecting banner image url.
> # Size doesn't matter, any banner sized image will be fine.
> #sets banner_detail "https://url.to/image.png"
> #sets banner_connecting "https://url.to/image.png"
>
> # Set your server's hostname
> sv_hostname "FXServer, but unconfigured"
>
> # Nested configs!
> #exec server_internal.cfg
>
> # Loading a server icon (96x96 PNG file)
> #load_server_icon myLogo.png
>
> # convars which can be used in scripts
> set temp_convar "hey world!"
>
> # Remove the `#` from the below line if you do not want your server to be listed in the server browser.
> # Do not edit it if you *do* want your server listed.
> #sv_master1 ""
>
> # Add system admins
> add_ace group.admin command allow # allow all commands
> add_ace group.admin command.quit deny # but don't allow quit
> add_principal identifier.fivem:1 group.admin # add the admin to the group
>
> # enable OneSync (required for server-side state awareness)
> set onesync on
>
> # Server player slot limit (see https://fivem.net/server-hosting for limits)
> sv_maxclients 48
>
> # Steam Web API key, if you want to use Steam authentication (https://steamcommunity.com/dev/apikey)
> # -> replace "" with the key
> set steam_webApiKey ""
>
> # License key for your server (https://keymaster.fivem.net)
> sv_licenseKey changeme
> ```

Vous devez le modifier la dernière ligne "sv\_licenceKey" en générant une clé sur le lien <https://keymaster.fivem.net/>

## Démarrage

Pour lancer le serveur, allez dans le dossier où se situe le fichier run.sh et utilisez la commande suivante

```
./run.sh server.cfg
```

Ouvrez votre navigateur et naviguez vers l'ip de votre vps ainsi que le port 40120. Par exemple 158.125.52.65:40120

Vous pourrez configurer la base de votre serveur, utiliser des templates pré-existant, connecter une base de donnée, etc...&#x20;

## Connexion au serveur

{% hint style="success" %}
Pour vous connecter, lancez FiveM et appuyez sur la touche F8 et entrez "connect \<votreIP>"&#x20;
{% endhint %}
