Create a FiveM server
Download the FiveM server base
Creating a FiveM server
FXServer is the name of the Cfx.re platform server. This page shows you how to run it.
Having trouble running your server? Visit server issues, use the Discord #fxserver-support channel or create a topic in the Server Discussion sub-category on the forum.
Before you begin
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.
Traditional installation steps
Windows
Prerequisites
- Visual C++ Redistributable 2019Â or newer.
- Git to assure a correct installation.
Installation
Create a new directory (for exampleÂ
D:\FXServer\server
), this will be used for the server binaries.Download the current recommendedÂ
master
 branch build for Windows from the artifacts server.Extract the build into the directory previously created.
3b. Use any archiving tool (such as WinRAR or 7-Zip).Clone cfx-server-data in a new folder outside of your server binaries folder, for example,Â
D:\FXServer\server-data
.
4b.Âgit clone https://github.com/citizenfx/cfx-server-data.git server-data
Make a server.cfg file in yourÂ
server-data
 folder (copy the example server.cfg file below into that file).Set the license key in your server.cfg usingÂ
sv_licenseKey "licenseKeyGoesHere"
.Run the server from theÂ
server-data
 folder. For example, in a plain Windows command prompt (cmd.exe) window:cd /d D:\FXServer\server-data D:\FXServer\server\FXServer.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.
- Create a new folder (for exampleÂ
mkdir -p /home/username/FXServer/server
), this will be used for the server binaries. - 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). - 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). - 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
- Make a server.cfg file in yourÂ
server-data
 folder (copy the example server.cfg file below into that file). - Set the license key in yourÂ
server.cfg
 usingÂsv_licenseKey "licenseKeyGoesHere"
. - Run the server from theÂ
server-data
 folder.
7b.Âbash /home/username/FXServer/server/run.sh +exec server.cfg
Common issues
- 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.
Â
server.cfg
An example server.cfg follows.
# 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 basic-gamemode
ensure hardcap
ensure rconlog
# 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!"
# Remove the `#` from the below 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
# enable OneSync (required for server-side state awareness)
set onesync on
# Server player slot limit (see https://fivem.net/server-hosting for limits)
sv_maxclients 48
# 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