Durch einige Sicherheitslücken in PHP und Node.js werden wir unser Webspace Server auf die aktuellste Version Updaten. In der zeit kann es zu ausfällen kommen!
← Back to all tutorials

Set up a FiveM server

Your own GTA V roleplay or freeroam server with FiveM: get a license key, understand server.cfg, add resources and configure OneSync. The base installation with a txAdmin recipe is covered in the txAdmin guide – this one is about what comes next.

8 min read · Last reviewed: October 2026

Requirements

  • A Cfx.re account (same login as the FiveM forum)
  • A server running FXServer – rented or self-hosted (Linux or Windows)
  • For frameworks such as ESX or QBCore: a MySQL/MariaDB database
  • Basic experience editing text files

Step 1: Create a license key

Every FiveM server needs its own license key. It's free and is created in the Cfx.re portal – the old address keymaster.fivem.net now redirects there.

  1. Log in to portal.cfx.re with your Cfx.re account.
  2. Create a new key in the server license keys section.
  3. Enter your server's public IP and a name.
  4. Copy the key and treat it like a password.

At AvantaHost you enter the key when ordering. If you don't have it yet, you can submit it later in the dashboard on the order – the server is set up right after. In the server panel it's the startup variable FIVEM_LICENSE in the Startup tab („Start“), where you can also replace it. Changes apply on the next start.

Never share the key: Anyone holding your key can use it on their own server – and rule violations fall back on your account. Don't push a server.cfg containing the key to GitHub.

Step 2: Understand server.cfg

server.cfg is the central configuration. It lives in the server data folder next to the resources folder. A lean baseline looks like this:

server.cfg
# Network: player port (TCP and UDP)
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

# Default resources
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap

# Server list display
sv_hostname "My FiveM Server"
sets sv_projectName "My Project"
sets sv_projectDesc "A short description of your server"
sets tags "roleplay, english"
sets locale "en-US"

# Slots (up to 48 without a subscription)
sv_maxclients 48

# Steam Web API key, if resources need Steam IDs
set steam_webApiKey ""

# License key
sv_licenseKey "YOUR_KEY"
  • endpoint_add_tcp/udp: port 30120 is the default. On rented servers this has to be the port you were assigned – at AvantaHost the primary allocation in the Network tab. Don't change it on your own.
  • sv_maxclients: FiveM is free up to 48 slots. More needs a subscription in the Cfx.re portal (from “Element Club Argentum”). More than 32 slots require OneSync.
  • sets locale: templates often ship with root-AQ – replace it with a real locale such as en-US.
  • sv_licenseKey: hosts with a startup variable often set this automatically. If you see a placeholder there, don't overwrite it by hand as long as the server starts.

In the AvantaHost panel you edit the file in the browser in the Files tab. With txAdmin running you can also use the CFG Editor in the txAdmin menu.

Step 3: Install resources

Everything your server does – jobs, cars, maps, menus – is a resource: a folder containing an fxmanifest.lua.

  1. Download the resource (preferably from GitHub or the Cfx.re forum) and extract it.
  2. Upload the folder to resources/. Folders in square brackets such as [cars] are categories and may contain further resources.
  3. Make sure fxmanifest.lua sits directly inside the resource folder – not one level deeper (a classic mistake with GitHub ZIPs containing folders like name-main/name/).
  4. Add a line ensure resourcename to server.cfg. The name is the folder name.
  5. Restart the server.
server.cfg – order matters
# Dependencies first
ensure oxmysql
ensure ox_lib

# then framework and scripts
ensure [core]
ensure [standalone]

For testing without a restart there are console commands: refresh rescans the resources folder, ensure name starts or restarts a resource, stop name stops it. For permanent use, the ensure line still belongs in server.cfg.

Trusted sources only: “Leaked” paid scripts often contain backdoors (usually obfuscated code that loads files from foreign servers). Escrow-protected scripts also only work with the buyer's key.

Step 4: Connect a database (ESX, QBCore)

Frameworks such as ESX Legacy and QBCore store players, inventories and vehicles in MySQL/MariaDB. The connection almost always runs through oxmysql.

In the AvantaHost panel you create the database in the Databases tab, which shows host, user and password. Then add this to server.cfg, before ensure oxmysql:

server.cfg
set mysql_connection_string "mysql://USER:PASSWORD@HOST:3306/DATABASE?charset=utf8mb4"

Frameworks don't always create their tables themselves. Usually there's a .sql file to import once. If you deploy the server with a txAdmin recipe, the deployer asks for the database details and runs the import.

Step 5: Configure OneSync

OneSync is FiveM's server-side synchronisation. Without it, clients talk to each other peer-to-peer; with it, the server knows the state of every player and vehicle. Modern frameworks require it.

ModeWhen
onRecommended. Full server-side state awareness; up to 2048 slots with a subscription (formerly “OneSync Infinity”).
legacyOnly for very old scripts that expect every player on every client. Not recommended.
offOnly for small servers without OneSync-dependent scripts, max 32 slots.

With txAdmin you set OneSync under Settings → FXServer (“Advanced” section, option “OneSync: On (recommended)”). Don't set it in server.cfg as well then. Without txAdmin, put set onesync on in server.cfg.

Step 6: Connect and test

Start FiveM, press F8 and connect directly:

connect 203.0.113.10:30120

A domain works too: use the free avantahost.de subdomain from the network tab together with the port, e.g. connect yourserver.avantahost.de:30120. Your server appears in the public server list with the name from sv_hostname, unless you made it private.

Common errors

MessageCause and fix
Couldn't find resource nameFolder name and ensure line don't match, or fxmanifest.lua sits one level too deep.
Server license key authentication failedKey wrong, deleted or created for a different IP. Check it in the portal and set it again.
Failed to start in timeA resource takes too long to start (often an unreachable database). Increase “Resource Starting Tolerance” in txAdmin and check the database connection.
oxmysql: Access denied / ECONNREFUSEDUser, password or host in the connection string is wrong.
Players can't see each otherOneSync is off or set to legacy while scripts expect on.

FiveM hosting with txAdmin

At AvantaHost txAdmin is set up out of the box with its own port, and you create databases in the panel. You bring your own Cfx.re key – it stays tied to your account.

View FiveM packages