keepcalculator

06 Numbers and Powers

FiveM Roleplay Server Setup: Step-by-Step

Card No. 06·68667 · Updated · Standard formula, shown below

This guide walks you through setting up your own FiveM roleplay server, from installing the required software to configuring your server for players. You’ll need a Windows or Linux machine (a VPS is recommended for 24/7 hosting), a legal copy of Grand Theft Auto V, and a basic understanding of file management. By the end, you’ll have a functional server that friends or the public can join.

What You’ll Need

  • A computer or VPS running Windows Server 2012+, or a modern Linux distro (Ubuntu 20.04+ recommended)
  • Grand Theft Auto V (for server assets and client-side files)
  • Stable internet connection with open ports (default: 30120)
  • Basic knowledge of editing text files and using command line (optional but helpful)
  • Optional: a domain name if you want a custom server IP

Step-by-Step

  1. Download the FiveM Server Files – Go to the official FiveM website and download the server artifacts for your operating system. You’ll get a ZIP file containing the server core.
  2. Create a Server Directory – Extract the ZIP into a folder where you want your server to live. For example, D:\fivem-server on Windows or /home/user/fivem-server on Linux. Make sure the path has no spaces or special characters.
  3. Set Up the Server Configuration – In the server root, create a file named server.cfg. This is the main configuration file. At minimum, include:
    endpoint_add_tcp "0.0.0.0:30120"
    endpoint_add_udp "0.0.0.0:30120"
    sv_hostname "My Roleplay Server"
    sv_maxclients 32
    sv_port 30120

    Add your server license key (obtained from the FiveM keymaster) by including sv_licenseKey "your-key-here".

  4. Add Resources (Scripts and Maps) – Download roleplay resources like es_extended (ESX) or qbcore from trusted sources (e.g., GitHub). Place each resource folder into the resources directory. Then, in server.cfg, add lines like:
    ensure es_extended
    ensure qb-core
    ensure your-custom-script

    The order matters – core frameworks first, then dependencies.

  5. Install a Database (if needed) – Most roleplay frameworks require a MySQL database. Install MySQL or MariaDB, create a database (e.g., fivem), and note the credentials. In your resource config files (like server.cfg or a database config), set the connection details:
    set mysql_connection_string "server=localhost;database=fivem;userid=root;password=yourpass"
  6. Start the Server – Run the server executable. On Windows, run FXServer.exe; on Linux, run ./run.sh. Watch the console for errors. If it starts without crashing, you’ll see a message like “Server started.”
  7. Test Locally – Launch GTA V, open the console (~ key), and type connect localhost:30120. If everything works, you’ll join your server.
  8. Port Forwarding (for public access) – To let others join, forward TCP and UDP port 30120 on your router to your server’s local IP. If using a VPS, open the port in the firewall (e.g., ufw allow 30120 on Ubuntu).
  9. Set Up Admin and Permissions – Use the built-in ace system or a framework’s admin menu. For example, in server.cfg:
    add_ace group.admin command allow
    add_principal identifier.steam:YOUR_STEAM_ID group.admin

    Find your Steam ID via steamid.io.

  10. Customize Gameplay – Add jobs, vehicles, and UI by installing additional resources. Configure your framework’s settings (e.g., starting money, spawn points) in its config files.
  11. Keep It Updated – Regularly update FiveM server artifacts and your resources to the latest versions to avoid bugs and security issues.

Common Mistakes

  • Missing license key – Without a valid key, the server won’t start. Get one from the FiveM keymaster (free for up to 32 slots).
  • Incorrect resource order – Loading a script before its dependency causes errors. Always load core frameworks first.
  • Forgetting to open ports – Players get “connection refused” if port 30120 is closed.
  • Using spaces in folder paths – This can break resource loading. Use underscores instead.
  • Not setting the database – Many frameworks silently fail if the DB isn’t connected.

Tips

  • Use a VPS with at least 4GB RAM for a stable 32-player server.
  • Back up your server.cfg and database regularly.
  • Start with a pre-made roleplay pack (like ESX or QBCore) to save time.
  • Test each resource individually before adding more to isolate issues.
  • Join FiveM community forums for support and free resources.

Troubleshooting

Server won’t start – Check the console for error messages. Common causes: missing license key, invalid resource paths, or port already in use. Ensure no other application uses port 30120.

Players can’t connect – Verify port forwarding and firewall rules. Test locally first. If local works but remote doesn’t, the port is likely blocked.

Resources fail to load – Look for errors in the console. Make sure all dependencies are installed and the resource names in ensure lines match folder names exactly.

Database errors – Check your MySQL credentials and that the database exists. Test the connection with a tool like MySQL Workbench.

Lag or crashes – Reduce sv_maxclients, disable heavy scripts, or upgrade your server hardware.

Frequently Asked Questions

Do I need to own GTA V to run a server?

Yes, you need a legal copy of GTA V on your server machine to host the game assets. Players also need their own copy.

Is it free to host a FiveM server?

The server software is free, but you may pay for hosting or a VPS. A home PC can work for small groups.

Can I run a server on Linux?

Yes, FiveM provides Linux server artifacts. The setup is similar, but you’ll use command-line tools.

How do I get a server license key?

Go to the FiveM keymaster, log in with your Cfx.re account, and generate a key. It’s free for up to 32 slots.

What’s the best framework for roleplay?

ESX and QBCore are the most popular. ESX is older and widely documented; QBCore is more modern and easier to customize.

How do I update my server?

Download the latest server artifacts from FiveM, replace the old files (keep your server.cfg and resources), and restart.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →