Use case · Game server

FiveM server hosting on a Linux bare-metal machine

A FiveM server is FXServer, the Cfx.re platform server, started from a downloaded build (Cfx.re calls it a server artifact) with a free license key from the Cfx.re Portal and port 30120 open on TCP and UDP. This page installs the Linux artifact on Ubuntu, runs txAdmin as a systemd service, keeps its web panel on 40120 behind the firewall, and covers slots, frameworks and the database many of them expect.

See the machines

What FXServer asks for

Cfx.re's server manual starts with an account and a key: register a Cfx account, then create a license key on the Cfx.re Portal. The key goes into sv_licenseKey; without it the console reports that no license key was specified. The Server Download page offers two branches, Recommended and Latest, for Windows and Linux, and states that downloading an artifact means agreeing to Cfx.re's Platform License Agreement. Read it before you build a community on the platform.

Cfx.re publishes no CPU, memory or disk figure for FXServer. The load comes from the resources you run: the framework, the scripts, the custom vehicles and maps players download on join. Size for that set, then watch it with real players on.

ItemValueWhere it is set
Game and connect traffic30120 TCP and UDPendpoint_add_tcp / endpoint_add_udp in server.cfg
txAdmin web panel40120 TCPTXHOST_TXA_PORT environment variable
RCONUDP, off until a password is setrcon_password
Player slots1 to 2048sv_maxClients
License keyFree, from the Cfx.re Portalsv_licenseKey

Linux or Windows

Cfx.re is direct about this: the Linux build is a courtesy port, offered despite distribution compatibility issues and weaker diagnostic tools for native code, and a problem is more likely to get fixed on the Windows build. Linux still runs FXServer without an OS licence, so this page follows it. If you would rather follow Cfx.re's preferred path, the game server machines also take Windows Server, versions through 2025; Windows is billed as a licence on top of the machine, at its monthly price every month, with no discount for paying several months ahead.

Install the Linux artifact

As root on a fresh Ubuntu install. ufw is switched on before any service listens. Port 30120 is opened for players; 40120 gets no rule, because txAdmin binds to every interface by default (TXHOST_INTERFACE, default 0.0.0.0) and that setting also moves the game listener, so the firewall is what keeps the panel private. FXServer runs as a normal host process, so ufw filters it on IPv4 and IPv6 alike. Copy the Linux Recommended fx.tar.xz link from Cfx.re's Server Download page into the ART line first.

# firewall first: SSH, then the game port on TCP and UDP
sed -i 's/^IPV6=.*/IPV6=yes/' /etc/default/ufw
ufw allow OpenSSH
ufw --force enable
ufw allow 30120/tcp
ufw allow 30120/udp

apt update && apt install -y xz-utils wget tmux git
id fivem >/dev/null 2>&1 || useradd -m -s /bin/bash fivem

# paste the Linux Recommended artifact link here
ART='https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/BUILD/fx.tar.xz'
sudo -u fivem bash -c "mkdir -p /home/fivem/server && cd /home/fivem/server && wget -O fx.tar.xz '$ART' && tar xf fx.tar.xz && rm fx.tar.xz" && echo ok

It must print ok. The archive unpacks a run.sh launcher into /home/fivem/server; Cfx.re's own vanilla guide starts the server with bash run.sh +exec server.cfg from the server-data folder.

txAdmin as a service, and its PIN

txAdmin ships inside FXServer. Start the artifact without +exec server.cfg and it starts txAdmin instead, which creates a txData folder for its configs, logs and data, and suggests it as the place to deploy servers. On Linux that folder defaults to the directory holding run.sh, which is the folder you replace on every update, so the unit below moves it to /home/fivem/txData with TXHOST_DATA_PATH. It also runs the server inside a tmux session: that is our choice, not a Cfx.re instruction, so FXServer keeps a real terminal and you can attach to its console with sudo -u fivem tmux attach -t fivem (detach with Ctrl-b, then d).

cat > /etc/systemd/system/fivem.service <<'EOF'
[Unit]
Description=FiveM server (FXServer with txAdmin, in tmux)
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
User=fivem
WorkingDirectory=/home/fivem
ExecStart=/usr/bin/tmux new-session -d -s fivem /usr/bin/env TXHOST_DATA_PATH=/home/fivem/txData /bin/bash /home/fivem/server/run.sh
ExecStop=/usr/bin/tmux kill-session -t fivem
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
EOF
test -f /home/fivem/server/run.sh && systemctl daemon-reload && systemctl enable --now fivem
# give txAdmin a moment, then print its console
sleep 30; sudo -u fivem tmux capture-pane -pt fivem -S -200

On first boot the console shows a banner with its address and the line "Use the PIN below to register" followed by the PIN (core/boot/startReadyWatcher.ts in the txAdmin source). Whoever enters that PIN creates the master admin, so do it privately. On your workstation, run ssh -L 40120:127.0.0.1:40120 you@your-server to forward the panel port, then point a browser at http://127.0.0.1:40120, enter the PIN, link your Cfx.re account and set a backup password.

Then name the server and pick a recipe. Cfx.re's setup guide uses CFX Default FiveM for a first run and warns that other templates may need a database. The deployer asks for your license key, writes a server.cfg into a folder under txData, and starts the server. That file holds the key: keep /home/fivem closed to other users (chmod 750 /home/fivem).

The vanilla route: server.cfg by hand

Cfx.re's vanilla guide leaves txAdmin out. As the fivem user, clone https://github.com/citizenfx/cfx-server-data.git into /home/fivem/server-data, write a server.cfg there, and start the artifact with +exec. The lines from Cfx.re's sample config that decide whether players get in:

  • endpoint_add_tcp "0.0.0.0:30120" and endpoint_add_udp "0.0.0.0:30120": the listeners. The sample says to change only the port unless the machine has several network interfaces.
  • set onesync on and sv_maxclients 48: the sync mode and the slot count.
  • sv_licenseKey "your-key": the key from the Portal.
  • #sv_master1 "": keep the #. Without it, the server is listed as private.
  • ensure lines for the stock resources: mapmanager, chat, spawnmanager, sessionmanager, basic-gamemode, hardcap and rconlog.

Create the file private before the key goes in: install -m 600 -o fivem -g fivem /dev/null /home/fivem/server-data/server.cfg. Cfx.re's start line is cd /home/fivem/server-data && bash /home/fivem/server/run.sh +exec server.cfg; in the unit above that means WorkingDirectory=/home/fivem/server-data and +exec server.cfg after run.sh. Leave +exec off and you get txAdmin again.

Frameworks and the database behind them

Cfx.re's frameworks page lists ESX, ND, QBCore, Qbox and vRP for FiveM, says it supports none of them, and recommends deploying them through txAdmin recipes. A recipe that needs a database asks for its host, port, user, password and name; txAdmin's env-config page lists those same fields as TXHOST_DEFAULT_DB* presets, with port 3306 in its example. On the same machine, MariaDB from Ubuntu's repositories is enough; its 50-server.cnf sets bind-address = 127.0.0.1, and ufw has no rule for 3306 either way.

# as root: a database and user for the recipe; refuses to run twice
apt install -y mariadb-server
if [ -s /root/fivem-db.txt ]; then echo 'already done, see /root/fivem-db.txt'; else
  p=$(openssl rand -hex 24) && [ -n "$p" ] && install -m 600 /dev/null /root/fivem-db.txt && \
  mariadb -e "CREATE DATABASE IF NOT EXISTS fivem; CREATE OR REPLACE USER 'fivem'@'localhost' IDENTIFIED BY '$p'; CREATE OR REPLACE USER 'fivem'@'127.0.0.1' IDENTIFIED BY '$p'; GRANT ALL ON fivem.* TO 'fivem'@'localhost'; GRANT ALL ON fivem.* TO 'fivem'@'127.0.0.1';" && \
  echo "user fivem password $p" > /root/fivem-db.txt && echo ok
fi

Give the deployer host 127.0.0.1, port 3306, database fivem, user fivem and the password from /root/fivem-db.txt. The password passes briefly through the process list while the mariadb command runs; on a machine with one tenant, that is only you.

Slots, OneSync and the server list

  • OneSync is Cfx.re's server-side sync. It is free up to 48 slots; past that you need an Element Club Argentum subscription or higher from the Cfx.re Portal.
  • sv_maxClients takes 1 to 2048. Values from 32 need onesync set to on or legacy, and values above 64 need it on.
  • OneSync Infinity is on by default (onesync_enableInfinity) and is what allows up to 2048 players.
  • The list polls your server from the Cfx.re addresses in https://static.cfx.re/ips.txt. If you ever narrow 30120 to an allow-list, include all of them.
  • First listing can take up to 8 minutes after launch. Check http://your-ip:30120/info.json from outside: it should return JSON.

Updates and copies

To update, download the new Recommended artifact into a fresh folder, systemctl stop fivem, move the old /home/fivem/server aside, put the new folder in its place, and start again; txData is outside it and stays put. Keep the old folder until the new build has run a session with players.

For backups, copy /home/fivem/txData (txAdmin's accounts, the deployed server folder with its resources and server.cfg), /home/fivem/server-data if you took the vanilla route, and a mariadb-dump of the fivem database to another machine. The archive holds your license key and database password, so keep it private.

Which machine

The game server line-up lists single-socket processors rated 2,000 or more on PassMark's single-thread test. That page credits the bar to Satisfactory's dedicated server documentation; Cfx.re publishes no such figure for FXServer. The Intel Xeon E3-1585L v5 build, with NVMe and sold in all five cities, suits one community server; the many-core EPYC lines suit a production server beside a development copy, each with its own txData, port and key. Every processor in that table is Intel or AMD x86.

Put the machine near your players. North American communities: the two US coasts (New York or San Francisco) or Miami. European ones: Amsterdam or Bucharest. The data center page has a test IP per city to ping first. Ready servers go live about 30 minutes after the order is approved; builds to order take 4 to 24 hours. Nothing meters the port, which matters when every player downloads your resources on join. More on choosing an image is on the Linux server page.

Questions

Is a Cfx.re license key free?

Yes. Cfx.re's manual says to register a free license key on the Cfx.re Portal before setting up a server. It goes into sv_licenseKey, or into the txAdmin deployer, which writes it there. Setting sv_lan to true skips the key check, but the server then stays off the public list and serves the local network only.

How many players can one FiveM server hold?

Up to 48 with OneSync at no cost. Above 48 you need Element Club Argentum or a higher tier, then raise sv_maxClients on the latest artifact and restart. With OneSync Infinity the ceiling is 2048. How many your scripts can carry smoothly is something to measure, not read off a table.

Do I have to use txAdmin?

No. Cfx.re's vanilla guide clones the cfx-server-data repository, writes server.cfg by hand with your key and the endpoint lines, and starts run.sh +exec server.cfg from that folder. txAdmin adds recipe deployment, a web console, scheduled restarts with warnings and a player database, and Cfx.re's frameworks page recommends its recipes for deploying a framework.

My server runs but is not in the list. Why?

Cfx.re's server issues page points to the firewall first: test a direct connect your-ip:30120 from the FiveM console (F8) and open /info.json on the same address. Make sure sv_master1 is still commented out in server.cfg, since setting it marks the server private. A new server can take up to 8 minutes to appear.

Can I run two FiveM servers on one machine?

Yes, as two processes. txAdmin's documentation strongly encourages a separate txData for each, otherwise their admins.json files conflict. Give the second one its own unit, TXHOST_DATA_PATH, TXHOST_TXA_PORT and TXHOST_FXS_PORT and open its game port on TCP and UDP.

Pick the machine for your city

Choose a processor from the single-thread table, a city near your players, and install FXServer as root.

See the machines

Related on Server Room

Other use cases