Linux Administration

How To Install a FiveM Server on Linux

Linux

  1. Create a new folder (for example mkdir /home/username/FXServer/server), this will be used for the server binaries.
  2. Download the latest 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. Generate a license key at https://keymaster.fivem.net.
  7. Set the license key in your server.cfg using sv_licenseKey "licenseKeyGoesHere".
  8. Run the server from the server-data folder.
    8b. 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 you get a lot of errors about citizen:/scripting/, you didn’t use run.cmd.
  • If nothing happens at all except ‘sending heartbeat’, you didn’t use run.cmd and failed to cd to the 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 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

# 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

If you liked this one, we recommend our effortless LAMP stack tutorials:

  1. How to install the latest Ubuntu Linux? Beginner’s guide
  2. How To Install Apache On Ubuntu? The Comprehensive Guide
  3. How To Install MySQL On Ubuntu? The Proven 2021 Guide
  4. How to Install PHP on Ubuntu 20.04? Step-by-step Easy Guide

Or read more of our most read:

How To Install A FiveM Server On Windows
MySQL: The Most Popular Open-Source Database

serverhub

View Comments

Recent Posts

Comprehensive Guide to Oracle, Microsoft SQL Server, PostgreSQL, and MongoDB: Download, Install, and Configure

Introduction to Oracle Database Oracle Database is a widely adopted relational database management system (RDBMS)…

3 weeks ago

Comprehensive Guide to MySQL: Download, Install, and Configure on Ubuntu and macOS

Introduction to MySQL MySQL is one of the most widely used open-source relational database management…

2 months ago

Deep Learning Applications: Factors to Consider in Choosing the Best Server

Deep learning is a type of artificial intelligence that teaches computers to learn from large…

3 months ago

Comprehensive Guide to OpenSSH: Secure Connectivity for Remote Login

OpenSSH or Open Secure Shell is a powerful suite of tools that provides secure remote…

5 months ago

Mastering VMware ESXi: An Ultimate Guide to Virtualization

Virtualization has become a cornerstone of modern IT infrastructure in today's digital era. Among the…

5 months ago

Setting a First Git Server: A ServerHub Comprehensive Guide

Welcome to ServerHub’s comprehensive guide on installing, setting up, and configuring your first Git server!…

6 months ago

This website uses cookies.