Result: A fully functional, joinable FiveM server with QBCore framework running and database persistence enabled.
How to Create a 5M Server - Complete Tutorial
This comprehensive guide will walk you through how to create a 5M server (FiveM server) from scratch. By the end of this tutorial, you’ll have a working FiveM server that players can join, complete with a framework, database, and proper configuration.
Prerequisites
Before you start learning how to create a 5M server, ensure you have:
- VPS or PC with at least 4GB RAM and 20GB storage
- Cfx.re license key - Get one free here
- Basic command line knowledge (for Linux) or PowerShell (for Windows)
- Open ports:
30120(TCP/UDP) for game server,40120(TCP) for txAdmin
Estimated time: 30-45 minutes
Difficulty: Beginner
Step 1: System Preparation
The first step in learning how to create a 5M server is preparing your system with the necessary dependencies and firewall rules.
Step 2: Get Your License Key
A Cfx.re license key is required to create a 5M server. This is a critical step that many tutorials skip.
- Visit keymaster.fivem.net
- Sign in with your Cfx.re account (create one if needed)
- Click “Create New Key”
- Copy the generated license key - you’ll need it in the next step
Important: Keep your license key secure. Never commit it to version control or share it publicly.
Step 3: Download FiveM Server Artifacts
Now we’ll download the FiveM server files. This is the core of your 5M server.
Step 4: Set License Key
Before starting your 5M server, you must configure the license key. This is essential for server operation.
Step 5: Set Up Database
A database is required for frameworks like QBCore. Let’s set up MariaDB/MySQL.
Step 6: Run txAdmin Setup Wizard
Now we’ll start the FiveM server and complete the txAdmin setup. This is where your 5M server comes to life.
Step 7: Configure Basic server.cfg
After the wizard completes, you need to verify and configure your server.cfg file. This file controls your 5M server’s behavior.
Step 8: Verify Your 5M Server is Working
Now let’s verify that your server is fully functional and joinable.
Validation Checklist
-
Server Console
- ✅ No license key errors
- ✅ No database connection errors
- ✅ Resources loading successfully
- ✅ Server shows “Server started” message
-
txAdmin Web Interface
- ✅ Accessible at
http://your-server-ip:40120 - ✅ Can log in with admin credentials
- ✅ Server status shows “Online”
- ✅ Accessible at
-
Database Connection
- ✅ Framework tables created (if QBCore installed)
- ✅ No database errors in console
-
Network Connectivity
Test if server is listening on port 30120:
-
Join Test
- Open FiveM client
- Go to “Play” → “Direct Connect”
- Enter:
your-server-ip:30120 - Click “Connect”
- ✅ Should connect and spawn in game
Step 9: (Optional) Set Up Systemd Service (Linux)
For production servers, set up a systemd service so your 5M server starts automatically on boot.
Troubleshooting Common Issues
When learning how to create a 5M server, you may encounter these issues:
License Key Errors
Problem: Server shows “Invalid license key” or “License key required”
Solution:
- Verify environment variable is set:
echo $FIVEM_LICENSE_KEY(Linux) or$env:FIVEM_LICENSE_KEY(Windows) - Check key is active at keymaster.fivem.net
- Try adding to
server.cfg:set sv_licenseKey "your-key"
Database Connection Errors
Problem: Framework fails to connect to database
Solution:
- Verify MariaDB is running:
sudo systemctl status mariadb(Linux) - Test connection:
mysql -u fivem -p fivem_db - Check connection string in
server.cfgmatches database credentials - Ensure database exists:
mysql -u root -p -e "SHOW DATABASES;"
Port Already in Use
Problem: “Port 30120 already in use”
Solution:
- Find process using port:
sudo netstat -tulpn | grep 30120(Linux) orGet-NetTCPConnection -LocalPort 30120(Windows) - Kill process or change port in
server.cfg - Check if another FiveM server is running
Can’t Join Server
Problem: Server shows online but can’t connect
Solution:
- Verify firewall allows port 30120 (TCP and UDP)
- Check server IP is correct
- Ensure
sv_lanis set to0inserver.cfg(not LAN mode) - Test from server itself:
telnet localhost 30120
Resources Not Loading
Problem: Resources fail to start or show errors
Solution:
- Check resource folders exist in
resources/directory - Verify
fxmanifest.luafiles are valid - Check console for specific error messages
- Ensure dependencies are started before dependent resources
Next Steps
Congratulations! You’ve successfully learned how to create a 5M server. Now explore these topics:
- Configure txAdmin Security - Secure your admin interface
- QBCore Framework Guide - Learn framework basics
- Networking Configuration - Set up reverse proxy and SSL
- Performance Optimization - Improve server performance
- Add Your First Resource - Create custom scripts
Summary
This tutorial covered the complete process of how to create a 5M server:
- ✅ System preparation (dependencies, firewall)
- ✅ License key acquisition and configuration
- ✅ FiveM server download and extraction
- ✅ Database setup (MariaDB/MySQL)
- ✅ txAdmin setup wizard completion
- ✅ Basic server.cfg configuration
- ✅ Server validation and testing
- ✅ Optional systemd service setup
Your FiveM server is now ready for players to join!