Skip to content

How to Set Up FiveM on a Linux Server – Host Your Own GTA V Server

Set up your own FiveM server with txAdmin on your Linux VPS: install it as a One-Click App in just a few clicks, or set it up manually with Docker.

26 November 20266 min read0 Views0 helpful

Introduction

FiveM is the best-known multiplayer modification for GTA V. On your own FiveM server, you and your community can play roleplay, racing, or freeroam with your own rules, vehicles, and scripts. The server is managed through txAdmin, the official web interface from Cfx.re. There, you can set up the server, install resources, and manage players—all in your browser.

In this guide, we’ll show you two ways to do it: the easy way, as a One-Click App that gets your server, txAdmin, and database up and running in just a few clicks, and a manual installation with Docker from the console on your Linux server.

Info

Prefer not to manage your own server? Don’t want to take care of the server and updates yourself? A FiveM server is the easier option.

The easy way: FiveM as a One-Click App

With your VPS’s One-Click Apps, you can install a ready-to-use FiveM server along with txAdmin and a MariaDB database. The app automatically enters the database credentials in txAdmin, so you only need to confirm them during setup.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set Up One-Click Apps for instructions.
  • At least 4 GB RAM and 2 vCPUs for FiveM. 8 GB RAM, 4 vCPUs, and a 30 GB SSD are recommended. You’ll need more for many players, vehicles, and scripts.
  • A free Cfx.re account. You’ll use it to sign in to txAdmin and generate your server’s license key.

Install

  1. Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
  2. Find FiveM Server in the app catalog and click Install app.
  3. Use a custom subdomain or zap.cloud is already selected, with a random name. Leave this option enabled or enter your own name. With a domain, you can access txAdmin over HTTPS.
  4. You don’t need to enter anything under App configuration. All three fields are optional:
FieldDescription
FIVEM_GAME_PORTThe port players connect through. The default is 30120.
FIVEM_TXADMIN_PORTThe txAdmin port. The default is 40120.
NO_DEFAULT_CONFIGMust remain set to 1, otherwise the server starts without txAdmin.
  1. Click Queue installation. It takes a few minutes for the server and database to be ready.

The app generates the RCON password and database credentials during installation. You can find them in the app settings (gear icon) under App environment > Automatically generated values.

Set up txAdmin

The first time you open txAdmin, it asks for a four-digit PIN. Here’s how to find the PIN and set up your txAdmin account:

  1. Click the Logs icon on the app card. In the live logs, find the line “Use this PIN to add a new master account”; the PIN appears after it.
  2. Open the app’s Access link. Without a domain, you can access txAdmin at http://<IP deines vServers>:40120.
  3. Enter the PIN and click Link Account. You’ll be redirected to Cfx.re, where you can sign in with your Cfx.re account.
  4. Back in txAdmin, set a Backup Password. You can use this password to access txAdmin if signing in through Cfx.re doesn’t work. Your Discord ID is optional.

Next, the txAdmin setup wizard starts:

  • Server name and template: Choose a name and select a template under Popular Recipes, such as a roleplay framework like QBCore or ESX. For details about the available options, see FiveM: txAdmin Setup.
  • License key: Every FiveM server needs its own key. See FiveM: Add Your Own License Keys for instructions on generating one in the Cfx.re portal. Enter it in the wizard, and txAdmin will add it to server.cfg.
  • Database: If the template requires a database, the fields are already filled in: host fivem-db, port 3306, database fivem, and the generated credentials. Simply keep these values.

Finally, txAdmin starts your server.

Connect to the server

You can find your server’s address on the app card under Connection, for example, <IP deines vServers>:30120. In the FiveM client, press F8 and enter connect <IP deines vServers>:30120. For other ways to connect, see FiveM: Connect to the Server.

Tip

Access txAdmin over HTTPS only txAdmin is available over HTTPS through the app’s domain, and also over port 40120 without encryption. Always use the domain access link to sign in, so your password is transmitted securely.

Updates and data

  • You can find new app versions in the app settings (gear icon) under App update > Check for updates. If a new version is available, install it by clicking Apply update.
  • Your server data, resources, and database are stored in dedicated volumes and are retained when you update. Before uninstalling the app, back up anything you want to keep. You can also delete the volumes during uninstallation.

Manual installation

The rest of this guide covers manual installation using Docker Compose from the console. It uses the same spritsail/fivem image as the One-Click App and a MariaDB database. This guide is based on the image documentation and txAdmin environment variables.

Preparation

Connect to your server using SSH. See First Access via SSH for instructions. Then install Docker and Docker Compose as described in Install Docker.

Create a folder for the server and navigate to it:

Code
mkdir -p /opt/fivem && cd /opt/fivem

Set credentials

Use nano .env to create a file named .env with passwords for the database and RCON:

Code
DB_USER=fivem
DB_PASSWORD=12345-ersetzen
DB_ROOT_PASSWORD=67890-ersetzen
RCON_PASSWORD=24680-ersetzen

Replace the example values with your own strong, long passwords.

Create the Docker Compose file

Use nano docker-compose.yml to create a file named docker-compose.yml with the following contents:

Code
services:
  fivem:
    image: spritsail/fivem:latest
    restart: unless-stopped
    tty: true
    stdin_open: true
    depends_on:
      - fivem-db
    ports:
      - "30120:30120/tcp"
      - "30120:30120/udp"
      - "40120:40120/tcp"
    environment:
      - RCON_PASSWORD=${RCON_PASSWORD}
      - NO_DEFAULT_CONFIG=1
      - NO_LICENSE_KEY=1
      - TXHOST_DEFAULT_DBHOST=fivem-db
      - TXHOST_DEFAULT_DBPORT=3306
      - TXHOST_DEFAULT_DBUSER=${DB_USER}
      - TXHOST_DEFAULT_DBPASS=${DB_PASSWORD}
      - TXHOST_DEFAULT_DBNAME=fivem
    volumes:
      - fivem-config:/config
      - fivem-txdata:/txData

  fivem-db:
    image: mariadb:11.8
    restart: unless-stopped
    environment:
      - MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
      - MARIADB_USER=${DB_USER}
      - MARIADB_PASSWORD=${DB_PASSWORD}
      - MARIADB_DATABASE=fivem
    volumes:
      - fivem-mariadb-data:/var/lib/mysql

volumes:
  fivem-config:
  fivem-txdata:
  fivem-mariadb-data:

Here’s what the most important entries do:

  • tty: true is required. Without a terminal, the container crashes on startup.
  • NO_DEFAULT_CONFIG=1 starts the server with txAdmin instead of a fixed server.cfg.
  • NO_LICENSE_KEY=1 means the container won’t require a license key. You’ll enter the key later in the txAdmin wizard.
  • The TXHOST_DEFAULT_DB... values prefill the database fields in the txAdmin wizard.

Start the server and set up txAdmin

Start both containers:

Code
docker compose up -d

The txAdmin PIN is in the server log:

Code
docker compose logs fivem | grep PIN

Open http://<IP deines Servers>:40120 in your browser and set up txAdmin as described above under Set up txAdmin.

Open the ports

Players connect through port 30120 (TCP and UDP), while txAdmin runs on port 40120 (TCP). If you’re using a firewall such as ufw, open the ports:

Code
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
sudo ufw allow 40120/tcp
Warning

txAdmin without HTTPS With a manual installation, txAdmin runs over HTTP only. Instead of exposing port 40120 to the internet, you can secure txAdmin with a Cloudflare Tunnel. See Set Up a Cloudflare Tunnel for txAdmin for instructions.

Update the server

The spritsail/fivem:latest image always contains the latest FiveM build. Pull it and restart the server:

Code
cd /opt/fivem
docker compose pull
docker compose up -d

Your data in the volumes will be retained.

Conclusion

Congratulations, your FiveM server is up and running. For instructions on installing resources, managing players, and configuring your server, check out our FiveM guides, such as FiveM: txAdmin Setup and FiveM: Connect to the Server.

If you have any questions or run into problems, our support team is here to help every day.

Free tools

FiveM Tools

View all

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.