Skip to main content

Creating a FiveM Server

Disclaimer

This documentation is provided for informational purposes only.

IMS - Cloud by IMS - Network offers compute services and does not provide direct FiveM server hosting.

Customers are solely responsible for complying with FiveM's Terms of Service, as well as setting up and managing their FiveM servers.

IMS - Cloud is not affiliated with or endorsed by Cfx.re or FiveM. For official FiveM documentation, please refer to docs.fivem.net.

1. Create a Compute Instance

First, create a new compute instance. You can follow the steps in the Getting Started guide to create a new compute instance.

You can lern more about the different types of compute instances here.

Recommended Specs
  • Type: A
  • RAM: 6GB
  • vCPUs: 4
  • Storage: 80GB NVMe SSD
  • OS: Ubuntu 20.04 LTS (64-bit) Optimzed & Updated
  • Region: Closest to your location for the best performance

2. Connect to your Compute Instance

Once your compute instance is created, connect to it using SSH. You can follow the steps in the Connecting to your Compute Instance guide to connect to your compute instance.

3. Install FiveM Server

Create a Directory for Server Binaries

First, create a new directory for the server binaries:

mkdir -p ~/fivem/server

Download the Latest FiveM Server Build

Next, download the recommended master branch build for Linux from the Linux server build listing:

wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/xxxxxx-fivem.zip

Extract the Downloaded Archive

Finally, extract the downloaded file:

tar xf fx.tar.xz

Clone cfx-server-data

Clone the cfx-server-data repository to your server directory:

git clone https://github.com/citizenfx/cfx-server-data.git ~/fivem/server

Make a server.cfg file in your server-data folder. You can use the example below as a template.

4. Running the Server

Starting the FiveM Server

Navigate to the ~/fivem/server directory and run the following command to start the server:

./run.sh +exec server.cfg

If you want to run the server in the background, you can use screen:

screen -S fivem-server ./run.sh +exec server.cfg

You can detach from the screen session by pressing Ctrl + A + D. To reattach later, use:

screen -r fivem-server

Creating a Service to Start the Server on Boot

To ensure the server starts automatically on boot, create a systemd service:

sudo nano /etc/systemd/system/fivem-server.service

Add the following content to the file:

[Unit]
Description=FiveM Server
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/fivem/server
ExecStart=/root/fivem/server/run.sh +exec server.cfg
Restart=on-failure

[Install]
WantedBy=multi-user.target

Save the file and enable the service to start on boot:

sudo systemctl enable fivem-server

Start the service immediately:

sudo systemctl start fivem-server

To check the status of the service, use:

sudo systemctl status fivem-server

Exmple server.cfg file

nano /fivem/server/server-data/server.cfg
# 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 "he-IL"

# 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. This is not usually shown anywhere in listings.
sv_hostname "FiveM Server | 🇮🇱"

# Set your server's Project Name
sets sv_projectName "My FiveM Server Project"

# Set your server's Project Description
sets sv_projectDesc "Bring Them Back Home Now 🎗️"

# Set Game Build (https://docs.fivem.net/docs/server-manual/server-commands/#sv_enforcegamebuild-build)
#sv_enforceGameBuild 2802

# 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 want your server to be listed as 'private' in the server browser.
# Do not edit it if you *do not* want your server listed as 'private'.
# Check the following url for more detailed information about this:
# https://docs.fivem.net/docs/server-manual/server-commands/#sv_master1-newvalue
#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
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