FiveM is the multiplayer modification framework for Grand Theft Auto V, run by Cfx.re. It powers custom servers, most famously roleplay (RP) communities built on frameworks like QBCore, Qbox and ESX. The FiveM server (FXServer) runs natively on Linux, and txAdmin, the built-in web panel, makes setup and management much easier.
Requirements
- 2–4 vCPU and 4–8 GB RAM for a small to medium server. Large RP servers with many resources (scripts, cars, maps) and 64+ players need more CPU and RAM.
- Fast single-thread CPU and fast disk. Resource loading and the server tick benefit from both.
- MariaDB/MySQL for frameworks like QBCore and ESX.
- Ports 30120 TCP/UDP (game) and 40120 TCP (txAdmin).
- A licence key from the Cfx.re portal (free; tied to your Cfx.re account).
- A location close to your players. RP communities care a lot about latency. See game server VPS.
Follow the Cfx.re terms of service and Rockstar’s platform licence for monetisation rules.
Install FXServer (server artifacts)
sudo apt update && sudo apt install -y xz-utils git tmux
sudo adduser --disabled-password --gecos "" fivem
sudo -iu fivem
mkdir -p ~/fx-server && cd ~/fx-server
# get the URL of a recommended Linux build from the FiveM artifacts page (runtime.fivem.net/artifacts/fivem/build_proot_linux/master/)
wget -O fx.tar.xz "<recommended-artifact-url>/fx.tar.xz"
tar xf fx.tar.xz
Use a recommended artifact build rather than “latest”, which can be unstable.
Start txAdmin
cd ~/fx-server
tmux new -s fivem
./run.sh
On first start, the console shows a txAdmin URL (http://<server-ip>:40120) and a PIN. Open it in your browser, enter the PIN, and link your Cfx.re account. This creates the txAdmin master admin.
Set up a server with a recipe
In the txAdmin setup wizard:
- Choose Popular Recipes, for example QBCore Framework, ESX, or a plain CFX default server.
- Choose a data location (for example
/home/fivem/txData). - Enter your licence key from the Cfx.re portal (
portal.cfx.re→ Server Registration Keys). - For framework recipes, provide database credentials. The recipe creates the tables.
- Let the recipe download resources, and generate
server.cfg, then start the server.
Database setup beforehand:
CREATE DATABASE qbcore CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'strong-password';
GRANT ALL PRIVILEGES ON qbcore.* TO 'fivem'@'localhost';
FLUSH PRIVILEGES;
See MySQL users and privileges.
server.cfg essentials
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
sv_hostname "My RP Server"
sv_maxclients 48
sv_licenseKey "your-key"
set onesync on
set mysql_connection_string "mysql://fivem:strong-password@localhost/qbcore?charset=utf8mb4"
sets tags "roleplay, qbcore"
sv_enforceGameBuild 3095 # game build your resources need
ensure qb-core
# … ensure other resources
OneSync is required for more than 32 players, and by most modern frameworks.
Firewall
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
sudo ufw allow from 203.0.113.50 to any port 40120 proto tcp # txAdmin: your IP only
Better: put txAdmin behind Nginx with HTTPS, and restrict it by IP, or reach it through an SSH tunnel. txAdmin controls the whole server. See UFW and SSH tunnelling.
Running 24/7
txAdmin restarts the server if it crashes, and can schedule daily restarts with in-game warnings (Settings → Restarter). Keep FXServer itself running in tmux, or write a systemd unit that runs run.sh. See tmux and systemd unit files.
Resources and performance
- Add resources (scripts, maps, vehicles) to
resources/, andensurethem inserver.cfg. Only download from trusted sources. Leaked or “cracked” resources often contain backdoors. - Use txAdmin’s resource monitor and the server’s
resmonto find scripts with high CPU time. - Many custom vehicles and maps (streamed assets) increase memory and players’ loading times.
Backups
Back up the database (characters, inventories, vehicles) and the txData folder (server.cfg, resources, txAdmin config):
mysqldump -u fivem -p qbcore | gzip > /backups/fivem-db-$(date +%F).sql.gz
tar czf /backups/fivem-files-$(date +%F).tgz -C /home/fivem txData
See mysqldump and backup strategy.
DDoS
Popular FiveM servers are frequent DDoS targets. Keep the server IP behind Cfx.re’s proxy features where possible, and consider DDoS-protected hosting for public communities. VPS.DO offers DDoS protection as a paid add-on for dedicated servers. See DDoS attack types and dedicated servers.
Quick reference
| Item | Value |
|---|---|
| Game port | 30120 TCP/UDP |
| txAdmin | 40120/tcp (restrict) |
| Start | ./run.sh in the artifacts folder |
| Licence | Cfx.re portal key (sv_licenseKey) |
| Frameworks | QBCore / Qbox / ESX (MariaDB) |
Related: Garry’s Mod server and Pterodactyl panel.