Datafex LogoDatafex
All guides

14 September 2026 · 3 min read

How to set up a FiveM server: a step-by-step guide

This guide takes you from nothing to a working FiveM server: choosing an operating system, the database, opening ports and the mistakes most often made on first boot. It assumes ESX or QBCore as the framework, because almost every roleplay server uses one of the two.

Before you start

1. Operating system

Choose Ubuntu 22.04 LTS or Debian 12. CitizenFX's official Linux artifacts are tested against these distributions; on anything else, library version mismatches will cost you time.

Windows works too, but you get more out of the same hardware on Linux and artifact updates go more smoothly.

2. Installing FXServer with txAdmin

Use txAdmin rather than installing FXServer by hand. txAdmin gives you artifact management, automatic restarts, backups and a live console in one place; with a manual install you have to build all of that yourself.

Order of operations:

  1. Download and extract the artifact (fx.tar.xz).
  2. Start it with run.sh; on first boot txAdmin prints a setup link and a one-time PIN.
  3. Open that link in a browser and create the administrator account.
  4. At the Recipe step, pick the ESX or QBCore template; txAdmin downloads the server files and database schema itself.
  5. Enter your keymaster key in sv_licenseKey.

3. Database

Install MariaDB on the same machine. A separate server only becomes worthwhile past roughly 200 concurrent players; before that, network latency gives a worse result than a local socket.

apt install mariadb-server
mysql_secure_installation

Then import the framework's database dump and set the connection string in server.cfg:

set mysql_connection_string "mysql://user:password@localhost/database?charset=utf8mb4"

Do not skip the `utf8mb4` character set. Non-ASCII characters and emoji break under utf8, and fixing it later means converting every table.

4. Ports

FiveM runs on a single port, but it needs both TCP and UDP:

PortProtocolPurpose
30120TCP + UDPGame traffic and server listing
40120TCPtxAdmin panel (open to your own IP only)

Exposing the txAdmin port to everyone is a common and serious mistake — that panel is full control of your server. Allow only your own IP address in the firewall.

If you are on Datafex, port management and extra IP requests are handled from the customer panel.

5. Resource load order

The order of ensure lines in server.cfg matters. Framework core, then the database layer, then dependent resources:

ensure oxmysql
ensure es_extended      # or qb-core
ensure [framework resources]
ensure [your custom resources]

When the order is wrong you see "resource not found" or an empty error stack in the console; the resource does exist, it just has not loaded yet.

The six most common first-boot mistakes

  1. `sv_licenseKey` empty or bound to a different IP. The server starts but never appears in the list.
  2. `utf8` instead of `utf8mb4`. Non-ASCII characters turn into question marks.
  3. Only TCP open on 30120. Players see the server in the list but cannot connect.
  4. A large stream folder with no pinned load order. First boot can take minutes because of asset indexing; do not interrupt it.
  5. txAdmin port open to the world. The moment that panel is reachable from outside, the server is not yours.
  6. No backups. The database is the roleplay server; if player progress is corrupted, restoring is the only route.

On the DDoS side

FiveM servers are frequently hit by floods on 30120 UDP, and because source addresses can be forged in UDP, this cannot be solved at the application layer — it has to be filtered at the network layer. We covered the topic separately: what is DDoS protection?

On Datafex servers, Fexwall L3/L4 filtering is included free on every plan.

Next step

We have put the plan recommendations by player count, the processor options and a 12-question FiveM-specific FAQ on one page: FiveM server plans.

If you want to act on what is in this guide:

See recommended server plans for FiveM

Related guides