ℹ️
Installation steps assume a fresh install of Debian or Ubuntu. Steps may need tweaking if other OS or version is used. Steps assuming user logged in as root
Files
Install Dependencies
apt update && apt install -y curl wget jq npm nano git git-lfs
Create Folders
mkdir -p /home/fivem/fx-server && mkdir -p /home/fivem/fx-server-data
Download Latest Artifacts
cd /home/fivem/fx-server && wget https://zedhosting.gg/downloads/fivem_install.sh && bash fivem_install.sh
Download CFX Files
cd /home/fivem/fx-server-data && git clone https://github.com/citizenfx/cfx-server-data .
Database
⚠️
Due to recent changes in the MySQL roadmap it is HIGHLY recommended to use MariaDB which provides all of the same features for FiveM as MySQL and better compatibiity
Install
apt install mariadb-server -y && systemctl enable --now mariadb
Create Default User
mysql -uroot -e "CREATE USER 'zed'@'127.0.0.1' IDENTIFIED BY 'ZedPower';"
mysql -uroot -e "CREATE DATABASE fivem_db;"
mysql -uroot -e "GRANT ALL PRIVILEGES ON fivem_db.* TO 'zed'@'127.0.0.1' ;"
Secure
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DELETE FROM mysql.user WHERE User='';
DROP DATABASE test;
FLUSH PRIVILEGES;
🚫
This by no means is a full guide on securoing your database and are just the default steps that should be performed on any fresh database install
Configure
Open Config
cd /home/fivem/fx-server-data && nano server.cfg
Get License
CFX License Portal→ℹ️
- Enter the generated license key in your server.cfg by replacing the
changeme
value - Exit nano (Ctrl+X -> Y -> Enter)
Service
💡
It is recommened to use PM2 which is a node tool for running and monitoring applications
Install
npm install -g pm2
cd /home/fivem/fx-server && wget https://zedhosting.gg/downloads/fivem_start.sh && wget https://zedhosting.gg/downloads/run.sh
Start
pm2 start fivem_start.sh --name fivem && pm2 startup && pm2 save
Monitor
pm2 logs fivem
pm2 restart fivem
pm2 monit
Updating Server
Download Scripts
cd /home/fivem/fx-server && wget https://zedhosting.gg/downloads/fivem_update.sh
Run Updates
cd /home/fivem/fx-server && bash fivem_update.sh
Base Config File
# 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 "en-US"
# 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 "FXServer Base || Zed Hosting || Free Trial"
# Set your server's Project Name
sets sv_projectName "Zed does Roleplay"
# Set your server's Project Description
sets sv_projectDesc "Zed Hosting Default Setup"
# 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 "ZED"
# 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 (see https://fivem.net/server-hosting for limits) 10 count enables all paid features
sv_maxclients 10
# 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