How to make your first FiveM server · FiveM School
TRACK A·SET UP YOUR SERVER·Verified June 2026 · Lua 5.4 · ox_lib 3.x
Learning with an AI assistant?
Copies this lesson plus 2026 ground rules (no lua54 'yes', Cfx.re Portal, correct callback signatures) as a ready-to-paste mentor prompt.
Track A · Server Setup
How to make your first FiveM server
You don't need XAMPP, a framework, or a database for your first server. Five steps: download, license, config, start, join. This is the fastest path to confirming your own server runs and that you can connect to it. Everything else (QBCore, ESX, resources, SQL) comes after the base works.
You'll build
A working FiveM server you can join from the same PC. The shortest path from an empty folder to the 'Server is ready' message.
Time
~20 minutes
You need
A Windows PC with GTA V installed, a Cfx.re account, and 10GB free disk space.
You'll learn
Download artifacts, get a license key, write a minimal server.cfg, start the server, and join it. Five steps that turn a blank folder into a joinable server.
Download the latest recommended build. It is the highlighted (green) row on the page. That is the default choice for a fresh install: it is the build Cfx.re has tested most. The newest build sits at the very top of the list, above the recommended one, and it is only worth taking when you specifically need a brand-new fix that just landed, since it has had less testing. Click the recommended build, download its zip, and extract it to:
Expected contents inside server\: FXServer.exe, a citizen/ folder, and .dll files.
If a build ever misbehaves, drop one build down the list and try that one. You do not pin or freeze a build yet. That is a later production task, once your server is live and public.
2
Get your license key
You have the one mandatory key.
Go to https://portal.cfx.re/ (the Cfx.re Portal, the current home for license keys) → Servers → the registration keys page. Click Generate Key +, enter a display name for the key, then click Generate. Copy the generated key. The key is free.
The key is a single string that starts with cfxk_, like this:
text
cfxk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Paste that value verbatim. There is no licensekey: prefix. In server.cfg it becomes the line sv_licenseKey "cfxk_...", which you write in the next step.
The key is required even for a localhost-only server that only you can reach. Without it, the server won't start.
3
Add the base resources and write server.cfg
A server-data folder with the base resources and a minimal server.cfg.
A raw artifact cannot spawn you into the world on its own. It needs a small set of base resources (chat, the spawn manager, the session manager, the map manager, and a couple of housekeeping resources) to put you in Los Santos. These do NOT ship inside the artifact. They live in a separate Cfx.re repository called cfx-server-data, and the vanilla setup clones it. (When you use txAdmin later, its recipes include these for you, which is why you never see this step there.)
Create the data folder next to your artifact:
text
C:\FXServer\server-data\
Now put cfx-server-data inside it. Either way works:
With git: open Command Prompt in C:\FXServer\server-data\ and run git clone https://github.com/citizenfx/cfx-server-data.git . (the trailing dot clones into the current folder).
Without git: open https://github.com/citizenfx/cfx-server-data, click Code, choose Download ZIP, and extract its contents into server-data\ so you see a resources folder directly inside it.
Then create server.cfg inside C:\FXServer\server-data\ with this minimal config:
text
# How players reach your serverendpoint_add_tcp "0.0.0.0:30120"endpoint_add_udp "0.0.0.0:30120"# Your license key from portal.cfx.re (paste the cfxk_ value, no prefix)sv_licenseKey "cfxk_your_key_here"# What players see in the server namesv_hostname "My First FiveM Server"# Base resources from cfx-server-data - vanilla needs these to spawn you inensure mapmanagerensure chatensure spawnmanagerensure sessionmanagerensure hardcapensure rconlog# OneSync: not on by default - this line enables itset onesync on# Maximum players (values 32 and up require OneSync)sv_maxclients 32
OneSync is the networking layer that lets a FiveM server hold more players and sync more entities. It is NOT on by default: set onesync on is the modern standard every server should set. Without OneSync a server caps at 31 slots; onesync legacy reaches 64 in a compatibility mode that is not recommended; set onesync on reaches up to 2048. Any sv_maxclients of 32 or more requires set onesync on (or legacy), which is why the line above is 32 with OneSync on.
That's the whole file. You don't need tags, Discord links, sv_enforceGameBuild, or extra resources yet.
4
Start the server
The server console shows it's running.
Do NOT double-click FXServer.exe. Launching the exe with no arguments starts the txAdmin setup wizard instead, which is the other path (taught in the txAdmin lessons). For this vanilla server you point the exe at your server.cfg by hand.
Open Command Prompt, change into your data folder, and run the exe with +exec:
text
cd C:\FXServer\server-dataC:\FXServer\server\FXServer.exe +exec server.cfg
+exec server.cfg tells the server to read the config you just wrote. The console will validate the license key, load the base resources, and then settle. Watch it until it stops scrolling and prints its ready/started lines. How long that takes varies by machine.
5
Join your server
You're standing in Los Santos on your own server.
Open the FiveM client. Press F8 to open the in-game console (the command box built into the FiveM client). Type:
text
connect 127.0.0.1:30120
127.0.0.1 is your own PC. If you want friends on your local network to join, use your PC's local IP instead:
text
connect 192.168.x.x:30120
Find your local IP with ipconfig in Command Prompt.
A fresh local server is not something friends across the internet can reach. Internet play needs port forwarding and extra config, which is a later lesson. For now you reach your own server directly with the connect command above.
You double-clicked FXServer.exe, which starts the txAdmin wizard. Close that window and the console it opened, then launch with the +exec command from Step 4 instead.
Console window opens then closes instantly
Usually a missing Visual C++ runtime. Download and install VC_redist.x64.exe from Microsoft, then run the +exec command again.
Invalid license key
Re-copy the key from portal.cfx.re. Make sure there are no extra spaces and no licensekey: prefix. The value is just the cfxk_ string, pasted into sv_licenseKey.
connect 127.0.0.1:30120 does nothing
The FiveM client is not running, or the server has not finished starting yet. Wait until the console settles and shows the server is ready, then try the connect command again.
Port 40120 already in use
Another FXServer or txAdmin is already running and holding that port. Close the other console window (or restart your PC), then run the +exec command again.
My server is not in the FiveM browser list
Expected. A fresh local server is not listed publicly. Reach it directly with connect 127.0.0.1:30120. Public listing comes later with port forwarding.