Short answer: to run a FiveM server on a Linux VPS, download the recommended FXServer build (the “artifact”), start it without a config so it opens txAdmin on port 40120, link your Cfx.re account and deploy a server recipe with a free key from the Cfx.re Portal. Players connect on port 30120, which has to be open for both TCP and UDP. Framework recipes such as QBCore, Qbox or ESX also need a MariaDB database.
This guide sets that up on Debian 12/13 or Ubuntu 24.04 with FXServer running as its own user under systemd, txAdmin kept off the public internet, and an update routine that does not throw away your server data.
What do you need before you start?
- A Cfx.re account and a server key. Sign in at portal.cfx.re and create a server registration key. Cfx.re is retiring Keymaster, the old key site, in favour of the Portal, so older guides that send you there are out of date. The key goes into
sv_licenseKey, or into txAdmin when it asks. - A slot count that fits the free tier. A free key runs OneSync with up to 48 players. Past that you need a paid Element Club tier on the same account.
- The terms. FiveM belongs to Rockstar Games, and servers run under Rockstar’s Creator Platform License Agreement plus the Rockstar terms of service (linked from fivem.net/terms). They govern what you may sell to players and what content is allowed. Read them before you open a store.
Which ports does a FiveM server need?
| Port | Protocol | Used by | Open to |
|---|---|---|---|
30120 | TCP and UDP | Players connecting to FXServer | Everyone |
40120 | TCP | txAdmin web panel | Your IP only, or nobody (SSH tunnel) |
3306 | TCP | MariaDB, for framework servers | Nobody, local only |
FiveM needs both protocols on 30120, and opening only one of them is a common reason players cannot get in. The port comes from the endpoint_add_tcp and endpoint_add_udp lines in server.cfg, so if you change it there, change the firewall to match.
How much RAM and CPU does a FiveM server need?
Cfx.re publishes no RAM figure; it only recommends a 64-bit Linux or Windows machine with a multi-core CPU and decent upstream bandwidth. What a server actually uses depends on the resources you load far more than on the player count. Reasonable starting points:
| Server | RAM | vCores |
|---|---|---|
| Vanilla or test server, a few friends | 2–4 GB | 2 |
| Framework server with MariaDB, up to 48 players | 8 GB | 4 |
| Large roleplay server, many streamed assets | 16 GB or more | 4–8 |
Per-core speed tends to matter more than memory. Much of your resources’ script work runs on FXServer’s main server thread, so a few fast cores beat many slow ones, and a single badly written resource can make the whole server hitch. txAdmin’s dashboard shows host CPU and memory use next to a server performance chart and the player count; watch it on a busy evening before you decide you need a bigger plan. Disk use grows with streamed cars, maps and clothing, so leave 40 GB or more.
How do I install FXServer on Linux?
- 1Create a service user and install the tools
Debian · Ubuntu sudo apt update sudo apt install -y curl ca-certificates xz-utils jq sudo useradd --system --create-home --home-dir /opt/fivem --shell /usr/sbin/nologin fivem sudo -u fivem -H mkdir -p /opt/fivem/server /opt/fivem/txData - 2Download the recommended artifact
Artifacts are FXServer builds, and txAdmin is included in them. Use the build marked recommended, not simply the newest. The line below asks the same version feed the Server Download page uses; if you prefer, copy the recommended Linux link from the Cfx.re docs by hand instead.
Debian · Ubuntu URL=$(curl -fsSL https://changelogs-live.fivem.net/api/changelog/versions/linux/server \ | jq -r .recommended_download) echo "$URL" # should end in /fx.tar.xz sudo -u fivem -H curl -fL -o /opt/fivem/fx.tar.xz "$URL" sudo -u fivem -H tar -xf /opt/fivem/fx.tar.xz -C /opt/fivem/server ls /opt/fivem/server # run.sh and alpine/ should be hereThe archive is named
fx.tar.xzfor the standard FiveM build. Servers for FiveM for GTAV Enhanced use a separate package, namedcfx-server-linux_x64on Linux, so make sure you download the build that matches the game your players run. - 3Run it as a systemd service
Starting
run.shwithout+exec server.cfgstarts txAdmin, which then starts and restarts FXServer for you. systemd’s job is to keep txAdmin itself alive.TXHOST_DATA_PATHmoves txAdmin’s data folder out of the artifact folder, so an update can replace that folder without touching your servers:/etc/systemd/system/fivem.service [Unit] Description=FiveM server (txAdmin + FXServer) After=network-online.target mariadb.service Wants=network-online.target [Service] Type=simple User=fivem Group=fivem WorkingDirectory=/opt/fivem/server Environment=TXHOST_DATA_PATH=/opt/fivem/txData ExecStart=/bin/bash /opt/fivem/server/run.sh Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.targetstart it and find the PIN sudo systemctl daemon-reload sudo systemctl enable --now fivem sudo journalctl -u fivem -f # txAdmin prints its address and a setup PIN
How do I set up the server in txAdmin?
txAdmin listens on every interface by default, and until you finish setup anyone holding the PIN can claim it. If ufw is not active yet, run the firewall commands below first, then reach txAdmin through an SSH tunnel instead of opening port 40120:
ssh -L 40120:127.0.0.1:40120 you@203.0.113.10
# then open http://localhost:40120 in your browser- 1Link your account
Enter the PIN from the log, click Link Account and sign in with your Cfx.re account. Then set a backup password for the txAdmin login.
- 2Pick a recipe
Name the server and choose Popular Recipes. CFX Default FiveM gives you a plain server to test with. Framework recipes (QBCore, Qbox, ESX) also ask for database details, so create the database first, as described below.
- 3Enter the key and deploy
Accept the suggested folder under
/opt/fivem/txData, open the recipe deployer, paste your Cfx.re key and run the recipe. When it finishes, choose Save & Run Server, and the live console shows FXServer starting.
How do I set up MariaDB for QBCore, Qbox or ESX?
Frameworks keep characters, inventories and money in a MySQL-compatible database through the oxmysql resource. Its developers recommend MariaDB. On Debian and Ubuntu the server package listens on localhost only by default, which is what you want, so port 3306 stays closed. Create one database and one user for FiveM:
sudo apt install -y mariadb-server
openssl rand -hex 24 # use this as the database password
sudo mariadb <<'SQL'
CREATE DATABASE fivem CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'paste-the-generated-password';
GRANT ALL PRIVILEGES ON fivem.* TO 'fivem'@'localhost';
FLUSH PRIVILEGES;
SQLGive the recipe deployer host localhost, port 3306, user fivem, that password and database fivem. A hex password matters here: oxmysql’s documentation warns that characters such as @, :, / and # break the connection string. If you wire a framework up by hand, the line in server.cfg looks like this:
set mysql_connection_string "mysql://fivem:PASSWORD@localhost:3306/fivem"
ensure oxmysql
# start the framework resources after oxmysqlUse set, never setr: setr replicates a convar to every connecting client, password included. For backups, users and tuning, see installing MariaDB on Ubuntu and Debian.
Which server.cfg settings matter?
txAdmin writes a working server.cfg into the deployed server folder and has a built-in CFG editor for it. These are the lines worth checking first:
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
sv_hostname "My FiveM server"
sets sv_projectName "My project"
sets sv_projectDesc "One line for the server list"
sets locale "en-US"
sets tags "roleplay, economy"
set onesync on
sv_maxclients 48
sv_licenseKey "cfxk_..."setspublishes a value to the server list;setkeeps it on the server.set onesync onturns on OneSync, FiveM’s server-side sync. The free tier allows it up to 48 slots, and current frameworks expect it.- Leave
rcon_passwordunset. txAdmin’s console and in-game menu do the same job without another open door.
How do I open the firewall?
Open 30120 for both protocols, and 40120 only for your own address if you would rather not use the tunnel. Allow SSH before enabling ufw, as the ufw guide explains:
sudo ufw allow OpenSSH # first, if ufw is not active yet
sudo ufw allow 30120/tcp comment 'FiveM'
sudo ufw allow 30120/udp comment 'FiveM'
sudo ufw allow from 203.0.113.7 to any port 40120 proto tcp comment 'txAdmin, my IP' # optional
sudo ufw enable
sudo ufw status numberedReplace 203.0.113.7 with your own public IP address. MariaDB needs no rule: it only listens on localhost.
How do I update FXServer without losing anything?
txAdmin warns you when your artifact is too old. Because txData lives outside the artifact folder, an update replaces that folder and nothing else. Keep the old one until the new build has run for a day:
sudo systemctl stop fivem
URL=$(curl -fsSL https://changelogs-live.fivem.net/api/changelog/versions/linux/server \
| jq -r .recommended_download)
sudo -u fivem -H curl -fL -o /opt/fivem/fx.tar.xz "$URL"
sudo rm -rf /opt/fivem/server.old # removes the previous rollback copy
sudo mv /opt/fivem/server /opt/fivem/server.old
sudo -u fivem -H mkdir /opt/fivem/server
sudo -u fivem -H tar -xf /opt/fivem/fx.tar.xz -C /opt/fivem/server
sudo systemctl start fivemWhy can’t players join my FiveM server?
- Players time out while connecting: UDP 30120 is closed. Check
sudo ss -tulpn | grep 30120on the server, then the firewall. no license key was specified: the key is missing fromserver.cfg, or a manual start skipped+exec server.cfgor ran from the wrong folder, so the config never loaded.- Database errors at boot: MariaDB is not running (
systemctl status mariadb), the credentials are wrong, or the framework starts beforeoxmysql. - Server not in the list: give it a few minutes after start, and make sure
sv_master1 ""is not set, which lists the server as private. - Nobody past the 48th player can join: that is the free slot limit. Raising
sv_maxclientsbeyond it needs a paid tier.
FiveM hosting or your own VPS?
Managed FiveM hosting gives you a panel and someone else’s setup. A VPS gives you root, any artifact you want, your own MariaDB and the freedom to run a Discord bot or a website on the same box. The txAdmin flow above makes the gap small. For the hardware, script-heavy servers want fast cores: our Hi-CPU KVM plans run on AMD EPYC with ECC memory in Amsterdam, and every plan sits behind always-on DDoS mitigation at no extra cost. Public roleplay servers draw attacks, so read what DDoS protection on a VPS covers before launch night. If your community also plays Rust, the same approach of a service user, systemd and a strict firewall is in our Rust server guide. To size FiveM against eight other games on both lines, see gaming VPS.
Frequently asked
Do I need a license key to run a FiveM server?
Yes. Every FXServer needs a server key, which you create for free in the Cfx.re Portal at portal.cfx.re, the site that is replacing the old Keymaster. Put it in sv_licenseKey in server.cfg or paste it into txAdmin's recipe deployer.
Which ports does a FiveM server need?
Players connect on port 30120, which must be open for both TCP and UDP. txAdmin's web panel uses TCP 40120 and should only be reachable from your own IP or through an SSH tunnel, and MariaDB's 3306 should stay closed to the internet.
How many players can a free FiveM server have?
A free Cfx.re key allows up to 48 player slots with OneSync. Raising sv_maxclients beyond 48 requires a paid Element Club tier on the Cfx.re account that owns the key.