Setting up a FiveM server

how to create a fivem server

The first step: Create a key

Make sure you have registered a license key on the Cfx.re Keymaster service. You need to have the IP match the IP on which you’re going to first use the key. Afterwards, the key can be used on any IP, but only on one server at a time.

Also create a Steam API key – here: http://steamcommunity.com/dev/apikey

Using the Steam API key manually on the server

Go to http://steamcommunity.com/dev/apikey 14.8k and in Domain name you put what you want then copy the key and then go to your server.cfg and put this:

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

Installation of the FiveM server

Windows

You need:

  1. Visual C++ Redistributable 2019 or newer.
  2. Git to assure a correct installation.

Install the FiveM server:

  1. Create a new directory folder (for example D:FXServerserver), this will be used for the server binaries.
  2. Download the current recommended master branch build for Windows from the artifacts server.
  3. Extract the build into the directory previously created.
    3b. Use any archiving tool (such as WinRAR or 7-Zip).
  4. Clone cfx-server-data in a new folder outside of your server binaries folder, for example, D:FXServerserver-data.
    4b. git clone https://github.com/citizenfx/cfx-server-data.git server-data
  5. Make a server.cfg file in your server-data folder (copy the example server.cfg file below into that file).
  6. Set the license key in your server.cfg using sv_licenseKey "licenseKeyGoesHere".
  7. Run the server from the server-data folder. For example, in a plain Windows command prompt (cmd.exe) window:cd /d D:FXServerserver-data D:FXServerserverFXServer.exe +exec server.cfg (the /d flag is only needed when changing directory to somewhere on a different drive)

Linux

Note that the Linux version of FXServer is only provided as a courtesy port due to issues regarding Linux distribution compatibility and availability of diagnostic tools for native C++ code. If you’re experiencing any issues, you’re more likely to see them fixed if you use the Windows version.

  1. Create a new folder (for example mkdir -p /home/username/FXServer/server), this will be used for the server binaries.
  2. Download the current recommended master branch build for Linux from the artifacts server(copy the URL for the latest server version and use wget <url> to download it).
  3. Extract the build to the directory that was previously created, using cd /home/username/FXServer/server && tar xf fx.tar.xz (you need to have xz installed, on Debian/Ubuntu this is in the xz-utils package).
  4. Clone cfx-server-data in a new folder outside of your server binaries folder.
    4b. For example git clone https://github.com/citizenfx/cfx-server-data.git /home/username/FXServer/server-data
  5. Make a server.cfg file in your server-data folder (copy the example server.cfg file below into that file).
  6. Set the license key in your server.cfg using sv_licenseKey "licenseKeyGoesHere".
  7. Run the server from the server-data folder.
    7b. bash /home/username/FXServer/server/run.sh +exec server.cfg

Common issues of a FiveM server

  • If you don’t get any ‘resources found’, and it says ‘Failed to start resource’, you didn’t ‘cd’ to the right folder.
  • If no resources get started, and you can’t connect, you didn’t add +exec.
  • If you get ‘no license key was specified’, one of the above things applies.

Download a plug&play server?

You can also buy a premade server with pre-made scripts.

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart
en_USEnglish