How to Set Up a FiveM RP Server with QBCore on Ubuntu 24.04

Step-by-step guide to deploying a FiveM RP server with QBCore on Ubuntu 24.04: artifacts, MariaDB, txAdmin setup, and framework initial configuration.

Prerequisites

Before starting, confirm you have the minimum required environment. FiveM is RAM-intensive — each player consumes an average of 60–80 MB in the server process — so do not attempt to run this on less than 4 GB.

Prerequisites

Ubuntu 24.04 LTS VPS with at least 4 GB RAM, 2 vCPUs, and 30 GB of disk. SSH access with a sudo user, port 30120 (TCP+UDP) open in the firewall, and a free license key generated at keymaster.fivem.net.

FiveM Port 30120 TCP+UDP
txAdmin Port 40120 TCP
Minimum RAM 4 GB
Database MariaDB 10.11+

Preparing the Base System

The FiveM headless server is distributed as a static Linux binary, but it depends on a few system libraries. Start by updating packages and installing the required dependencies.

01

Update the package index and install base dependencies:

sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget xz-utils git screen tmux ufw build-essential

screen and tmux keep the server process running after you disconnect from the SSH session — FiveM has no native daemon.

02

Create a dedicated user for the server. Running FiveM as root is bad practice and txAdmin explicitly warns against it:

sudo adduser --disabled-password --gecos "" fivem
sudo usermod -aG sudo fivem
sudo su - fivem

From this point forward, all commands run as the fivem user unless prefixed with sudo.

03

Configure the firewall to allow SSH, FiveM, and txAdmin:

sudo ufw allow 22/tcp
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
sudo ufw allow 40120/tcp
sudo ufw --force enable

UDP port 30120 is the critical one — it carries the actual game traffic. TCP 30120 is used for the initial handshake and the server browser list.

Installing MariaDB and Creating the Database

QBCore relies heavily on a SQL database — virtually every resource (inventory, jobs, vehicles, properties) persists through oxmysql. MariaDB is the community standard choice due to its compatibility and performance under workloads of many short writes.

04

Install MariaDB and run the security assistant:

sudo apt install -y mariadb-server mariadb-client
sudo systemctl enable --now mariadb
sudo mariadb-secure-installation

Answer Y to all prompts except the first one (switch to unix_socket) — leave that as N to maintain password-based authentication compatibility, which is what oxmysql expects.

05

Create the QBCore database and user:

sudo mariadb -u root -p

Inside the SQL prompt:

CREATE DATABASE qbcore CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'qbuser'@'localhost' IDENTIFIED BY 'changeThisStrongPassword123!';
GRANT ALL PRIVILEGES ON qbcore.* TO 'qbuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Use a real password (generate one with openssl rand -base64 24) — this string will appear in server.cfg in plain text.

utf8mb4 collation is required

Modern QBCore uses emojis in chat and in some item names. If you create the database with utf8 or latin1, resources will crash with “Incorrect string value” errors as soon as a 4-byte character is inserted.

Downloading the FiveM Artifacts

Artifacts are the FiveM server binary. CFX Re publishes recommended and optional builds regularly — always use the recommended build unless you need a specific feature.

06

Create the directory structure and download the current recommended build:

mkdir -p ~/server ~/server-data
cd ~/server
wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/15295-de1d8a35434f0f2b5b8bcae93e9eb8f6e4a7df14/fx.tar.xz
tar xf fx.tar.xz
rm fx.tar.xz

The URL changes with every build. Get the current one at runtime.fivem.net/artifacts/fivem/build_proot_linux/master/ and copy the link from the latest folder marked LATEST RECOMMENDED.

07

Clone the initial server-data template (default cfx resources):

cd ~/server-data
git clone https://github.com/citizenfx/cfx-server-data.git .

This repository only provides the minimal structure — we will replace the resources with QBCore in the next section.

Installing the QBCore Framework

QBCore is not a single repository — it is a collection of resources (qb-core, qb-multicharacter, qb-spawn, qb-inventory, etc.) that live in separate folders inside resources/. The maintainer team has consolidated everything under the qbcore-framework organization on GitHub.

08

Create the folder structure and clone the core packages:

cd ~/server-data/resources
mkdir -p [qb]
cd [qb]
git clone https://github.com/qbcore-framework/qb-core.git
git clone https://github.com/qbcore-framework/qb-multicharacter.git
git clone https://github.com/qbcore-framework/qb-spawn.git
git clone https://github.com/qbcore-framework/qb-inventory.git
git clone https://github.com/qbcore-framework/qb-target.git
git clone https://github.com/qbcore-framework/qb-menu.git
git clone https://github.com/qbcore-framework/qb-input.git

The brackets in [qb] are not a typo — it is a FiveM convention for grouping resources. The server loads all resources inside bracketed folders recursively.

09

Install oxmysql, which replaces the older mysql-async:

cd ~/server-data/resources
mkdir -p [standalone]
cd [standalone]
git clone https://github.com/overextended/oxmysql.git

QBCore declares oxmysql as a dependency in fxmanifest.lua — without it, no resource will start.

10

Import the QBCore SQL schema into the database. The schema file ships inside qb-core:

mariadb -u qbuser -p qbcore < ~/server-data/resources/[qb]/qb-core/qb-core.sql

Enter the password you set in Step 05. This import creates the players, bans, permissions, player_vehicles, and roughly 25 other tables in total.

Configuring server.cfg

server.cfg is the server entry point: it defines the hostname, resources to load, database connection string, and CFX license key.

11

Edit the main configuration file:

nano ~/server-data/server.cfg

Replace the contents with this template:

# Endpoints
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

# Database connection (oxmysql)
set mysql_connection_string "mysql://qbuser:changeThisStrongPassword123!@localhost/qbcore?charset=utf8mb4"

# Base resources
ensure oxmysql
ensure qb-core
ensure qb-multicharacter
ensure qb-spawn
ensure qb-inventory
ensure qb-target
ensure qb-menu
ensure qb-input

# Server settings
sv_hostname "My RP Server | QBCore"
sv_maxclients 48
sv_licenseKey "PASTE_YOUR_KEYMASTER_KEY_HERE"
sv_endpointprivacy true

# Initial admin (replace with your identifier after first connection)
add_ace group.admin command allow
add_principal identifier.license:YOUR_LICENSE_IDENTIFIER group.admin

The license key is free from keymaster.fivem.net — you need to register your VPS IP there to generate it.

Never commit server.cfg to a public repository

The license key and database password are stored in plain text. If you push this file to GitHub, anyone can hijack your server and wipe your database within minutes.

Starting the Server with txAdmin

txAdmin is already bundled with modern FiveM artifacts — no separate installation needed. It provides a web interface for logs, remote console, player management, and database access.

12

Start the server inside a screen session so it keeps running after you disconnect:

screen -S fivem
cd ~/server-data
bash ~/server/run.sh +set serverProfile default

On first run, txAdmin prints a URL to the console in the format http://YOUR_IP:40120/addMaster/pin?pin=XXXX. Open it in a browser, set an admin password, and point the server-data path to /home/fivem/server-data.

To detach from screen without killing the process: Ctrl+A followed by D.

13

From the txAdmin web panel, click “Start Server”. Watch the Console tab — you should see lines like:

[script:oxmysql] Database server connection established!
[script:qb-core] QBCore Started Successfully
Resource oxmysql started
Resource qb-core started

If you see a database connection error, review the mysql_connection_string in server.cfg. If you get an invalid license key error, regenerate the key on keymaster with the correct IP.

Verification

Connect via the FiveM client using F8 in-game:

connect YOUR_VPS_IP:30120

You should land on the character selection screen from qb-multicharacter. Create a test character — if creation persists and you spawn in downtown Los Santos, the entire stack is functional: artifacts, database, oxmysql, and QBCore.

On the server side, confirm active listeners:

ss -tunlp | grep -E '30120|40120'

This should list two lines: one TCP 30120 and one UDP 30120, both in LISTEN state.

Troubleshooting

Error: “Couldn’t load resource qb-core”

This is almost always a dependency issue. Confirm that oxmysql was cloned to resources/[standalone]/oxmysql and that it appears before qb-core in the ensure order inside server.cfg.

Server does not appear in the public server list

Check sv_endpointprivacy — if set to true, the server is hidden from the browser but still accepts direct connections. To list publicly, set it to false and add sv_projectName and sv_projectDesc.

Players disconnect with “Failed handshake to server”

This is almost always UDP 30120 being blocked. Verify with sudo ufw status that the UDP rule exists. If you are behind NAT, ensure that UDP forwarding is also configured at the router or provider level.

FiveM Logs

txAdmin stores logs in ~/.fxserver/. For deeper debugging, run the server without txAdmin via run.sh +exec server.cfg and read the console in real time — some Lua errors only surface in this mode.

Next Steps

With the base server running, these are the natural directions to grow:

  • Add optional QBCore resources: qb-policejob, qb-ambulancejob, qb-houses, qb-vehicleshop — all available under the qbcore-framework GitHub organization.
  • Set up automated database backups using mariadb-dump in a daily cron job, saving to external storage.
  • Migrate from the legacy qb-inventory to ox_inventory, which delivers significantly better performance with 30+ players online.
  • Study the qb-core jobs and gangs system to customize the economy and roles in your RP server.

If you plan to open the server to the public, a Hostini VPS provides low latency from Brazilian PoPs and enough bandwidth for FiveM’s UDP traffic spikes — a critical factor once you exceed 32 simultaneous players.

Frequently asked questions

How much RAM do I need to run a FiveM QBCore server?

For up to 32 players with a base QBCore setup, 4 GB of RAM is sufficient. Above 32 players, or when running resource-heavy additions like ox_inventory, qb-houses, and multiple active jobs, 8 GB is recommended. Each player consumes between 60 and 80 MB in the server process, and MariaDB requires at least 512 MB dedicated under load.

Is QBCore better than ESX in 2025?

QBCore has more active development, a cleaner export structure, and a more modern resource ecosystem — including native integration with ox_lib and ox_inventory. ESX still has more legacy content available, but the majority of new projects choose QBCore or its optimized fork Qbox, which is an evolved version of QBCore.

Can I run FiveM QBCore on Windows instead of Linux?

Yes, FiveM artifacts have a Windows build and many older tutorials use Windows Server. However, Linux consumes less idle RAM, handles high-frequency UDP workloads better, and has zero licensing cost. For production environments, Linux is the standard choice among competitive server communities.

Why does my FiveM server crash after a few hours?

The three most common causes are a memory leak in a third-party resource (identifiable via console warnings about high resmon), zombie connections in MariaDB (resolve with an appropriate pool_size in oxmysql), and missing swap on Linux. Configure at least 2 GB of swap even when RAM appears sufficient — the Linux kernel uses it for I/O cache.

Do I need to purchase a FiveM license key?

No. The server license key (sv_licenseKey) is completely free and generated at keymaster.fivem.net. What is paid is the Element Club, an optional subscription that raises the maximum player slot cap (from the default 48 up to 2048) and unlocks additional cosmetic features.

How do I set up automatic backups for the QBCore database?

Use mariadb-dump in a daily cron job: `mariadb-dump -u qbuser -pPASSWORD qbcore | gzip > /backup/qbcore-$(date +%F).sql.gz`. Ideally, copy the file to external storage via rsync or rclone — a backup on the same disk as the server does not protect against hardware failure or VPS compromise.

Next steps Ryzen cloud with NVMe storage and always-on DDoS protection.Go live on a Hostini VPS →
Was this tutorial helpful?
Chat on WhatsApp