Guide Β· Server Setup
End-to-end walkthrough for launching a FiveM server from scratch β picking hosting, getting a Cfx.re license key, installing the server artifact, configuring server.cfg, choosing a framework, and adding your first scripts, MLOs, vehicles, and weapons.
By the end of this guide you'll have a working FiveM server that players can connect to, running a framework (ESX or QBCore), with at least a few scripts, an MLO or two, and some custom vehicles installed. It's the foundation every FiveM community starts from β the specifics of which content you run on top is what makes one server different from another.
The total first-time setup takes about 60β90 minutes of focused work if you're using managed hosting, or 2β3 hours if you're self-hosting on a VPS and doing everything by hand. Subsequent servers take you 10 minutes because you'll reuse the same server.cfg and resource set.
The single biggest decision is where the server actually runs. Your three options:
Running it on your home PC to test briefly is fine; running a live community off your home connection is not (you'll be IP-exposed and bandwidth-limited). This guide assumes you'll pick one of the three options above for anything you want players on.
keymaster.fivem.net. You'll generate a license key for the server.MariaDB or MySQL yourself.server.cfg and resource configs.Capacity-wise, here's what to pick based on your target player count:
Order the plan, get your control panel credentials in the welcome email, and move on. Most managed hosts will have a "Create FiveM Server" button that does steps 2β4 of this guide automatically β if yours does, skip ahead.
Every FiveM server needs a license key tied to its IP address. The key is free β it's how Cfx.re's server list identifies your server.
keymaster.fivem.net and sign in (create an account if you don't have one).cfxk_XXXXXXXXXXXX_YYYYY. You'll paste this into server.cfg in step 4.Your provider handles this. The control panel usually has a "Version" dropdown where you pick the artifact β choose the latest stable recommended build (not optional, and not an old pinned version unless you have a reason). Click Install, wait a minute, done.
Install dependencies, create the server directory, download the latest artifact, and extract:
sudo apt update
sudo apt install -y xz-utils curl wget screen
mkdir -p ~/fivem/server ~/fivem/server-data
cd ~/fivem/server
# Grab the latest recommended artifact from the FiveM downloads page
# Replace the URL with the latest from https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/
wget "https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/ARTIFACT/fx.tar.xz"
tar xf fx.tar.xz
rm fx.tar.xz
Clone the cfx-server-data template for the baseline resource set:
cd ~/fivem
git clone https://github.com/citizenfx/cfx-server-data.git server-data-template
cp -r server-data-template/* server-data/
rm -rf server-data-template
Download the latest Windows artifact from the FiveM downloads page, extract to C:\fivem\server\, and grab the cfx-server-data template into C:\fivem\server-data\ the same way.
server.cfgThe server.cfg file lives in server-data/ and controls everything about your server β name, slot count, password, license key, and which resources are loaded. The template ships with a starter version; open it and replace the defaults:
# server.cfg
# Basic info
sv_hostname "My FiveM Roleplay Server"
sv_projectName "My RP"
sv_projectDesc "Serious roleplay, ESX-based, 18+"
sv_maxclients 64
sets locale "en-US"
sets tags "roleplay, esx, economy, serious"
# Your Cfx.re license key from step 2
sv_licenseKey "cfxk_XXXXXXXXXXXX_YYYYY"
# Endpoints (usually fine as-is)
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
# Database (fill in your MySQL details)
set mysql_connection_string "mysql://user:password@localhost:3306/database?charset=utf8mb4"
# Load essential system resources (from the template)
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure fivem
ensure hardcap
ensure rconlog
ensure scoreboard
# Your framework and scripts will go here once installed (step 5+)
# Server owner permissions (replace with your Steam ID or license)
add_ace group.admin command allow
add_principal identifier.steam:YOUR_STEAM_HEX group.admin
Key directives to understand:
sv_hostname β what players see on the server list. Keep it descriptive; the server list scanner ranks by activity, not cleverness.sv_maxclients β slot count. Don't set higher than your hardware can handle (start conservative).sv_licenseKey β from Keymaster (step 2). Required.endpoint_add_tcp/udp β the port players connect on. Default 30120. Don't change unless you know why.mysql_connection_string β needed by oxmysql and every framework. Skip this section only for zero-database standalone servers.ensure β starts a resource with auto-restart. Prefer it over start.add_ace / add_principal β sets you as an admin so you can use admin commands in-game.identifier.steam:110000... β the long hex after steam: is your identifier. Paste it into the add_principal line.
Frameworks handle the core systems every RP server needs β player data, money, inventory, jobs, identity. Without one, you're writing all that yourself. Three choices:
The older, more widely-adopted framework. Huge script library β most marketplace scripts work on ESX out of the box. Mature, proven, slightly rougher around the edges than QBCore. Best pick if you plan to run a lot of third-party scripts or if you're forking an existing ESX server.
Install: clone esx-framework/esx_core + dependencies into resources/[esx]/, run the migration SQL, add ensure es_extended to server.cfg after oxmysql.
Newer, cleaner code, actively maintained. Most new scripts target QBCore first. Preferred for new servers starting fresh. Slightly smaller ecosystem than ESX but growing fast.
Install: clone qbcore-framework/qb-core + the starter resources (qb-inventory, qb-menu, qb-input, qb-target) into resources/[qb]/, run the database setup, and add ensure qb-core to server.cfg.
A QBCore fork that's modernized further β cleaner code, faster, maintained by a different community team. API-compatible with most QBCore scripts. If you want QBCore but newer, this is it.
Only sensible for non-RP servers β drift events, deathmatch servers, minigame servers. You lose built-in player data, money, jobs, and inventory, and you're writing it all yourself. Don't start here unless you have a good reason.
ESX / QBCore namespaces and most scripts target one or the other exclusively. Pick, commit, move on.
Time to launch. With your framework and essentials installed:
Click the "Start" button in the control panel. Watch the console stream in the dashboard β you're looking for the "listening on port 30120" line and no red errors below.
From ~/fivem/server-data/ launch the server artifact inside a screen session so it survives your SSH disconnect:
cd ~/fivem/server-data
screen -S fivem
bash ~/fivem/server/run.sh +exec server.cfg
# Detach the screen with Ctrl+A, then D
# Re-attach later with: screen -r fivem
From the server-data folder, run:
C:\fivem\server\FXServer.exe +exec server.cfg
Server started.Failed to verify license error (if you see that, your key or IP is wrong in step 2).connect YOUR_SERVER_IP:30120.spawnmanager at work.An empty framework server is functional but boring. This is where the marketplace comes in. Pick a handful of essentials from each category β don't try to install everything on day one.
Start with 5β8 core scripts that cover the RP essentials:
See the scripts install guide for the file-by-file process on each.
A handful of MLOs completely transforms how the map feels:
See the MLO install guide for the YMAP/YTYP-specific setup.
Replace the stock police/ambulance/fire with branded custom cars, then add civilian add-ons for players to buy:
Install process in the vehicle install guide.
A realistic gun pack elevates every shootout and patrol. For stylized or event servers, pick wireframe guns (cyberpunk/sci-fi) or paintball guns (non-lethal events). Owner / VIP pieces can be commissioned as 1of1 bespoke weapons.
The stock server.cfg permissions from step 4 get you a basic group.admin β enough to kick, ban, and use resource reload commands in-game. For any serious community you want more:
http://YOUR_SERVER_IP:40120 right after first boot β it prints the one-time password in the console.server.cfg with add_ace / add_principal lines for group.mod, group.admin, group.owner. Each role gets different command allow entries.Also drop in an anti-cheat script before you open the server to the public β script kiddies probe every new server on the list within hours. Don't leave it to chance.
The key in server.cfg doesn't match the IP you registered on Keymaster. Fix: either update the key in Keymaster to the current IP, or regenerate a key for the correct IP and paste the new one into server.cfg.
Three common causes: (1) sv_licenseKey is missing or wrong, (2) endpoint port 30120 isn't forwarded / firewall-allowed, (3) sv_hostname is set but ensure hardcap / ensure scoreboard aren't running so the server fails its health check. Check all three.
Usually missing dependencies. Read the line above the error β it names what resource failed to load. Common culprit: oxmysql not running before a script that needs the database. Fix the ensure order in server.cfg.
Your server's tick rate or OneSync setting is wrong. Add set onesync on (or onesync_enabled true on older artifacts) to server.cfg for 64-slot servers. Without it, players above slot 32 can't sync properly.
Bad mysql_connection_string. Test the connection independently with a database client first β host, port, username, password, and database name all have to work from the server's network. On managed hosts, the connection string is usually pre-filled in the control panel.
Run profile in the server console and watch which resources eat the most tick time. On a VPS, check CPU steal via top β if it's above ~5%, your host is oversold and you should consider moving to a dedicated server or a better-provisioned managed cloud host.
The one-time token printed in the console on first boot expires. If you missed it, restart the server β it prints a fresh token each first-boot when no admin account exists yet.
Commission it. The custom FiveM script development gig builds any script on spec, and custom vehicles / custom MLOs / custom weapons cover the rest.
Server's up, framework's live, a handful of content is loaded. From here:
To play FiveM you need a mid-range gaming PC. To host a public FiveM server you need a dedicated/VPS host β a home PC isn't reliable enough (your home internet, your PC's uptime, your IP exposure). A home PC is fine for a quick test or a LAN party, not for a public community.
Yes, within Cfx.re's Terms of Service. Running a FiveM server is a legitimate non-commercial modification use of GTA V. Selling server access (paywalled communities, pay-to-win perks tied to in-game advantages) has restrictions β read Cfx.re's current policies before monetizing. Purely cosmetic donations and community support tiers are generally fine.
Entry: $5β15/month on managed cloud hosting. Mid: $30β80/month on a VPS. High-end flagship communities: $150β400/month on dedicated. Add content costs on top β a solid starter server runs $200β500 in one-time purchases from the marketplace.
Usually 1β5 minutes after boot, provided the license key is valid, the hostname isn't empty, and you have at least one slot free. New servers start at the bottom of the list β the list ranks by active player count, so once you have regulars, you climb.
Linux for production β smaller memory footprint, better process supervision (systemd, screen, tmux), faster artifact updates, lower cost. Windows is fine for testing or if you're uncomfortable in a terminal, but most serious servers land on Linux eventually.
Yes β FiveM servers are portable. Tarball your server-data/ folder and export your MySQL database, and you can restore on a new host in under 30 minutes. Plan this before you need it: automated daily backups of both are non-negotiable for live servers.
You can run a solid server using only marketplace scripts with no coding. Config files cover all the common customization (prices, locations, job payouts, feature toggles). Commission custom script development when you want a feature that doesn't exist in any pre-made listing.