Creating your own FiveM server lets you build a roleplay community, a racing server or anything else you can imagine for Grand Theft Auto V. It takes about an hour the first time, and you do not need to be a developer. This guide walks you through every step, from the licence key to your first connection.
What You Need Before You Start
- A Copy Of GTA V On PC. You and your players need the game to connect.
- A Server Machine. A home computer works for testing, but a VPS is the right choice for a public server, because it stays online all day. See What Is A VPS?
- A Cfx.re Account. You use it to create a free server licence key.
- A Database. Most roleplay frameworks store characters and items in MariaDB or MySQL.
Not sure about the hardware? FiveM Server Requirements By Player Slots gives starting points for CPU, RAM and storage.
Step 1: Get Your Licence Key
Sign in to the Cfx.re Keymaster with your account and create a new server key. Give it a name, enter your server's IP address, and copy the key. Keep it private, because anyone who has it can start a server under your name.
Step 2: Download The Server Files
Download the latest recommended server build (called an artifact) for your operating system from the official FiveM download page and extract it into its own folder. Choose the recommended build unless you have a reason to use a newer one.
- Windows: extract the archive and you will find
FXServer.exe. - Linux: extract the archive and you will find a
run.shscript. Run the server as a normal user, not as root.
Step 3: Use txAdmin To Set Up
Start the server executable once. FiveM includes txAdmin, a web interface for installing and managing your server. The console prints a link and a PIN to open it in your browser. From there you can follow the setup wizard, enter your licence key and choose a recipe. A recipe installs a ready-made server with a framework, or a basic starter. For a first server, the default recipe is a good way to learn.
txAdmin runs on its own port (40120 by default). Do not leave it open to the whole internet. Restrict it with your firewall to your own IP address.
Step 4: Understand server.cfg
Your server's settings live in a file named server.cfg. The important lines are:
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
sv_hostname "My First FiveM Server"
sv_maxclients 32
sv_licenseKey "your_key_here"
set onesync on
ensure chat
ensure mapmanager
sv_hostnameis the name shown in the server list.sv_maxclientsis the player limit. Servers above a certain size need a paid Cfx.re membership, so check their current rules.ensurelines start each resource (script or map). The order can matter.set onesync onturns on OneSync, which almost every modern server uses.
Step 5: Add A Framework And Scripts
Most roleplay servers use a framework such as ESX, QBCore or a similar one. It provides characters, jobs, inventory and an economy. Follow the framework's own installation guide, import its SQL file into your database and add its resources to server.cfg. Add scripts one at a time and restart after each, so you can find the cause of any problem right away.
Step 6: Open The Ports
Players connect to port 30120 on both TCP and UDP. Open it on your firewall and, if your host has a control panel firewall, there as well. Keep your database port closed to the outside. For a full guide to firewall basics, see How To Secure A Linux VPS For Your Game Server.
Step 7: Connect And Test
Open FiveM, press F8 to open the console and type connect your_server_ip:30120. You can also find your server in the list once it is running. Test with a friend before you announce it.
Step 8: Protect It
A public FiveM server will get attacked sooner or later. Set it up with protection from the start, and not after the first outage. Read How To Protect A FiveM Server.
After Launch: Keep It Healthy
- Back up the database and your resources regularly.
- Restart on a schedule, such as once a day at a quiet hour.
- Watch the txAdmin performance charts. If lag appears, see FiveM Server Lag: How To Find And Fix Performance Problems.
- Update server builds and resources carefully, and test updates before you apply them to your live server.
Ready To Launch?
Linceris.com VPS packages run in Frankfurt am Main, Germany with NVMe storage and DataForest.net DDoS protection included. Open a ticket if you want help choosing a package for your community.