01
Before you start
You need a VPS running Ubuntu 24.04 or Debian 13, a user with sudo rights, and a licence key created free of charge on the Cfx.re portal. For memory, count what your framework and resources need, plus the database and the system: a loaded roleplay server uses far more than a racing server.
If you would rather not administer anything, FiveM hosting delivers all this ready in 30 seconds: the guide VPS or game plan helps you choose.
02
Downloading the artifacts
The FiveM server is distributed as artifacts, published by Cfx.re for Linux. Create a dedicated user, then download the recommended version from Cfx.re's Linux artifacts page (file fx.tar.xz):
sudo apt update && sudo apt install -y xz-utils curl
sudo useradd -r -m -d /opt/fivem -s /bin/bash fivem
sudo -iu fivem
mkdir -p ~/artifacts && cd ~/artifacts
# paste the address of the recommended fx.tar.xz
curl -LO https://…/fx.tar.xz
tar xf fx.tar.xz && rm fx.tar.xz
Take the version marked as recommended rather than the very latest: it is the one common resources have tested.
03
Starting txAdmin
cd ~/artifacts && ./run.sh
On first launch, txAdmin starts and shows a four-digit code. Open http://vps-address:40120 in a browser, enter the code and link your Cfx.re account. txAdmin then offers a recipe: a basic server, or ESX, QBCore and their resources, with server.cfg already written. The txAdmin guide details the next settings.
04
The database
ESX, QBCore and most roleplay frameworks need MariaDB:
sudo apt install -y mariadb-server
sudo mariadb -e "CREATE DATABASE fivem; CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'long-password'; GRANT ALL ON fivem.* TO 'fivem'@'localhost'; FLUSH PRIVILEGES;"
Give this information to the txAdmin recipe, or to the mysql_connection_string line in server.cfg. The database listens locally only: never open its port to the Internet.
05
A service that starts with the VPS
txAdmin restarts FiveM if it crashes; systemd restarts txAdmin and starts it with the machine. Create /etc/systemd/system/fivem.service:
[Unit]
Description=Serveur FiveM (txAdmin)
After=network-online.target mariadb.service
[Service]
User=fivem
WorkingDirectory=/opt/fivem/artifacts
ExecStart=/opt/fivem/artifacts/run.sh
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now fivem
06
Ports and security
- Game port:
sudo ufw allow 30120 (TCP and UDP).
- txAdmin (port 40120): it is the server's admin door. Open it only from your own address (
sudo ufw allow from your-ip to any port 40120 proto tcp), or go through an SSH tunnel.
- Resources: a script found at random can contain a backdoor. Prefer recognised sources and read what you install.
- Backups: a database export (
mariadb-dump), the resources folder and txData, copied off the VPS every night.
- Attacks: roleplay servers often get them; the guide protecting a game server from DDoS attacks explains what to check.
07
Updating
To change version, stop the service, replace the contents of the artifacts folder with the new recommended version, then restart. txData, your resources and the database stay as they are. Keep the previous archive for a few days: if a resource breaks, rolling back takes a minute.
08
On a CloudFive VPS
Our Ryzen VPS runs on Ryzen 9 9950X, with DDR5 memory, NVMe storage and anti-DDoS protection included; the FiveM-specific filter is available as an option for a public server. And if you want the same result without the administration, the FiveM plan comes with txAdmin, databases and Anti-DDoS Premium already in place.
09
Frequently asked questions
Can a FiveM server be installed on a Linux VPS?
Yes. Cfx.re publishes the server artifacts for Linux; txAdmin, shipped with them, installs the framework and writes server.cfg. MariaDB is also needed for ESX or QBCore.
Which ports should be opened for FiveM on a VPS?
Port 30120 in TCP and UDP for the game. txAdmin's port 40120 should only be open to your own address, or reached through an SSH tunnel.
How do I keep FiveM running permanently on a VPS?
With a systemd service that runs run.sh: txAdmin starts with the machine and itself restarts the FiveM server if it crashes.
How do I update FiveM artifacts under Linux?
Stop the service, replace the artifacts folder with the new recommended version, restart. txData, resources and the database do not change.
Does this guide work for a RedM server?
Yes: RedM uses the same artifacts and the same txAdmin. The server is declared as RedM with the set gamename rdr3 line in server.cfg, and VORP Core replaces ESX or QBCore.