How to Set Up a FiveM Server: Complete Guide
FiveM lets you run your own GTA V multiplayer server, from a small private server for friends to a full roleplay community with jobs, police and custom cars. Getting it running is easier than it used to be, thanks to txAdmin, but there are still a few steps that trip people up: the license key, the database, the framework and the ports. This guide walks through the whole process, whether you host it yourself or use a game host.
We run YN HOSTING, which offers FiveM hosting in Singapore and Frankfurt today, with India and Ashburn (US) coming soon. The steps below work on any host or your own machine.
What you need before you start
- A Cfx.re account. FiveM is run by Cfx.re. You need an account to create a server license key.
- A server license key. Free, created on the Cfx.re Portal (portal.cfx.re). Each key is tied to your account and one server.
- A Steam Web API key (optional but recommended). Some resources use Steam identifiers.
- A server. Either your own PC or VPS, or a game server host with FiveM support.
- A MySQL or MariaDB database if you plan to use a roleplay framework like ESX or QBCore.
Step 1: Get your license key
- Sign in at the Cfx.re Portal.
- Go to the server registration or keys section and create a new key.
- Give it a label and enter your server's IP address if asked.
- Copy the key. It goes into
server.cfgassv_licenseKey.
On YN HOSTING you paste it into the panel; see adding your free Cfx.re license key.
Step 2: Install the server artifacts
FiveM's server software is called FXServer, distributed as "artifacts" (builds). If you're self-hosting:
- Windows: download the latest recommended Windows artifact, extract it to a folder like C:\FXServer\server.
- Linux: download the latest recommended Linux artifact (fx.tar.xz) and extract it, for example to /home/fivem/server.
Use the recommended build rather than the newest one unless a resource needs a specific feature. A game host normally installs and updates artifacts for you.
Step 3: Run txAdmin
txAdmin is the web panel built into FXServer. It's the easiest way to create and manage a server.
- Start FXServer (
FXServer.exeon Windows,./run.shon Linux). - Open the URL shown in the console (port 40120 by default) and link your Cfx.re account using the PIN.
- Create a master admin password.
- Choose a deployment type:
- Popular recipes such as QBCore or ESX Legacy, which install the framework and a database setup for you.
- Local server data if you already have a server folder.
- CFX Default for a plain server with basic resources, good for testing.
- Enter your license key and, for frameworks, your database details.
- Let txAdmin finish, then start the server.
Step 4: Understand server.cfg
server.cfg is the main config file. A minimal one looks like this:
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap
sv_hostname "My FiveM Server"
sets sv_projectName "My Server"
sets sv_projectDesc "Friendly roleplay"
sv_maxclients 32
set onesync on
sv_licenseKey "your_key_here"
set steam_webApiKey "your_steam_key"
Key settings:
- endpoint_add_tcp / endpoint_add_udp: the port players connect to. 30120 is the default.
- ensure: starts a resource. Order matters for dependencies.
- sv_maxclients: the player slot limit (see below).
- onesync: required once sv_maxclients is 32 or higher, and used by most modern frameworks.
- add_ace / add_principal: permissions for admins.
Edit it carefully; a missing quote can stop the server from starting. See editing your server config.
Step 5: Ports and firewalls
If you self-host, open these ports: - 30120 TCP and UDP: the game port. - 40120 TCP: txAdmin. Don't leave it open to the world without a strong password, and ideally restrict it to your IP.
On a router you'll need port forwarding. On a VPS, open the ports in the firewall. On a game host, this is done for you.
Step 6: Install a framework (ESX or QBCore)
Most roleplay servers use a framework that handles players, jobs, money and inventories.
| ESX Legacy | QBCore | Qbox | |
|---|---|---|---|
| Age | Oldest, huge ecosystem | Popular since ~2021 | Newer, builds on QBCore |
| Resources | Very many, quality varies | Many, consistent style | Growing, compatible with many QB resources |
| Best for | Huge choice of scripts | Clean structure, many tutorials | Modern code and performance |
The easiest path is a txAdmin recipe. Manual installation means cloning the framework into resources/, importing its SQL file into your database, and adding ensure lines in the right order. Our guide covers both: installing ESX or QBCore.
Step 7: Connect the database
Frameworks store characters, money and items in MySQL or MariaDB, usually through the oxmysql resource. Add your connection string to server.cfg:
set mysql_connection_string "mysql://user:password@host/database?charset=utf8mb4"
ensure oxmysql
Make sure oxmysql starts before the framework. See connecting your MySQL database.
Step 8: Add resources (scripts, cars, maps)
- Download the resource from a trusted source (the Cfx.re forum, GitHub or the developer's official store).
- Upload it to
resources/with SFTP (uploading files with SFTP). - Add
ensure resource_nametoserver.cfg, or start it from txAdmin. - Restart and check the console for errors.
Avoid "leaked" paid scripts. They often contain backdoors that let someone else take over your server, and they break Cfx.re's rules.
How many players can a FiveM server have?
sv_maxclients sets the limit. According to the Cfx.re documentation, a server can use up to 48 slots for free (with OneSync enabled). Going above 48 requires a FiveM Element Club Argentum subscription or higher, linked to your license key on the Cfx.re Portal, and the top tiers allow up to 2,048 players. This applies on any host: a hosting plan with more than 48 slots still needs your own Element Club subscription to use them. Cfx.re can change these terms, so check the current documentation before planning a big launch.
Hardware: what your FiveM server needs
| Server type | Players | RAM | Notes |
|---|---|---|---|
| Testing or friends | up to 10 | 4 GB | Default resources |
| Small RP | 10–32 | 6–8 GB | ESX/QBCore plus a moderate number of scripts |
| Larger RP | 32–64 | 8–16 GB | Many scripts, custom cars and maps; over 48 players needs Element Club |
CPU matters more than RAM. A single badly written script can eat the server thread, so use the resmon command in the client (F8 console) and txAdmin's performance graphs to find heavy resources. Storage should be NVMe: big streamed assets like cars and maps load faster. Every YN HOSTING server runs on NVMe.
DDoS protection
Popular RP servers attract DDoS attacks, especially after bans. Pick a host with always-on protection that doesn't drop real players during an attack. YN HOSTING includes Gcore and Zero Lag Protection on every server, for almost lag-free play while attacks are filtered (how our DDoS protection works).
Choosing a location
FiveM is sensitive to latency, especially for driving and shooting. Host near your community: Singapore for Southeast Asia, Frankfurt for Europe, with India and Ashburn (US) coming soon on YN HOSTING. Our region and lag guide shows how to test.
Common problems
- "Server license key authentication failed": wrong key, or the key is tied to a different IP. Create a new key.
- Server not in the server list: check
sv_master1isn't set to blank, the ports are open, and the server has finished starting. - Framework errors on startup: wrong start order, or the SQL wasn't imported.
- Players stuck loading: a broken resource or a huge streamed asset. Check the server console and client F8.
FAQ
Is it free to run a FiveM server?
The software and the basic license key are free, and include up to 48 player slots. You pay for the hardware or hosting, and for a Cfx.re Element Club subscription only if you need more than 48 slots or extra features.
What port does FiveM use?
30120 TCP and UDP by default. txAdmin uses 40120.
ESX or QBCore: which is better?
Both work. ESX has the largest library of scripts; QBCore has a cleaner structure and lots of tutorials. Choose based on the scripts you want.
Do players need to own GTA V?
Yes. Players need a legitimate copy of GTA V on PC and the FiveM client.
How much RAM does a FiveM server need?
4 GB for testing, 6–8 GB for a small roleplay server, and 8–16 GB for larger communities with many scripts.
Can I run a FiveM server on my own PC?
Yes, but it must stay on 24/7, you need to forward ports, and your home IP is exposed to attacks.
Launch your FiveM server
See our FiveM server plans in Singapore and Frankfurt, with India and Ashburn (US) coming soon, NVMe storage and 24/7 support. New customers on monthly billing can get the first month for $1 using the YN1 code on each plan card (details). Questions? Join our Discord: https://discord.gg/cCUKcyMEuH.
Comments0
No Comments Yet
Be the first to share your thoughts.
Please sign in or sign up to leave a comment.