keepcalculator

06 Numbers and Powers

How to Host a FiveM Server: Full Setup Guide

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

This guide walks you through hosting your own FiveM server, from choosing a hosting method to getting your server online and playable. You’ll learn the key decisions (local vs. dedicated vs. VPS), the exact steps for the most common setup, and how to avoid the pitfalls that trip up first-time hosts. You don’t need to be a programmer, but basic comfort with folders, files, and following instructions is assumed.

What You’ll Need

  • A copy of Grand Theft Auto V on PC (Steam, Epic, or Rockstar Launcher). FiveM does not include the game; it’s a multiplayer modification that runs on top of it.
  • A Windows or Linux machine to run the server. This can be your own PC, a dedicated server, or a VPS. Minimum specs: 4 CPU cores, 8 GB RAM (16 GB recommended), and 50 GB free disk space. For more than 32 players, aim for 8 cores and 16+ GB RAM.
  • A stable internet connection with a public IP address (if hosting locally) and sufficient upload bandwidth. You’ll need at least 10 Mbps upload for a small server; more for larger ones.
  • Optional but recommended: A domain name or a static IP from your ISP, and a basic understanding of port forwarding.

Step-by-Step

  1. Choose your hosting method.
    • Local hosting: Run the server on your own PC. Easiest and free, but your game performance will suffer, and your IP is exposed. Fine for testing with friends.
    • VPS (Virtual Private Server): Rent a cloud server (e.g., from providers like OVH, Hetzner, or AWS). More control, better uptime, and doesn’t affect your gaming PC. Recommended for public servers.
    • Dedicated server: Rent a physical machine. Best performance but most expensive. Overkill for most communities.
  2. Install the required tools.
    • Download and install Git (for cloning the server files) and Node.js (LTS version) from their official sites.
    • On Windows, you’ll also need Visual Studio Build Tools (with the “Desktop development with C++” workload) to compile resources that include native code.
  3. Download the FiveM server files.
    • Open a terminal (Command Prompt or PowerShell on Windows, Bash on Linux).
    • Navigate to the folder where you want the server (e.g., cd C:\fivem-server).
    • Run: git clone https://github.com/citizenfx/fivem.git — this downloads the latest server build. (Alternatively, download the Windows or Linux server build from the FiveM “Server Build” page and extract it.)
  4. Set up the server data folder.
    • Inside the cloned folder, you’ll see a server.cfg file. Open it in a text editor (like Notepad++ or VS Code).
    • Change the endpoint_add_tcp and endpoint_add_udp lines to your server’s public IP (or leave as 0.0.0.0 to listen on all interfaces) and a port (default 30120).
    • Set sv_hostname to your server’s name, sv_maxclients to your desired player limit, and sv_port to the same port as above.
    • Add a sv_licenseKey line — you’ll get this key in the next step.
  5. Get a license key.
    • Go to the FiveM Keymaster (keymaster.fivem.net) and sign in with your Cfx.re account (you can create one for free).
    • Click “New Server” and fill in the details. You’ll receive a license key that looks like cfxk_....
    • Paste this key into your server.cfg as sv_licenseKey "cfxk_...".
  6. Add resources (optional but essential for a real server).
    • Resources are the scripts and assets that make your server unique (e.g., car packs, jobs, admin tools).
    • Create a folder called resources in your server directory if it doesn’t exist.
    • Download free resources from GitHub or the FiveM forums. Place each resource in its own subfolder inside resources.
    • In server.cfg, add ensure [resource-name] for each resource you want to start. (You can also use start [resource-name].)
  7. Run the server.
    • On Windows, double-click FXServer.exe (or run FXServer.exe from the command line with the +exec server.cfg argument: FXServer.exe +exec server.cfg).
    • On Linux, run ./alpine/run.sh +exec server.cfg (make sure the file is executable with chmod +x).
    • Watch the console output for errors. If everything loads, you’ll see “Resources started” and your server will be online.
  8. Port forward (if hosting locally).
    • Log into your router’s admin page (usually via 192.168.1.1 or 192.168.0.1).
    • Find the “Port Forwarding” section.
    • Create a rule that forwards TCP and UDP port 30120 (or your chosen port) to your local IP address (e.g., 192.168.1.100).
    • Save and apply. If you have a firewall, allow inbound connections on that port for FXServer.exe.
  9. Test and connect.
    • Open FiveM, press F8 to open the console, and type connect your-public-ip:30120 (or just connect localhost if testing on the same machine).
    • If you see your server in the server list, you’re done!

Common Mistakes

  • Forgetting to set the license key: The server won’t start without a valid sv_licenseKey.
  • Wrong port: If you change the port in server.cfg, you must also update the port forwarding and the connect command.
  • Not updating server files: FiveM updates frequently. Use git pull in the server folder to get the latest build.
  • Missing resources dependencies: Some resources require others to be loaded first. Check the resource’s README for dependencies.
  • Using a dynamic IP: If your home IP changes, players won’t be able to connect unless you use a dynamic DNS service or a static IP.

Tips

  • Use a VPS for public servers: It’s more reliable and doesn’t affect your gaming experience. Plus, you get a static IP.
  • Back up your server files regularly: Copy the entire server folder (especially resources and server.cfg) to a cloud drive or external disk.
  • Start with a few resources: Don’t overload your server with hundreds of scripts at first. Add them gradually and test after each addition.
  • Monitor your server: Use the console and tools like txAdmin (a web-based admin panel) to manage your server easily.
  • Set a server password for testing: Use sv_password "secret" in server.cfg to keep random players out while you test.

Troubleshooting

  • Server won’t start: Check the console for errors. Common fixes: missing license key, invalid resource name, or missing dependencies. Make sure your server.cfg is saved in UTF-8 format.
  • Players can’t connect: Verify your port forwarding is correct and that your firewall allows inbound traffic on the port. Also, check that your server IP is reachable from outside (use a port checker tool). If you’re on a VPS, check the provider’s firewall rules.
  • Server crashes on startup: Often caused by a faulty resource. Disable all resources by commenting out ensure lines, then re-enable them one by one to find the culprit.
  • High ping or lag: This is usually a bandwidth issue. Lower sv_maxclients or move to a VPS with better network. Also, avoid running other heavy applications on the same machine.
  • Resources not working: Check the resource’s console output for errors. Make sure the resource folder name matches the ensure line (case-sensitive).

Frequently Asked Questions

Do I need to own GTA V to host a FiveM server?

Yes, you need a legitimate copy of GTA V on PC. FiveM is a modification that requires the base game files. You don’t need a separate copy for the server, but each player also needs their own copy.

Can I host a FiveM server for free?

Yes, you can host it on your own PC for free, as long as your hardware and internet can handle it. You’ll only pay for electricity and your internet connection. Alternatively, some VPS providers offer free tiers, but they may not meet the minimum specs.

What’s the difference between a VPS and a dedicated server?

A VPS is a virtual machine that shares physical hardware with other users, while a dedicated server is a physical machine entirely for you. VPS is cheaper and sufficient for most FiveM servers; dedicated is for large communities with high player counts.

How many players can I host?

It depends on your hardware and bandwidth. A typical VPS with 8 GB RAM can handle 32-64 players, but CPU and network are also limiting factors. For more than 100 players, you’ll need a powerful dedicated server and a high-bandwidth connection.

Do I need to port forward if I use a VPS?

No, you don’t. On a VPS, you control the firewall directly (or via the provider’s panel). You just need to open the port in the server’s firewall (e.g., using ufw on Linux) and ensure the provider doesn’t block it.

Can I run a FiveM server on a Mac?

Officially, FiveM server builds are available for Windows and Linux. Running on macOS is not supported, but you could run a Linux virtual machine on your Mac to host it.

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 →