A complete, battle-tested walkthrough for spinning up your own FiveM GTA V roleplay server on Ubuntu 24.04 LTS. We cover the CFX license key, the current recommended Linux artifact (build 25770, txAdmin 8.0.1), full txAdmin web-panel setup, MariaDB configuration, QBCore framework install, systemd auto-restart, and the 12 most common errors and their fixes. Everything here was verified against official Cfx.re documentation on 2026-04-19.
01 // What is FiveM (and why you want your own server)
FiveM is a modification framework for Grand Theft Auto V that enables custom multiplayer servers with Lua/JavaScript scripting, custom gamemodes, and synchronized roleplay economies. Unlike Rockstar's official GTA Online, FiveM servers are community-run and can host anywhere from 32 to 2,048 players with completely custom experiences — banks, jobs, housing, drug economies, police and EMS departments, custom vehicles, MLO (Map Loader Object) interiors, and more.
In 2026, FiveM remains the dominant GTA V multiplayer mod. The roleplay scene — heavy RP cities using frameworks like QBCore, ESX, or the newer Qbox — accounts for the vast majority of server population. Running your own server gives you full control over rules, scripts, and player base, and with current hardware, a 64-slot QBCore city runs comfortably on a mid-tier VPS.
This guide targets a self-hosted Ubuntu 24.04 LTS VPS. If you prefer a managed one-click option, ZAP-Hosting (an official CFX partner) is covered in the affiliate box below.
02 // Requirements
- A Cfx.re forum account — free. Required to generate a license key at keymaster.fivem.net.
- A Linux VPS — Ubuntu 24.04 LTS (or 22.04 LTS) with root or sudo access. See hardware recommendations below.
- A public IPv4 address — NAT or CGNAT will not work. The license key is bound to the public IP reported by the server.
- Open ports —
30120/tcp+30120/udp(game traffic) and40120/tcp(txAdmin web panel). - MariaDB 10.6 or newer — required for any framework (QBCore, ESX, Qbox) to persist characters, inventory, vehicles, etc.
- Basic Linux familiarity — you should be comfortable with
ssh,sudo,systemd, and editing config files withnanoorvim.
Hardware sizing by server size
FiveM server performance is mostly bound by single-thread CPU speed and RAM, not core count. A framework like QBCore with 150+ resources will easily use 4–8 GB RAM on its own before a single player joins.
| Server type | Slots | Recommended plan | Why |
|---|---|---|---|
| Vanilla / freeroam | ≤32 | Hostinger KVM 2 (8 GB) | Lightweight, no framework overhead |
| QBCore / ESX light | 32–64 | Hostinger KVM 4 (16 GB) | Framework + ~100 resources + MariaDB |
| Full RP city (QBCore) | 64–128 | Hostinger KVM 4 (16 GB) | 300+ resources, active economy, custom MLOs |
| Heavy modded city | 128–256 | Hostinger KVM 8 (32 GB) | Streaming thousands of custom assets |
| Don't want to manage Linux | any | ZAP-Hosting (managed) | Official CFX partner, one-click setup |
03 // Pick your hosting option
FiveM roleplay servers are RAM-hungry, so never under-provision. Below are the two options most HostingBuff readers choose between: a self-managed Hostinger VPS (best price/performance, needs Linux skills) or a managed ZAP-Hosting server (click-to-play, no terminal). Both are covered in this guide — if you pick ZAP-Hosting you can skip straight to section 11 (framework install).
Hostinger KVM 4 — 4 vCPU, 16 GB RAM, 200 GB NVMe
The sweet spot for a serious FiveM RP server. Handles QBCore or ESX with 64–128 active players and 300+ resources comfortably. Full root access, 300+ Mbps unmetered network, NVMe storage for fast asset streaming. €12.99/month on a 24-month term.
Get Hostinger KVM 4 →ZAP-Hosting — Official CFX Partner, One-Click FiveM Servers
ZAP-Hosting is an official CFX/FiveM partner and the most popular managed FiveM host in 2026. No Linux, no terminal, no txAdmin setup — your server is ready in 2 minutes with one-click mod installs, automatic updates, DDoS protection, and 24/7 support. Great if you want to focus on building your city instead of managing infrastructure.
Use voucher code Keishin-a-8710 for a permanent 20% discount on the entire duration of your rental (excluding dedicated servers). Applied automatically via the link below.
If you can edit a file in nano and run three commands without panicking, self-hosting on Hostinger KVM 4 gives you 3–4x more resources for the same money and complete control over your server. If you want to open a browser tab, click "Install QBCore," and have players online in 10 minutes, ZAP-Hosting is genuinely the best managed option in 2026 because they are an actual CFX partner (most "FiveM hosts" are not).
04 // Get your CFX license key
Every FiveM server needs a license key. It is free, tied to your Cfx.re account, and bound to the public IPv4 address of your server. Without a valid key, players cannot connect — the server will start but refuse all joins.
- Go to keymaster.fivem.net and sign in with your forum.cfx.re account.
- Click "+ New".
- Set Server type to "I rent a server from a server provider" (correct for any VPS).
- Enter your VPS public IPv4 address in the IP field. Get it with
curl -4 ifconfig.meon the server. - Give it a recognisable label (e.g. "MyRP-Main") and click Generate.
- Copy the long key that starts with
cfxk_. You will paste it intoserver.cfglater. Keep it secret — treat it like a password.
If you later migrate to a new VPS with a different IP, do not generate a new key — just update the existing key's IP on keymaster. Generating multiple keys and leaking them is the fastest way to get your Cfx.re account flagged.
05 // Prepare the Ubuntu server
SSH into your fresh Ubuntu 24.04 VPS as root (or with a sudo user). We will update the system, create a dedicated non-root fivem user, install build tools, and open the firewall.
# 1. Update everything and install prerequisites
apt update && apt upgrade -y
apt install -y curl wget xz-utils tar git screen ufw nano ca-certificates
# 2. Create a dedicated service user (never run FiveM as root)
adduser --disabled-password --gecos "" fivem
usermod -aG sudo fivem # optional, remove if you don't want sudo
# 3. Configure the firewall
ufw allow 22/tcp # SSH
ufw allow 30120/tcp # FiveM game
ufw allow 30120/udp # FiveM game (UDP is critical)
ufw allow 40120/tcp # txAdmin web panel
ufw --force enable
ufw status numbered
FiveM executes Lua and JavaScript from hundreds of community resources. If a malicious or vulnerable resource escapes the sandbox, you want the blast radius limited to a single unprivileged account, not root. This is standard practice and the official Cfx.re docs recommend it.
06 // Install and secure MariaDB
Every modern FiveM framework (QBCore, ESX, Qbox) stores character data, inventory, vehicles, banks, and housing in a MySQL-compatible database. We use MariaDB 10.11 from the Ubuntu 24.04 repos — it is rock solid, officially supported, and requires zero external PPAs.
# Install MariaDB server
apt install -y mariadb-server mariadb-client
# Secure the installation (answer Y to all hardening prompts, set a strong root password)
mariadb-secure-installation
# Create the FiveM database and dedicated DB user
mariadb -u root -p <<'SQL'
CREATE DATABASE fivem CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'CHANGE_ME_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON fivem.* TO 'fivem'@'localhost';
FLUSH PRIVILEGES;
SQL
Replace CHANGE_ME_STRONG_PASSWORD with a proper long random password (openssl rand -base64 24 generates one). Save the database name, user, and password — you will plug them into QBCore's config in section 11.
07 // Download the FiveM Linux artifact
The FiveM server binary is called an artifact. Cfx.re publishes new builds almost daily; we always use the build marked "recommended" on the official build list at runtime.fivem.net. As of 2026-04-19 that is build 25770, which ships bundled txAdmin 8.0.1.
# Switch to the fivem user
su - fivem
# Create the server directory structure
mkdir -p ~/server ~/server-data
cd ~/server
# Download the recommended Linux artifact (replace URL with the latest 'recommended' link)
wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/25770-LATEST_HASH/fx.tar.xz
# Extract it in place
tar xf fx.tar.xz
rm fx.tar.xz
# Confirm the binaries are there
ls -la run.sh alpine/
Build numbers change constantly. Go to the artifacts index, find the row marked recommended (not optional, not latest), and copy its fx.tar.xz URL. Using a non-recommended build is the single most common cause of txAdmin or resource breakage.
08 // First launch — start txAdmin
txAdmin is the official web-based admin panel that ships bundled with every modern FiveM artifact. It handles first-time setup, server.cfg management, resource installation (via recipes), player management, live console, scheduled restarts, and Discord integration. We will never run the FiveM server without it.
# Still as the 'fivem' user, in ~/server
cd ~/server
# Start inside a screen session so closing SSH does not kill the server
screen -S fivem
# Launch FiveM pointing at the EMPTY data folder we created earlier
bash run.sh +set serverProfile default +set txAdminPort 40120 +setr fivem_serverDataPath "/home/fivem/server-data"
Output looks like this:
[txAdmin:Setup] Join http://<YOUR_SERVER_IP>:40120/addMaster/pin?pin=1234
or paste the PIN: 1234 when asked
Copy the URL (or just the PIN) — you need it for step 09. Detach from screen with Ctrl+A, then D. Re-attach any time with screen -r fivem.
09 // Complete the txAdmin first-time setup (web browser)
On your local PC, open http://YOUR_SERVER_IP:40120 in a browser. You will walk through a four-step wizard.
- PIN verification — paste the 4-digit PIN from the terminal output. This proves you control the server.
- Create master account — this is your txAdmin admin user. Use a long password; this account can execute arbitrary commands on your server.
- Link Cfx.re account (optional but recommended) — signs you in via the Cfx.re OAuth flow. Enables sharing admin access with your team via Cfx accounts instead of shared passwords.
- Deployer — pick your starting point:
- Popular recipe — one-click install of
cfx-server-data(vanilla freeroam, great for testing), QBCore, ESX Legacy, or Qbox. Recommended for 99% of readers. - Remote recipe URL — paste a URL to a custom
recipe.yaml. Used by advanced users deploying their own framework fork. - Existing server data folder — skip the deployer and point at a folder you already populated.
- Popular recipe — one-click install of
QBCore is the most widely-used modern roleplay framework, has excellent documentation at docs.qbcore.org, a massive free-resource ecosystem, and active Discord support. ESX is older and heavier. Qbox is newer and cleaner but has fewer community resources. For a first server, QBCore is the correct choice.
Once you pick a recipe, txAdmin downloads it, creates the folder structure in ~/server-data, imports the framework's SQL schema into MariaDB (you enter your DB credentials here), and generates a ready-to-edit server.cfg. This takes 2–5 minutes depending on your VPS network speed.
10 // Configure server.cfg (the critical file)
After the recipe finishes, txAdmin drops you on the dashboard. Before you start the server for real, edit ~/server-data/server.cfg via txAdmin → Settings → CFG Editor (or directly in nano). The fields below are the ones you must get right.
# ---- Endpoint configuration (game traffic) ----
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
# ---- Server identity ----
sv_hostname "^1MyRP ^7| ^2QBCore ^7| ^3discord.gg/yourinvite"
sv_projectName "MyRP"
sv_projectDesc "Serious roleplay | Whitelist | Economy reset weekly"
sv_maxClients 64
# ---- CFX License key (paste the cfxk_... key from keymaster) ----
sv_licenseKey "cfxk_YOUR_LONG_KEY_HERE"
# ---- List visibility ----
sets tags "roleplay, qbcore, english, serious-rp"
sets locale "en-US"
sets banner_detail "https://i.imgur.com/YOUR_BANNER.png"
# ---- Performance tuning ----
sv_enforceGameBuild 3095 # mpchristmas3 DLC, current stable
onesync on # required for >32 slots
sv_scriptHookAllowed 0 # disable to prevent cheat loaders
# ---- Admin access (Cfx.re identifier, Discord ID, or Steam hex) ----
add_ace group.admin command allow
add_principal identifier.fivem:YOUR_FIVEM_ID group.admin
onesync on = up to 64 slots, stable, free. onesync legacy = deprecated, do not use. onesync infinity = up to 1024 slots, requires a paid Cfx.re "Element Club Argentum" subscription for servers above 48 players. Start with onesync on; upgrade only if you actually need >64 slots.
11 // Start the server and connect
From the txAdmin dashboard, click the big green Start Server button. Watch the live console — you want to see Server is now listening and no red error lines. Common first-run hiccups:
- License key is not yet active — wait 2 minutes, Cfx.re's key cache refreshes periodically.
- Port 30120 in use — something else grabbed it.
sudo ss -tulnp | grep 30120to find what. - Could not connect to database — check
server.cfg'smysql_connection_stringor the QBCoreqb-core/config.lua.
Once the console is clean, launch FiveM on your PC, press F8 to open the client console, and type:
connect YOUR_SERVER_IP:30120
You should load into the city within 60–90 seconds (first join downloads all streamed assets — subsequent joins are near-instant). If QBCore is running, you will land on the multicharacter selection screen.
12 // Essential QBCore post-install tuning
If you picked the QBCore recipe, your server is runnable but not production-ready. These four edits separate a "toy server" from one players will actually stick around on.
12.1 // Set your starting money and apartment
Edit ~/server-data/resources/[qb]/qb-core/config.lua:
QBConfig.Money.MoneyTypes = { cash = 500, bank = 5000, crypto = 0 } -- starter wallet
QBConfig.StartingApartment = true -- give every new char a free apartment
QBConfig.Server.Whitelist = true -- recommend: true for serious RP
12.2 // Configure the Discord webhook for logs
Every significant action (kills, transactions, admin commands) can log to a Discord channel. Edit qb-smallresources/config.lua and paste a Discord webhook URL per log type. Without this, moderating a 64-slot city is nearly impossible.
12.3 // Disable resources you don't need
QBCore ships with ~120 resources. Every resource uses CPU and RAM. Open server.cfg, find the ensure qb-* block, and comment out anything you know you won't use (e.g. qb-clothing if you replace it with fivem-appearance, qb-weed if your city is drug-free RP, etc.).
12.4 // Set a convar secret for external APIs
If you plan to use the Tebex webstore, FiveGuard anticheat, or any paid script, store API keys in server.cfg with set (private) instead of sets (public). Example:
set tebex_secret "your_tebex_secret_here"
set fiveguard_license "your_fiveguard_license"
13 // Make the server auto-start on boot (systemd)
Running inside screen is fine for testing, but for production you want the server to restart automatically if the VPS reboots or the FiveM process crashes. Create a systemd service.
# Back as root (exit out of su - fivem first, or open a new SSH session)
nano /etc/systemd/system/fivem.service
Paste:
[Unit]
Description=FiveM Server (txAdmin)
After=network-online.target mariadb.service
Wants=network-online.target
[Service]
Type=simple
User=fivem
Group=fivem
WorkingDirectory=/home/fivem/server
ExecStart=/bin/bash /home/fivem/server/run.sh +set serverProfile default +set txAdminPort 40120 +setr fivem_serverDataPath "/home/fivem/server-data"
Restart=always
RestartSec=10
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
# Enable and start
systemctl daemon-reload
systemctl enable --now fivem
systemctl status fivem # should say 'active (running)'
journalctl -u fivem -f # live logs, Ctrl+C to exit
Once systemd is running, never start the server with bash run.sh again. Two processes fighting for port 30120 will cause mysterious crashes. Always use systemctl start|stop|restart fivem.
14 // Scheduled restarts and database backups
Long-running FiveM servers leak memory over time — especially with 150+ resources loaded. Scheduled restarts every 6–12 hours are standard in the RP scene. txAdmin handles this natively.
Restart schedule — in txAdmin → Settings → Restarter, add restart times like 06:00, 14:00, 22:00. txAdmin will announce them in-game 30, 15, 5, and 1 minute in advance, then gracefully restart the server.
Database backups — your entire economy lives in MariaDB. Losing that table is a server-ending event. Add a cron job as root:
# Create backup script
mkdir -p /var/backups/fivem
cat > /usr/local/bin/fivem-db-backup.sh <<'SH'
#!/bin/bash
TS=$(date +%Y%m%d-%H%M%S)
mariadb-dump --single-transaction -u fivem -p'YOUR_DB_PASSWORD' fivem | gzip > /var/backups/fivem/fivem-$TS.sql.gz
find /var/backups/fivem -name 'fivem-*.sql.gz' -mtime +14 -delete
SH
chmod +x /usr/local/bin/fivem-db-backup.sh
# Run every 6 hours
( crontab -l 2>/dev/null; echo "0 */6 * * * /usr/local/bin/fivem-db-backup.sh" ) | crontab -
A backup on the same VPS does nothing if the VPS dies. Push your /var/backups/fivem/ folder to S3, Backblaze B2, or even a free Hetzner Storage Box nightly with rclone. Five minutes of setup prevents a year of lost character progression.
15 // Install custom resources (scripts, MLOs, vehicles)
Resources are FiveM's plugin system. They live in ~/server-data/resources/ and are loaded via ensure resource-name lines in server.cfg.
- Clone or upload the resource into
~/server-data/resources/[category]/resource-name/. Most QBCore scripts go under[qb]or[standalone]. - Read its README — nearly every resource has dependencies (
qb-core,ox_lib,oxmysql) and SQL files to import. - If there's a
.sqlfile, import it:mariadb -u fivem -p fivem < path/to/resource.sql - Add
ensure resource-nametoserver.cfgin the correct order (dependencies before dependents). - Restart the server from txAdmin (or
systemctl restart fivem).
Pirated "leaked" paid scripts are the #1 vector for backdoors on FiveM servers. A leaked script can and will exfiltrate your database credentials, add hidden admin accounts, or silently mine crypto on your VPS. Buy legitimate releases on Tebex, use official free releases from QBCore/Overextended GitHub, or write your own. There are no shortcuts here.
16 // Interactive VPS plan calculator
Pick your framework and target slot count and we'll tell you the minimum Hostinger plan that won't bottleneck you. Based on real-world RAM usage of the major frameworks plus 1.5× headroom for resource load.
17 // Troubleshooting — the 12 most common errors
| Symptom | Cause | Fix |
|---|---|---|
| Server starts but no one can connect | UDP port 30120 closed, or behind NAT/CGNAT | ufw allow 30120/udp; confirm VPS has a real public IPv4 |
| "Invalid license key" in console | Key generated with wrong IP, or key deleted on keymaster | Go to keymaster.fivem.net, update the IP on the existing key |
| "Could not connect to database" | Wrong credentials in mysql_connection_string, or MariaDB not running | Verify with mariadb -u fivem -p fivem; check systemctl status mariadb |
| txAdmin web panel shows "Server is offline" | Crash loop, usually from a broken resource | Check the txAdmin live console; last line before crash names the culprit resource |
| Server lags at >30 slots (OneSync warnings) | CPU bound — weak single-thread performance | Upgrade to a CPU-intensive VPS tier (Hostinger KVM 4 uses AMD EPYC 7003 series) |
| Clients stuck at "Downloading content" forever | Firewall blocking the file server, or HTTP artifact server misconfigured | Add fileServer convar to server.cfg, or set up a proper FastDL (separate guide) |
| "You are banned from this server: [NoLicense]" | Player's FiveM client has no valid Rockstar license linked | Player must log into GTA V on their Rockstar account once; not a server issue |
| QBCore multichar screen is black | Character creation table missing or NUI resource not ensured | Re-import qb-multicharacter SQL; confirm ensure qb-multicharacter is in server.cfg |
| Script errors spam the F8 console | Resource dependency missing (commonly ox_lib, oxmysql, PolyZone) | Install the missing dependency from its official GitHub; order ensure lines correctly |
| Server silently dies every few hours | OOM killer — VPS running out of RAM | dmesg | grep -i "killed process"; upgrade VPS or cut resources |
| "Route to host" errors from clients | Provider-level DDoS mitigation dropping UDP | Contact Hostinger support, or switch to a host with game-aware DDoS (Hostinger's network handles this) |
| txAdmin wants a PIN I never got | txAdmin was restarted before you completed setup, new PIN in logs | journalctl -u fivem -n 100 — find the most recent "PIN:" line |
The official Cfx.re forums (forum.cfx.re) are searchable and well-moderated — 95% of errors have already been solved there. The QBCore Discord (discord.gg/qbcore) is excellent for framework-specific issues.
18 // Next Steps
- Set up FastDL — offload custom asset downloads to HTTP so players load in 10 seconds instead of 5 minutes. Our FastDL guide covers the concept — FiveM version coming soon.
- Add a Pterodactyl or Pelican panel — if you want a GUI for managing multiple game servers from one dashboard, install Pelican or Pterodactyl. Both support FiveM as an egg.
- Configure Tebex — the only Cfx.re-sanctioned monetization method. Anything else risks a server ban.
- Harden SSH — disable password auth, enable key-only login, change the default port. Non-negotiable for any public VPS.
- Monitor with Netdata or Grafana — catch memory leaks and CPU spikes before they become player-facing lag.
19 // Final thoughts
A FiveM RP server is a living thing. The technical setup above gets you online — keeping players takes consistent moderation, regular content updates, and an engaged community. Start small (16–32 slots, trusted friends as staff), iterate on the framework, and scale the VPS up only when your player count actually justifies it. Over-provisioning a dead server is the fastest way to burn cash.
If you run into anything this guide did not cover, the Cfx.re forums and QBCore Discord solve 99% of issues. Welcome to the scene.