Running your own FiveM server is the difference between renting a slice of someone else’s roleplay world and owning the whole city. A self-hosted FiveM server gives you root over the framework, the economy, the anti-cheat, the player data, and every line of the server.cfg — and since Cfx.re (the team behind FiveM and RedM) officially joined Rockstar Games on 11 August 2023, self-hosting a GTA V roleplay server is fully publisher-sanctioned rather than a legal grey area.
This tutorial walks through a complete, production-grade FiveM server build in 12 numbered steps. You will download the FXServer artifacts, wire up txAdmin, provision a MariaDB database, deploy an ESX or QBCore framework recipe, enable OneSync for high player counts, open exactly the right ports, and — because this is a security publication — lock the whole thing down with a non-root service user, a firewall, and a private admin panel. The core install genuinely takes about 30 minutes on a fresh Linux box; the hardening and framework tuning are where a serious GTA RP server earns its reputation.
Everything below was tested against the current Cfx.re documentation and the FiveM artifacts pipeline in June 2026. Where the FiveM ecosystem moves fast — build numbers, framework versions, OneSync tiers — this guide tells you how to fetch the live value yourself rather than hardcoding a number that will be stale next week.
What Is a FiveM Server, and Why Self-Host One?
FiveM is the most widely used multiplayer modification for Grand Theft Auto V, allowing players to join custom servers that run their own game modes, maps, scripts, and roleplay economies instead of Rockstar’s official GTA Online. A FiveM server is the dedicated process — FXServer — that hosts one of those worlds. When you host it yourself, you control the framework (ESX, QBCore, or QBox), the resources loaded on boot, the database schema, and the moderation tooling.
The self-hosting model has three big advantages over paying a managed host or renting a slot on a public community. First, cost: a modest virtual private server can run a 48-slot roleplay community for the price of a couple of takeaway coffees a month. Second, control: you decide the anti-cheat policy, the backup schedule, and who holds admin. Third, data ownership — a genuine concern on a security site, because a GTA RP server routinely collects Discord IDs, IP addresses, and connection logs that fall squarely under the GDPR when your players are in the EU.
Grand Theft Auto V is one of the best-selling video games ever made, with more than 200 million units shipped according to publisher Take-Two Interactive, and FiveM is the engine behind the roleplay boom that has kept an eleven-year-old game near the top of the streaming charts. That popularity is exactly why the fivem server keyword sees so much search traffic — and why getting the setup right, securely, matters. The official Cfx.re server manual is the canonical reference; this guide layers a hardened, Linux-first workflow on top of it.
What You’ll Build: A Complete GTA RP Project
By the end of this walkthrough you will have a complete, restartable, internet-facing FiveM server with the following components working together:
- FXServer running from the current Recommended FiveM server artifacts, supervised by systemd so it survives reboots and crashes.
- txAdmin — the bundled web management panel — reachable only through an SSH tunnel, never exposed to the public internet.
- MariaDB holding your framework’s character, inventory, and economy tables, accessed through the
oxmysqlconnector. - An ESX Legacy (or QBCore/QBox) framework deployed via a txAdmin recipe, giving you jobs, money, and inventory out of the box.
- OneSync enabled so the server can scale past the legacy 32-player ceiling.
- A UFW firewall, a dedicated non-root service account, and automated database backups.
That is a real, working GTA V roleplay server — the same architecture that community servers with hundreds of players run in production, minus the paid slot expansion. Let’s provision it.
Prerequisites and System Requirements
FiveM’s game logic is inherited from GTA V, which is heavily single-threaded. That single fact shapes every hardware decision: high per-core clock speed matters far more than raw core count. A four-vCPU VPS with a fast modern core will comfortably out-perform a cheap eight-vCPU box built from low-clock cores. Do not let a hosting provider sell you “more vCPUs” as if they were interchangeable.
Minimum and Recommended Specs
| Component | Minimum (small RP, up to 32 slots) | Recommended (48–64 slots, ESX/QBCore) |
|---|---|---|
| CPU | 2 dedicated vCPU, high clock (3.5 GHz+ single-core) | 4+ dedicated vCPU, 4.0 GHz+ single-core boost |
| RAM | 4 GB | 8–16 GB |
| Storage | 30 GB SSD | 60 GB+ NVMe SSD |
| OS | Ubuntu 22.04 LTS / Debian 12 | Ubuntu 24.04 LTS |
| Network | 1 Gbps port, 1 TB+ transfer | 1 Gbps unmetered |
| Database | MariaDB 10.6+ or MySQL 8 | MariaDB 11.x |
Software and Accounts You Need First
- A legitimate PC copy of GTA V (Steam, Epic Games Store, or Rockstar Games Launcher). Every player who connects also needs a legal copy — pirated installs fail Cfx.re’s ownership verification. The host machine itself does not need GTA V installed, but you do to test as a client.
- A Cfx.re account, used both for your free server license key and to authenticate as a txAdmin administrator.
- A Linux server with root or sudo access. This guide uses Ubuntu 24.04 LTS; commands adapt trivially to Debian.
- Basic comfort with SSH and the Linux command line. If you can run
sudo apt update, you can finish this guide. git,wget,tar, andxz-utils— installed in Step 1.
FiveM Server Hosting: Self-Host vs Managed
Before you provision anything, decide how you want to run the box. There are two legitimate paths to FiveM server hosting, and the right answer depends on how much control and responsibility you want.
| Factor | Self-hosted VPS (this guide) | Managed FiveM host |
|---|---|---|
| Typical monthly cost | $6–$25 for a capable VPS | $10–$40 per configured slot package |
| Root / OS access | Full | Usually none or limited panel |
| Artifact & framework updates | You run them | Often one-click or automatic |
| Security hardening | Your responsibility | Partially handled by provider |
| Data ownership / GDPR control | Complete | Shared with the host |
| Learning value | High — you understand every layer | Low — abstracted away |
A managed FiveM server hosting plan is fine if you never want to touch a terminal, but you trade away control and pay a premium per slot. This tutorial takes the self-hosted route because it teaches you the full stack and keeps your player data under your own roof. The skills transfer directly to the sibling game-server guides in our gaming coverage — Minecraft, Valheim, ARK, Palworld and the rest all follow the same provision-secure-configure rhythm.
Step 1 — Provision and Update Your Linux Server
Spin up a fresh Ubuntu 24.04 LTS VPS from any reputable provider and log in over SSH as root or a sudo user. The first job on any new box is to patch it and install the handful of utilities the FiveM install needs.
# Update the package index and upgrade everything
sudo apt update && sudo apt upgrade -y
# Tools we need to fetch and extract the FiveM artifacts
sudo apt install -y wget curl git xz-utils tar ufw
# Confirm the OS version
lsb_release -a
Set the server’s timezone while you are here — scheduled restarts and log timestamps will thank you later:
sudo timedatectl set-timezone UTC
A patched, minimal base image is the foundation of every other security decision in this guide. Do not skip the upgrade step; unpatched kernels and OpenSSL builds are the low-hanging fruit attackers scan for.
Step 2 — Create a Non-Root Service User and Lock Down SSH
Never run a public game server as root. If a malicious resource or a compromised script escapes the FXServer process, you want the blast radius contained to an unprivileged account. Create a dedicated fivem user that will own the server files and run the process.
# Create the service account with its own home directory
sudo adduser --disabled-password --gecos "" fivem
# Give it sudo only if you want to administer from this account (optional)
# sudo usermod -aG sudo fivem
# Switch into the account for the rest of the install
sudo su - fivem
Back in your root/admin session, harden SSH itself. Use key-based authentication and disable password logins so credential-stuffing bots get nowhere. Edit /etc/ssh/sshd_config:
# /etc/ssh/sshd_config — recommended hardening
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
X11Forwarding no
# Apply the changes
sudo systemctl restart ssh
Make sure you have already copied your public key with ssh-copy-id before you disable passwords, or you will lock yourself out. This non-root, key-only posture mirrors the hardening approach we apply to every server build, including our Palworld dedicated server and Project Zomboid server guides.
Step 3 — Get Your Free Cfx.re License Key
Every FiveM server needs a license key to boot, authenticate with the Cfx.re platform, and appear in the server list. The key is completely free. Generate it from the Cfx.re Portal (portal.cfx.re — this superseded the old keymaster.fivem.net address, though you may still see the legacy URL in older guides).
- Log in at
portal.cfx.rewith your Cfx.re account. - Open the Server Keys section and click New Server Key.
- Enter your server’s public IP (or a wildcard for a dynamic IP) and a label.
- Copy the generated key. It looks like a long alphanumeric string beginning with
cfxk_.
Treat this key like a password. It is tied to your account, and if you leak it — by pasting a full server.cfg into a public Discord, for example — Cfx.re can revoke it and your server will stop authenticating. We will place it into server.cfg as sv_licenseKey in Step 6, and later show you how to keep it out of version control entirely.
Step 4 — Download the FiveM Server Artifacts
FiveM does not use SteamCMD. Instead, the server software — FXServer — is distributed as versioned artifacts, each named with a build number and a hash (for example 12345-abcdef…). New builds ship almost weekly, so the single most important rule of FiveM server artifacts is: use the “Recommended” build, never the “Latest,” and never hardcode a build number into a script. The Recommended column has been through community testing; Latest is the bleeding edge and will occasionally break resources.
Open the Linux artifacts index in a browser to find the current Recommended build hash: runtime.fivem.net/artifacts/fivem/build_proot_linux/master/. Copy the URL of the fx.tar.xz under the Recommended build, then download and extract it as the fivem user.
# As the fivem user
mkdir -p ~/FXServer/server
cd ~/FXServer/server
# Replace BUILD-HASH with the current Recommended build from the artifacts page.
# Do NOT copy an old hash from a tutorial — always grab the live one.
wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/BUILD-HASH/fx.tar.xz
# Extract the artifact
tar xf fx.tar.xz
# Clean up the archive
rm fx.tar.xz
# Confirm the run script is present
ls -l run.sh
Since FiveM artifact build 3281 and newer, txAdmin ships pre-installed inside the artifacts — there is nothing separate to download. The run.sh you just listed is your single entry point for both txAdmin and the game server.
Step 5 — Install and Secure MariaDB
ESX, QBCore, and QBox all persist characters, inventories, and money to a SQL database. Install MariaDB, run the security script, and create a dedicated database and user for FiveM. Do this from your sudo account (not the fivem user).
# Install the database server
sudo apt install -y mariadb-server
# Run the interactive hardening wizard:
# set a root password, remove anonymous users, disallow
# remote root login, and drop the test database.
sudo mysql_secure_installation
Now create the FiveM database and a least-privilege user. Note the utf8mb4 character set — this is not optional. Without it, accented characters and emoji in player names and chat get mangled into strings like “é”, a bug that plagues servers with international communities.
sudo mariadb -u root -p
-- Inside the MariaDB shell
CREATE DATABASE fivem CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'CHANGE_ME_TO_A_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON fivem.* TO 'fivem'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Notice the user is scoped to 'fivem'@'localhost' and granted rights only on the fivem database — never grant a game-server database account global privileges, and never bind MariaDB to a public interface. The database should be reachable only from the local machine.
Step 6 — Clone the Server Data and Configure server.cfg
Keep the engine (the artifacts you extracted in Step 4) separate from your configuration and resources. This separation means you can drop in a newer artifact later without touching a single line of your server config. Cfx.re publishes a starter cfx-server-data repository for exactly this purpose.
# As the fivem user, next to the server engine folder
cd ~/FXServer
git clone https://github.com/citizenfx/cfx-server-data.git server-data
cd server-data
Create your server.cfg in the server-data folder. Below is a minimal but complete configuration. It binds the game port, sets a slot count, enables OneSync, wires in the database connection string, and — critically — loads oxmysql before any framework that depends on it.
# ~/FXServer/server-data/server.cfg
# --- Network endpoints (game traffic) ---
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
# --- Server identity ---
sv_hostname "Shattered RP | Serious GTA V Roleplay"
sets sv_projectName "Shattered RP"
sets sv_projectDesc "Whitelisted economy roleplay"
sets locale "en-US"
# --- Slots & state sync ---
sv_maxclients 48
set onesync on
# --- Database (oxmysql reads this) ---
set mysql_connection_string "mysql://fivem:CHANGE_ME_TO_A_STRONG_PASSWORD@localhost/fivem?charset=utf8mb4"
# --- Core resources ---
ensure oxmysql
ensure es_extended # swap for qbx_core if you chose QBox
# --- License key (keep this secret) ---
sv_licenseKey "cfxk_your_key_here"
The ensure oxmysql line must appear before ensure es_extended. If a framework starts before its database connector, you will hit the classic error no such export execute in resource oxmysql — a wrong-order symptom, not a broken install. Grab the connector itself from the oxmysql repository and place it in your resources folder before first boot.
Step 7 — First Boot with txAdmin
You now have an engine, a database, and a config. Time to boot. Run run.sh; it launches txAdmin, the web-based management panel bundled with the artifacts and maintained by developer Tabarra. On first run, txAdmin prints a one-time PIN and a local URL.
# As the fivem user
cd ~/FXServer/server
bash run.sh
Example console output on first launch:
[txAdmin] Starting txAdmin version 7.x.x
[txAdmin] Web panel is now available at:
[txAdmin] http://your.server.ip:40120/
[txAdmin] Use the PIN below to register the master account:
[txAdmin] PIN: 4821
[txAdmin] To reset: delete txData/admins.json
txAdmin listens on port 40120. Do not open that port on your firewall. Instead, reach it securely from your own machine through an SSH tunnel, so the admin panel is never exposed to the public internet:
# Run this on YOUR local computer, not the server
ssh -L 40120:localhost:40120 [email protected]
# Now browse to http://localhost:40120 on your local machine
With the tunnel up, open http://localhost:40120, enter the PIN, and create your master admin account. txAdmin will then ask you to link your Cfx.re account (used for admin identity) and walk you through a setup wizard. The official txAdmin setup docs mirror this flow.
Step 8 — Deploy a Framework Recipe (ESX, QBCore, or QBox)
A bare FiveM server is an empty map with no jobs, money, or inventory. A framework supplies that roleplay skeleton. txAdmin’s recipe deployer automates roughly 90% of a framework install: it downloads the resources, imports the SQL, and writes the resource list for you. In the wizard, choose one of these recipes.
| Framework | Best for | Notes | Repository |
|---|---|---|---|
| ESX Legacy | Beginners, huge script ecosystem | Oldest and most widely used; the largest catalogue of free and paid scripts targets ESX | esx-framework/esx_core |
| QBCore | Modern modular roleplay | Cleaner, more modular design; very popular for serious RP communities | qbcore-framework |
| QBox | Actively maintained QBCore fork | Community-maintained continuation of QBCore with fixes and modern tooling | Qbox-project/qbx_core |
| CFX Default | Learning the plumbing | Vanilla Cfx.re resources, no economy — boots instantly, no database needed | citizenfx/cfx-server-data |
Pick one framework and commit to it. The single most common rookie mistake is mixing ESX scripts and QBCore scripts in the same server without a compatibility bridge; they use different events and database schemas, and the result is a cascade of errors on boot. ESX Legacy is the safest first choice because its documentation and free-script ecosystem are the deepest — you can pull the core from the esx_core repository, and QBox users can start from qbx_core.
Verifying the Recipe Imported Cleanly
After the recipe runs, txAdmin restarts the server. Watch the live console for the database handshake. A healthy boot looks like this:
[ script:oxmysql] Database server connection established!
[ script:es_extended] ESX Legacy has started.
[ script:txAdmin] FXServer is now running.
Server license key authentication succeeded.
If you see the license line succeed and oxmysql connect, your framework is live and persisting to MariaDB. If the license fails, jump to the troubleshooting table below.
Step 9 — Configure OneSync and Player Slots
OneSync is the server-side state-synchronization layer that lifts FiveM past its legacy player ceiling. It matters the moment you want more than 32 concurrent players. Here is exactly how the tiers map to slot counts.
| Mode | server.cfg | Max players | Cost |
|---|---|---|---|
| OneSync off | set onesync off | 32 | Free |
| OneSync (legacy) | set onesync legacy | 64 | Free |
| OneSync Infinity | set onesync on + onesync_enableInfinity 1 | 128–2048 (CPU-bound) | Free up to 48 slots |
Two rules govern sv_maxclients. First, it should be a power of two — 32, 64, 128, 256 — for clean slot allocation. Second, Cfx.re lets you run OneSync for free up to 48 slots. Beyond 48, your license key needs a paid Cfx.re Element Club (Argentum tier or higher) subscription, or the server will fail its heartbeat check and refuse to advertise. If you are learning, set sv_maxclients 48 and stay entirely within the free tier. The OneSync reference and the Infinity announcement thread document the convars in full.
Remember the hardware corollary from the prerequisites: pushing toward 128 players is a single-thread CPU problem long before it is a RAM problem. A server that stutters at 60 players almost always needs a faster core, not more of them.
Step 10 — Open the Firewall and the Right Ports
FiveM needs exactly one port open to the public: 30120, on both TCP and UDP. Everything else — the txAdmin panel, the database — must stay private. Configure UFW to allow SSH and the game port, then enable it.
# Allow SSH first so you don't lock yourself out
sudo ufw allow OpenSSH
# Allow the FiveM game port (TCP + UDP)
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
# Enable the firewall
sudo ufw enable
# Confirm the rule set
sudo ufw status verbose
Here is the complete port map for a hardened FiveM server. Note what is deliberately not public.
| Port | Protocol | Service | Exposure |
|---|---|---|---|
| 30120 | TCP + UDP | FiveM game traffic | Public |
| 22 | TCP | SSH (admin) | Public, key-only |
| 40120 | TCP | txAdmin web panel | Private — SSH tunnel only |
| 3306 | TCP | MariaDB | Private — localhost only |
If your VPS provider also has a network-level firewall or security group in its control panel, mirror these rules there too. Exposing 40120 or 3306 to the internet is one of the most common — and most dangerous — FiveM misconfigurations.
Step 11 — Run FiveM as a systemd Service
Running run.sh in an SSH session is fine for testing, but the moment you disconnect, the server dies. For production, supervise the process with systemd so it starts on boot and restarts after a crash. Create a unit file as your sudo user.
sudo nano /etc/systemd/system/fivem.service
[Unit]
Description=FiveM FXServer (txAdmin)
After=network.target mariadb.service
[Service]
Type=simple
User=fivem
WorkingDirectory=/home/fivem/FXServer/server-data
ExecStart=/home/fivem/FXServer/server/run.sh +exec server.cfg
Restart=on-failure
RestartSec=10
# Optional: cap file descriptors for high player counts
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
# Reload systemd, enable at boot, and start
sudo systemctl daemon-reload
sudo systemctl enable fivem
sudo systemctl start fivem
# Watch the live log
sudo journalctl -u fivem -f
One important nuance: let systemd supervise the top-level process (run.sh / txAdmin), and let txAdmin handle scheduled in-game restarts of the FXServer child from its own scheduler. Do not configure both systemd and txAdmin to restart the same process on a timer — they will fight over the PID. Systemd keeps the panel alive; txAdmin restarts the game world every few hours to clear memory. That division of labour is the clean, conflict-free pattern.
Step 12 — Verify, Connect, and Go Live
Your FiveM server is running under systemd, firewalled, and framework-loaded. Time to connect as a player and confirm the world is real. Launch the FiveM client on a PC that owns GTA V, press F8 to open the console, and direct-connect to your server’s IP.
# In the FiveM client F8 console
connect your.server.ip:30120
# Or, if you kept the default port
connect your.server.ip
On a healthy server, the client downloads your resource manifest, spawns you into the map, and the server console logs the join:
[ script:monitor] [ESX] Player 'Marcus' has been loaded (id: 1)
[ c-scripting-core] Started resource es_extended
[ citizen-server-impl] Player Marcus connected (netid 1) from 203.0.113.44
To let friends in, share your public IP and port, or list the server publicly by leaving sv_master1 at its default so it advertises to the FiveM server browser. That is a complete, working GTA V roleplay server — provisioned, secured, and live. The remaining sections turn a working server into a resilient one.
Hardening Your FiveM Server: Security Best Practices
A public game server is a public attack surface. Roleplay communities are targeted for DDoS extortion, database theft (all those player emails and Discord IDs), and admin-panel takeover. As a security publication, this is the section we would not let you skip. You have already done the two biggest things — a non-root user and a private txAdmin panel. Layer these on top.
Install fail2ban to Blunt SSH Brute-Force
# Automatically ban IPs that fail SSH auth repeatedly
sudo apt install -y fail2ban
sudo systemctl enable --now fail2ban
# Confirm the SSH jail is active
sudo fail2ban-client status sshd
Keep Secrets Out of Version Control
If you track your server-data folder in git — and you should, for resource management — never commit your license key or database password. Move them into a server_secret.cfg that is listed in .gitignore, and pull it in from server.cfg:
# In server.cfg, replace inline secrets with:
exec server_secret.cfg
# In .gitignore
server_secret.cfg
Automate Database Backups
Your MariaDB database is your community — every character, vehicle, and bank balance. Schedule a nightly dump with a cron job and rotate old copies:
# crontab -e (as the fivem user)
# Nightly backup at 04:00, keep 7 days
0 4 * * * mariadb-dump -u fivem -p'YOUR_PASSWORD' fivem | gzip > ~/backups/fivem-$(date +\%F).sql.gz
0 5 * * * find ~/backups -name 'fivem-*.sql.gz' -mtime +7 -delete
Test a restore before you need one — an untested backup is a hope, not a plan. These are the same fundamentals we cover in our broader data-breach prevention and credential-hygiene guidance; a game server is just another database with a public front door.
Adding Resources and Scripts Safely
Resources are how you extend a FiveM server — jobs, vehicles, custom UIs, dispatch systems, and more. Each resource is a folder inside server-data/resources containing an fxmanifest.lua that declares its scripts and dependencies. To load one, drop the folder in place and add an ensure line to server.cfg. Order matters: dependencies (like oxmysql and your framework) must be ensured before the resources that call them.
# server.cfg — resource load order matters
ensure oxmysql # database connector first
ensure es_extended # framework second
ensure esx_menu_default # framework dependencies
ensure my_custom_job # your resources last
Where you get scripts is a security decision as much as a feature decision. Stick to the official Cfx.re server-data resources, reputable open-source projects on GitHub, and paid scripts bought directly from their creators via Tebex. Never install “leaked” or cracked paid resources circulated on sketchy forums — they are a classic vector for backdoors that exfiltrate your database or hand an attacker admin over your server. A single obfuscated Lua file with an outbound HTTP call can quietly siphon every character record you own.
- Read the manifest. Before you
ensureanything, open itsfxmanifest.luaand skim the Lua for outboundPerformHttpRequestcalls to domains you do not recognise. - Test on staging. New resources go on your staging server (see Advanced Tips) before they ever touch players.
- Prefer
ensureoverstart.ensurestarts a resource and restarts it if its files change, which is the modern, safer convention. - Watch for silent failures. A resource that errors on boot prints a stack trace to the console — do not ignore red text just because the server still starts.
Performance Tuning for GTA RP at Scale
Once players arrive, the difference between a smooth server and a stuttering one is almost always resource discipline, not hardware alone. FiveM exposes a live performance picture in the txAdmin console and via the resmon command in the client F8 console, which shows each resource’s CPU time in milliseconds per tick.
- Audit resource ms. Any single resource consuming more than 1.0 ms per tick at idle is a red flag. Bloated map or vehicle packs are the usual culprits.
- Prefer
ensureoverstartinserver.cfg, and comment out resources you are not actively using. Every loaded resource costs tick time. - Right-size the box for single-thread. As covered above, per-core clock speed is the dominant factor. Benchmark your chosen VPS core before committing to a slot expansion.
- Schedule restarts. Configure a txAdmin scheduled restart every 6–12 hours to clear accumulated memory and stale entities.
- Cap what you can. Set
LimitNOFILEin the systemd unit (shown in Step 11) so high player counts do not exhaust file descriptors.
Treat every added script as a performance liability until proven otherwise. The most common cause of a laggy GTA RP server is not player count — it is fifty poorly written free scripts each burning a fraction of a millisecond that adds up to a blown frame budget.
Legal, GDPR, and Monetization Rules You Must Follow
Running a public community is not just a technical exercise; Cfx.re’s platform policy and data-protection law both apply. Get these wrong and you risk a revoked license key or a regulator’s letter.
- No pay-to-win. Cfx.re policy prohibits selling in-game advantages. The only sanctioned monetization channel is Tebex, and even then, cosmetics and priority queue are acceptable while gameplay advantages are not.
- GDPR applies to EU players. A FiveM server routinely logs IP addresses, Discord IDs, and connection timestamps — all personal data. If you have EU players, you need a lawful basis, a privacy notice, a retention policy, and a way to honour deletion requests. Do not log more than you need.
- Legitimate copies only. Both you and every connecting player need a legal copy of GTA V. This is enforced by Cfx.re and is a term of use, not a suggestion.
- Respect the platform. Because Cfx.re is now part of Rockstar Games, the relationship between community servers and the publisher is formalized — read the Rockstar roleplay community update for the official position.
Common Pitfalls When Setting Up a FiveM Server
These are the mistakes that send new admins to the forums. Avoid all six and your first boot will very likely just work.
- Hardcoding an artifact build number. Builds change weekly. Always pull the current Recommended FiveM server artifacts from the live page, never a hash copied from an old tutorial.
- Loading a framework before oxmysql.
ensure oxmysqlmust come beforeensure es_extended. Wrong order producesno such export execute in resource oxmysql. - Exposing txAdmin (40120) or MariaDB (3306) to the internet. Both must stay private. Tunnel txAdmin over SSH; bind the database to localhost.
- Forgetting
charset=utf8mb4. Skip it and international names and emoji corrupt into mojibake that is painful to fix retroactively. - Mixing ESX and QBCore scripts. They are not interchangeable. Pick one framework and stick to its ecosystem unless you install a proper bridge.
- Running as root. A compromised resource then owns your whole box. Use the dedicated
fivemservice user from Step 2.
Troubleshooting FiveM Server Errors
When something breaks, the FXServer console almost always tells you what. Here are the errors new admins hit most, and how to fix each.
| Symptom / error | Likely cause | Fix |
|---|---|---|
no such export execute in resource oxmysql | Framework started before the DB connector | Move ensure oxmysql above the framework line in server.cfg |
| Server not appearing in the server list | Invalid/expired license key or blocked port 30120 | Regenerate the key at portal.cfx.re; confirm 30120 TCP+UDP is open |
Server license key authentication failed | Wrong key, or key bound to a different IP | Re-copy the exact cfxk_ key; update the IP on the key in the Portal |
| Players stuck on “Connecting…” / loading screen | UDP not open, or a broken resource in the manifest | Open 30120/udp; check console for the failing resource and comment it out |
| Server capped at 32 players | OneSync is off | Set onesync on and sv_maxclients to 48 (free tier) |
| Heartbeat fails above 48 slots | Over the free OneSync slot limit | Lower to 48, or add a Cfx.re Element Club (Argentum+) subscription |
| Accented names show as “é” | Missing utf8mb4 charset | Add ?charset=utf8mb4 to the connection string and re-import tables |
| Database connection refused | MariaDB down, or wrong credentials | Check systemctl status mariadb; verify the user/password/host |
| txAdmin panel unreachable | Trying to hit 40120 directly (correctly firewalled) | Open an SSH tunnel: ssh -L 40120:localhost:40120 … |
| Server dies when SSH closes | Running run.sh interactively, not via systemd | Install and start the fivem.service unit from Step 11 |
Advanced Tips: Docker, Multiple Servers, and CI
Once the basics are second nature, these patterns scale your operation from one server to a community.
- Containerize with Docker. Wrapping FXServer in a container makes artifact upgrades a one-line image swap and isolates the process further. Mount
server-dataas a volume so config survives rebuilds. - Run a staging server. Clone your
server-datato a second instance on a different port (e.g., 30121) to test new artifacts and scripts before they touch players. Never test on production. - Version your resources. Keep
server-datain a private git repo (secrets excluded) so every change is diffable and reversible — the same discipline you would apply to any production codebase. - Automate artifact checks. A small cron script can poll the artifacts index and alert you when a new Recommended build lands, so you upgrade deliberately rather than reactively.
- Scale slots the right way. When you genuinely outgrow 48 players, budget for both the Cfx.re Element Club subscription and a faster single-thread CPU at the same time — one without the other just moves the bottleneck.
Related Coverage
- Minecraft Server Setup: 12 Steps, 30 Min [2026]
- Valheim Dedicated Server: 11 Steps, 30 Min [2026]
- ARK Dedicated Server: 12 Steps, 30 Min [2026]
- Palworld Dedicated Server: 12 Steps, 30 Min [2026]
- Satisfactory Dedicated Server: 12 Steps, 30 Min [2026]
- Project Zomboid Dedicated Server: 12 Steps, 30 Min [2026]
- GTA 6 Pre-Orders Live: $79.99, Console-Only [2026]
- All gaming coverage on Shattered
Frequently Asked Questions
Is running a FiveM server legal?
Yes. FiveM is developed by Cfx.re, which officially joined Rockstar Games in August 2023, making community-run GTA V roleplay servers publisher-sanctioned. You and every player must own a legitimate copy of GTA V, and you must follow Cfx.re’s platform policy — no pay-to-win, Tebex-only monetization.
How much does a FiveM server cost to run?
The FiveM license key and OneSync (up to 48 slots) are free. Your only required cost is the server itself — a capable VPS runs roughly $6–$25 per month. Managed FiveM server hosting costs more per slot but removes the setup work. Running more than 48 slots requires a paid Cfx.re Element Club subscription.
How many players can a FiveM server hold?
Without OneSync, 32. With OneSync legacy, 64. With OneSync Infinity, anywhere from 128 up to 2048 in principle, though the real ceiling is your CPU’s single-thread performance. Most roleplay communities run 48–128 slots. Cfx.re allows OneSync free up to 48 players.
Which is best: ESX, QBCore, or QBox?
ESX Legacy is the easiest starting point thanks to its enormous script catalogue and documentation. QBCore is a cleaner, more modular option favoured by many serious roleplay servers, and QBox is a community-maintained fork of QBCore. Pick one and stick with it — mixing frameworks without a bridge breaks the server.
Do I need Windows, or can I host on Linux?
FiveM’s FXServer runs natively on both Linux and Windows. This guide uses Ubuntu 24.04 LTS because Linux VPS hosting is cheaper, more secure by default, and integrates cleanly with systemd for supervision. The Windows path uses the same artifacts and txAdmin, launched via FXServer.exe.
What are FiveM server artifacts?
FiveM server artifacts are the versioned builds of the FXServer software, each tagged with a build number and hash. New artifacts ship almost weekly. Always download the current “Recommended” build rather than “Latest,” and never hardcode a build hash — pull the live one from the artifacts page each time you upgrade.
Where do I get a FiveM license key?
From the Cfx.re Portal at portal.cfx.re (which replaced the older keymaster.fivem.net address). Log in with your Cfx.re account, create a new server key tied to your IP, and paste it into server.cfg as sv_licenseKey. The key is free but secret — leaking it can get it revoked.
Why does my FiveM server not show up in the server list?
The two usual causes are an invalid or IP-mismatched license key, and a blocked game port. Confirm your sv_licenseKey is correct and bound to the right IP in the Portal, and that port 30120 is open on both TCP and UDP through UFW and any provider-level firewall. Over the free 48-slot OneSync limit, a failing heartbeat will also hide the server.
How do I keep my FiveM server running after I disconnect?
Supervise it with systemd (Step 11). A fivem.service unit starts the server on boot, restarts it after a crash, and keeps it alive when your SSH session ends. Let txAdmin handle scheduled in-game restarts from its own scheduler so the two supervisors do not conflict.
Your FiveM Server, Owned End to End
You now have a complete, hardened FiveM server: FXServer running the current Recommended artifacts under systemd, txAdmin locked behind an SSH tunnel, MariaDB backing an ESX or QBCore economy through oxmysql, OneSync scaling you to 48 free slots, and a firewall that exposes exactly one public port. That is the full stack a serious GTA V roleplay community runs — and because you built every layer yourself, you understand and control all of it.
The same discipline — provision, create a service user, harden SSH, firewall aggressively, supervise with systemd, back up the database — carries straight across to every other title. If FiveM is your first self-hosted game server, it is an excellent teacher: the single-thread performance lessons, the private-admin-panel habit, and the secrets-management hygiene are exactly the instincts that keep any internet-facing service safe. Bookmark the Cfx.re server manual for the authoritative reference, and keep your artifacts current.




