Setup a FiveM server

Preamble 

In this tutorial, we will explain every step to successfully install and run a FiveM server.

Prerequisites

  1. Note down the IP address of the machine you’ll install the server on. You can use this link on the machine to find out your IP address.
  2. Download Visual C++ Redistributable 2019 or newer and install it.
  3. Download Git and install it.
  4. Download FiveM server files and click on LATEST RECOMMENDED

  5. Acquire a master key from fiveM
  6. Connect to your machine

Acquiring a Master Key from FiveM :

You can do these step from any computer or mobile device. 

  1. Follow this link and complete the “Make sure your not a robot”
  2. Login or create a new account
  3. Then clic on register


        
  1. The Server Label is the title of your server, its the listed name in your key manager
  2. The server IP address box will contain your VPS IP address.
  3. You should specify that the server is self hosted, otherwise, your server key may get ban by FiveM. They doesn’t allow anyone else than Zap-Hosting as VPS provider.
  4. Clic on Generate
  5. Note down your key, you must (hover your mouse over it to make it appear).


Building our server files structure :

  1. Create a new folder (I placed mine on the desktop), for the sake of this tutorial, I named mine "FXServer".
  2. Inside this folder, create a new folder named "server".
  3. Unzip the server.zip in our new "server" folder.

Using GIT to download and update the server data files : 

  1. Use the "Clone Existing Repository" in Git Gui that we installed previously to download the server data files
  2. Specify the source location and the target directory ()
    Source location is : https://github.com/citizenfx/cfx-server-data.git
    Target Directory must be in another folder than the server files, the folder must not exist

  3. Once the process is completed the server data files should be in the specified folder.

Create the server.cfg file :

  1. In the server-data folder, create a new file, named config.cfg
  2. Edit this file and copy-paste this text in it :
    # Only change the IP if you're using a server with multiple network interfaces, otherwise change the port only.
    endpoint_add_tcp "0.0.0.0:30120"
    endpoint_add_udp "0.0.0.0:30120"

    # These resources will start by default.
    ensure mapmanager
    ensure chat
    ensure spawnmanager
    ensure sessionmanager
    ensure fivem
    ensure hardcap
    ensure rconlog
    ensure scoreboard

    # This allows players to use scripthook-based plugins such as the legacy Lambda Menu.
    # Set this to 1 to allow scripthook. Do note that this does _not_ guarantee players won't be able to use external plugins.
    sv_scriptHookAllowed 0

    # Uncomment this and set a password to enable RCON. Make sure to change the password - it should look like rcon_password "YOURPASSWORD"
    #rcon_password ""

    # A comma-separated list of tags for your server.
    # For example:
    # - sets tags "drifting, cars, racing"
    # Or:
    # - sets tags "roleplay, military, tanks"
    sets tags "default"

    # A valid locale identifier for your server's primary language.
    # For example "en-US", "fr-CA", "nl-NL", "de-DE", "en-GB", "pt-BR"
    sets locale "root-AQ"
    # please DO replace root-AQ on the line ABOVE with a real language! :)

    # Set an optional server info and connecting banner image url.
    # Size doesn't matter, any banner sized image will be fine.
    #sets banner_detail "https://url.to/image.png"
    #sets banner_connecting "https://url.to/image.png"

    # Set your server's hostname sv_hostname "FXServer, but unconfigured"

    # Nested configs!
    #exec server_internal.cfg

    # Loading a server icon (96x96 PNG file)
    #load_server_icon myLogo.png

    # convars which can be used in scripts
    set temp_convar "hey world!"

    # Uncomment this line if you do not want your server to be listed in the server browser.
    # Do not edit it if you *do* want your server listed.
    #sv_master1 ""

    # Add system admins
    add_ace group.admin command allow # allow all commands
    add_ace group.admin command.quit deny # but don't allow quit
    add_principal identifier.fivem:1 group.admin # add the admin to the group

    # Hide player endpoints in external log output.
    sv_endpointprivacy true

    # enable OneSync with default configuration (required for server-side state awareness)
    onesync_enabled true

    # Server player slot limit (must be between 1 and 32, unless using OneSync)
    sv_maxclients 32

    # Steam Web API key, if you want to use Steam authentication (https://steamcommunity.com/dev/apikey)
    # -> replace "" with the key
    set steam_webApiKey ""

    # License key for your server (https://keymaster.fivem.net)
    sv_licenseKey changeme

Create a batch file to automate the starting process :

  1. create a file named RUN.bat
  2. edit the file and write this in it, the save it :

    cd /d C:\Users\[your user name here]\Desktop\FXServer
    server\FXServer.exe +exec server-data\server.cfg

137 Users Found This Useful

Was this answer helpful?

Didn't find a solution?

Our support team is here to help you.

Contact us by sending a support ticket.

Open a ticket

Powered by WHMCompleteSolution