ServerLoomRapide et Sécurisé
Connexion Commencer

How to install a FiveM server on Linux (Ubuntu) with txAdmin

From a fresh Ubuntu VPS to a running FiveM city: download the Linux server, open the ports, start txAdmin, add a database and keep everything online 24/7.

Intermédiaire 14 min de lecture Mis à jour le 5 déc. 2026 Équipe ServerLoom
Sur cette page

FiveM runs very well on Linux: it uses less RAM than Windows (no desktop to run) and the server restarts quickly. In this guide you install a FiveM server on Ubuntu 22.04 or 24.04, manage it with txAdmin and keep it online 24/7.

What you need

  • An Ubuntu VPS — for up to 32 players about 4 vCores and 8–12 GB RAM, for 64 players 6 vCores and 16 GB (see How much RAM does a FiveM server need?).
  • A free FiveM license key from portal.cfx.re.
  • Your server IP and root password (or SSH key) from your ServerLoom dashboard.
  • About 30 minutes.

Step 1: Connect with SSH

On Windows open PowerShell, on Mac or Linux open Terminal, and type (use the username from your dashboard if it is not root):

Bash
ssh root@YOUR-SERVER-IP

Step 2: Update the server and open the ports

FiveM needs port 30120 (TCP and UDP) for players and 40120 (TCP) for txAdmin. Always allow SSH first, or the firewall locks you out:

Bash
apt update && apt upgrade -yapt install -y xz-utils tmux wget ufw allow OpenSSHufw allow 30120/tcpufw allow 30120/udpufw allow 40120/tcpufw enable

Step 3: Create a user for FiveM

Never run a game server as root: if a script is ever hacked, the attacker only gets this user, not your whole server.

Bash
adduser --disabled-password --gecos "" fivemsu - fivemmkdir -p ~/server ~/server-data

Step 4: Download the FiveM Linux server

Open the FiveM Linux artifacts page in your browser, right-click the build marked LATEST RECOMMENDED and copy the link of fx.tar.xz. Then paste it after wget:

Bash
cd ~/serverwget -O fx.tar.xz "PASTE-THE-LINK-HERE"tar xf fx.tar.xzrm fx.tar.xz

Step 5: Start txAdmin inside tmux

tmux keeps the server running after you close your SSH window.

Bash
tmux new -s fivemcd ~/server && ./run.sh

The console shows a 4-digit PIN. Open http://YOUR-SERVER-IP:40120 on your PC, enter the PIN, log in with your Cfx.re account and choose a backup password.

To leave the console without stopping the server press Ctrl + B, then D. To come back later: su - fivem and then tmux attach -t fivem.

Step 6: Add a database (QBCore / ESX)

Roleplay frameworks store players, money and inventories in MariaDB. Open a second SSH window as root and run:

Bash
apt install -y mariadb-servermysql_secure_installation mysql -e "CREATE DATABASE fivem; CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'CHOOSE-A-STRONG-PASSWORD'; GRANT ALL PRIVILEGES ON fivem.* TO 'fivem'@'localhost'; FLUSH PRIVILEGES;"
Attention

Never open port 3306 in the firewall. Your database only needs to be reached from the server itself (127.0.0.1).

Step 7: Deploy your city

  1. In txAdmin choose Popular Recipes, then QBCore, ESX or CFX Default (not sure? read ESX vs QBCore vs Qbox).
  2. Data location: /home/fivem/server-data.
  3. Paste your license key from portal.cfx.re.
  4. Database: host 127.0.0.1, port 3306, user fivem, your password, database fivem.
  5. Click Run Recipe, then Save & Run Server. Players join with connect YOUR-SERVER-IP:30120 in the F8 console.

Step 8: Start automatically after a reboot

As the fivem user, open the crontab with crontab -e and add this line at the end:

Bash
@reboot cd /home/fivem/server && /usr/bin/tmux new-session -d -s fivem ./run.sh

Troubleshooting

  • ./run.sh: Permission denied — run chmod +x run.sh in the server folder.
  • txAdmin does not open — check the 40120 rule with ufw status, and see txAdmin localhost:40120 fixes.
  • Players time out while joining — UDP 30120 is missing, or your license key is wrong.
  • Server lags with free RAM left — FiveM needs a fast CPU more than many cores; a high-clock Ryzen helps most.

Next step: protect your FiveM server from DDoS attacks and secure your Linux VPS.

Prêt à essayer ? Gardez votre ville en ligne.

ServerLoom Shield toujours actif, Ryzen haute fréquence et une équipe qui connaît FiveM — en ligne 24h/24 et 7j/7.

Voir les offres FiveM
Bloqué à une étape ? Notre équipe vous aide 24h/24 et 7j/7. Demander sur Discord

Besoin d’aide ?

Choisissez comment nous contacter