NEW: We now offer turnkey FiveM servers on our website if you wish to start your own community right away! Click here to see our offers and get your own server
In this tutorial, we're going to set up your own FiveM server. Installing your own FiveM server is quite simple since the official documentation is very complete. This tutorial will use the Linux version with Debian or Ubuntu.
Installing Dependancies
To install dependancies, you have to be administrator.
Debian Dependancies
apt install wget xz-utils git nano
Ubuntu Dependancies
sudo apt install wget xz-utils git nano
Creating a user
Let's start by creating a new user for our system, in order to isolate rights on our VPS. You have to be administrator to enter this command.
adduser fivem
Once the account has been created, let's connect with:
su - fivem
Installing the FiveM server
To begin, create a new directory to store the FiveM files:
mkdir -p /home/fivem/server/src
cd /home/fivem/server/src
Now that we made the basics, let's retrieve the necessary files. Go to this page and copy the link from the Latest Recommended
button (for example, right when we're making this tutorial: https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/7290-a654bcc2adfa27c4e020fc915a1a6343c3b4f921/fx.tar.xz).
Got the link? Let's download the archive with the wget URL.tar.xz
command.
wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/7290-a654bcc2adfa27c4e020fc915a1a6343c3b4f921/fx.tar.xz
Now, let's extract the archive content:
tar -xvf fx.tar.xz && rm fx.tar.xz
We are now going to retrieve the citizen data using the git
command. The receiving folder must be a folder outside the file tree of the server we have just downloaded.
git clone https://github.com/citizenfx/cfx-server-data.git /home/fivem/server/server-data
Configuring the FiveM server
Now we're going to create the main configuration file named server.cfg
.
Use the touch
command to create the file in /home/fivem/server/server-data
then the nano
command to edit the file:
touch /home/fivem/server/server-data/server.cfg
nano /home/fivem/server/server-data/server.cfg
Now, copy the following contents into 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
To exit nano
and save your changes, press CTRL
+ X
and confirm.
Generate a FiveM license
To work properly, your FiveM server needs a valid license. To create one, go to this website: https://keymaster.fivem.net/ and generate your license by clicking Register a new server
Add a name for your server (only visible by you) and complete the CAPTCHA.
Once the license has been generated, you should see the following screen, with your license key. It will be displayed at the top and the bottom, in the keys
section. Both will provide the same unique key.
Edit the configuration file using nano
. At the bottom of the file is the sv_licenseKey
variable, which you need to edit.
nano /home/fivem/server/server-data/server.cfg
# Edit - sv_licenseKey "licenseKeyGoesHere".
Start the server
We now only have to type those two commands to start the server:
cd /home/fivem/server/server-data/
bash /home/fivem/server/src/run.sh +exec /home/fivem/server/server-data/server.cfg