Skip to content
FIVECRATE

FiveM Server Linux Setup on Ubuntu and Debian (2026)

FiveM server Linux setup for Ubuntu and Debian: install FXServer, run txAdmin over SSH, open ports with ufw and keep the server online with tmux or systemd.

Author: FiveCrate
Published:
Updated:
Read time: 19 min
Applies to
FiveM Legacy FXServer on x86-64 Linux (Recommended 38435 and Latest 38781 on December 2, 2026) with bundled txAdmin 8.1.2; Ubuntu and Debian hosts; FiveM for GTAV Enhanced Cfx Server (Linux build 177) differences noted
Last verified

Direct Answer

To run a FiveM server on Linux, use the official Linux build of FXServer, which Cfx provides only as a courtesy port, on an x86-64 Ubuntu or Debian machine. Install xz-utils and open the firewall: TCP and UDP 30120, plus TCP 40120 from your own IP. Copy the Recommended fx.tar.xz link from the Server Download page, download it into an empty folder such as ~/FXServer/server and run tar xf fx.tar.xz in it. Start txAdmin with bash ~/FXServer/server/run.sh (no +exec), open http://SERVER_IP:40120 from your PC and enter the PIN. Keep it running with tmux or systemd. FiveM for GTAV Enhanced uses the same steps with its own archive.

Can a FiveM Server Run on Linux?

Yes. Cfx’s support FAQ states that “FiveM servers can be run on Linux”, and the Server Download page offers a Linux archive next to the Windows one. This guide follows FiveM Legacy, with every source checked again on December 2, 2026; the Enhanced differences are listed near the end. Two limits come with Linux:

  • The Linux build is a courtesy port. The vanilla setup guide says it is provided that way “due to issues regarding Linux distribution compatibility and availability of diagnostic tools for native C++ code”, and that you are more likely to see issues fixed on the Windows version.
  • The game client does not run on Linux. The same FAQ says “The FiveM client cannot be run on Linux”, so you join and test from a Windows PC.

The fivem.net FAQ recommends “a x86-64 system running Linux or Windows”, decent upstream connectivity and preferably a multi-core processor. It gives no RAM or core figures. Qbox’s Linux tutorial asks for at least 4 GB of RAM, 20 GB of free disk space and a CPU with at least 2 cores at 3 GHz or more. Those are the tutorial’s figures, not a Cfx requirement.

In practice, the server needs an x86-64 machine. The Linux archive carries its own Alpine root filesystem in an alpine folder, and txAdmin starts FXServer through the loader inside it, alpine/opt/cfx-server/ld-musl-x86_64.so.1. On an ARM machine, such as a Raspberry Pi or an arm64 cloud instance, that loader cannot run natively and fails with the error in the troubleshooting section. A forum reply sums it up: “The server only works on x86_64 now.” Run uname -m, which prints the machine hardware name, before you rent or set up anything: the output must be x86_64.

Which Ubuntu or Debian Version to Use

The Cfx docs do not list supported distributions. Their Linux prerequisites are Git, needed only to clone the base server data, and the “xz or xz-utils package”, with the note that Debian and Ubuntu ship xz in xz-utils. Cfx’s Development Update #3 adds that “Linux builds continue to use Alpine rootfs”, which is the bundled alpine folder described above.

Qbox’s tutorial targets “A fresh Ubuntu 20.04+ or Debian 11+ server”. For a Qbox server, the release you pick also decides which MariaDB you get. Qbox’s installation page sets “Minimum version: MariaDB 10.9.0”, and the MariaDB package each release installs differs:

ReleasePackaged MariaDB on November 21, 2026Meets Qbox’s 10.9.0 minimum
Ubuntu 22.04 LTS10.6.22No
Ubuntu 24.04 LTS10.11.13Yes
Ubuntu 26.04 LTS11.8.6Yes
Debian 1110.5.23No
Debian 1210.11.18Yes
Debian 1311.8.9Yes

So on Ubuntu 22.04 or Debian 11, the plain apt install mariadb-server from Qbox’s own tutorial installs a version that Qbox’s installation page rules out. Choose Ubuntu 24.04, Ubuntu 26.04, Debian 12 or Debian 13 for a new Qbox server. Installing and securing MariaDB is covered in the FiveM database setup guide.

FXServer Files on Linux: run.sh, alpine and txData

The official layout keeps the server binaries and your server data in separate folders under the home directory of the account that runs the server.

PathWhat it holds
~/FXServer/server/run.shThe launcher you start, for txAdmin and vanilla servers alike
~/FXServer/server/alpine/The bundled Alpine root filesystem with the FXServer binary at alpine/opt/cfx-server/FXServer
~/FXServer/server/txData/txAdmin’s logs, configs and data. On Linux it sits by default in the folder that contains run.sh
~/FXServer/server-data/Vanilla servers only: the cloned base resources and your server.cfg

run.sh is a short launcher: its exec $SCRIPTPATH/... line hands over to the loader and FXServer inside the alpine folder. txAdmin’s configuration docs refer to that line when they tell you where to add environment variables.

Prepare Ubuntu or Debian

Run these steps over SSH as an account with sudo rights. QBCore’s Linux page recommends working as “a user that has sudo privileges”, with remote root access turned off.

  1. Update the system and install the tools. Qbox’s tutorial starts with a full update. Add xz-utils and git from the Cfx prerequisites, wget for the download, and tmux for keeping the server running later:
sudo apt update && sudo apt upgrade -y
sudo apt install -y xz-utils git wget tmux
  1. Open the firewall with ufw. ufw is “the default firewall configuration tool for Ubuntu”, and it is initially disabled. If the ufw command is missing, install it first with sudo apt install ufw: the Debian archive carries the ufw package for Debian 11, 12 and 13. Allow SSH before you enable it: the ufw manual warns that enabling the firewall flushes its chains and “may drop existing connections (eg ssh)”, and it recommends adding the SSH rule first. Over SSH, ufw enable asks for confirmation before it goes ahead.
sudo ufw allow 22/tcp
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
sudo ufw allow proto tcp from YOUR_PC_IP to any port 40120
sudo ufw enable
sudo ufw status

Players reach the game on port 30120 over both TCP and UDP, the two endpoint_add_* lines of the official example server.cfg. The txAdmin panel uses port 40120, which txAdmin’s docs describe as the TCP port it binds and listens to, on interface 0.0.0.0 (every address) by default. Replace YOUR_PC_IP with the public address of the computer you administer from, following the “allow access from specific hosts” form in Ubuntu’s firewall docs. Qbox’s tutorial opens 40120/tcp and 40120/udp to everyone; txAdmin only describes a TCP port, and limiting it to your address keeps the login page private.

Your VPS provider may filter traffic as well. The arm64 guide on the Cfx forum notes: “You may also need to open those ports on your server provider.” Router port forwarding and port checks are in the FiveM port forwarding guide.

To keep 40120 closed to everyone, the OpenSSH client can forward it instead: run ssh -L 40120:127.0.0.1:40120 YOUR_USER@SERVER_IP on your PC and open http://localhost:40120 there. The -L option forwards connections to a TCP port on your local machine to the given host and port on the remote side.

  1. Create a dedicated user and switch to it. Qbox’s tutorial calls a dedicated user “optional but recommended”, and its security notes say: “Run FiveM under a dedicated user with minimal privileges.”
sudo adduser --disabled-password fivem
sudo su - fivem

adduser creates the home directory and a group with the same name, and asks for the comment fields. --disabled-password skips setting a password. Qbox’s tutorial uses --disabled-login instead. In the adduser manuals of Ubuntu 24.04 and Debian 12, that option “will additionally set the shell to /usr/sbin/nologin”, so the sudo su - fivem that follows it cannot open a shell.

Install FXServer and Run txAdmin on Linux

Do these steps as the fivem user, without sudo.

  1. Download the Recommended Linux build. On the Server Download page, select FiveM / RedM, Linux and Recommended, then copy the link of fx.tar.xz. The docs say to “copy the URL for the recommended server version and use wget <url> to download it”.
mkdir -p ~/FXServer/server
cd ~/FXServer/server
wget "PASTE_THE_FX_TAR_XZ_LINK_HERE"

On December 2, 2026 the Recommended Linux build was 38435 and the newest Latest build was 38781, both served from cfx-downloads.akamaized.net addresses. Since October 15, 2026, connections to FXServer versions older than 35245 are no longer possible, so never reuse a link from an old tutorial.

  1. Extract the archive. Stay in ~/FXServer/server and run:
tar xf fx.tar.xz

Extract as fivem, not with sudo. In a forum thread about ld-musl-x86_64.so.1: Permission denied, the answer was “Don’t extract the files with sudo.”

  1. Start txAdmin. txAdmin’s README says: “To start txAdmin, simply run FXServer without any +exec server.cfg launch argument”. On Linux:
bash ~/FXServer/server/run.sh

To keep it running after you log out, start it inside tmux instead, as shown in the section on keeping the server running. The first boot creates txData in ~/FXServer/server. When txAdmin is ready, the console shows a framed box that reads (border removed):

All ready! Please access:
http://your-public-ip:40120/
http://<detected public IP>:40120/

Use the PIN below to register:
<PIN>

your-public-ip is printed literally on Linux. The second address appears when txAdmin detects the machine’s public IP. txAdmin opens a browser for you on Windows only, so on Linux you open the address yourself.

  1. Open txAdmin from your PC. Browse to http://SERVER_IP:40120 (or http://localhost:40120 through the SSH tunnel) and enter the 4-digit PIN from the console. Click Link account, sign in with your Cfx account, set up a backup password, review the Creator Platform License Agreement and the txAdmin License, tick the checkbox and click Register. QBCore’s Linux page puts it plainly: from here the setup “is identical to the Windows installation”.

  2. Deploy a recipe. Enter a server name and click Next, choose Popular Recipes, pick FiveM Basic Server (CFX Default) for a first test, leave Data Location as it is and click Save. txAdmin suggests a subfolder of txData for the server data. Click Go to Recipe Deployer, click Next in Step 1: Review Recipe, paste a server registration key from the Cfx Portal in Step 2: Input Parameters, click Run Recipe, and finish with Save and Run Server. The official txAdmin guide warns that some templates “will require a database server”. Each screen is explained in how to make a FiveM server, and the framework templates in the txAdmin recipe guide.

  3. Test from your Windows PC. Press F8 in the FiveM client and enter connect SERVER_IP:30120. If that fails, open http://SERVER_IP:30120/info.json in a browser: the official server issues page says it “should return a JSON object containing your server’s info”. A failed direct connection usually means a port or firewall problem.

Run a Vanilla FXServer on Linux Without txAdmin

The Linux section of the official vanilla guide skips txAdmin. After steps 1 and 2 above, clone the base server data into its own folder, outside the binaries folder:

git clone https://github.com/citizenfx/cfx-server-data.git ~/FXServer/server-data

Create server.cfg in ~/FXServer/server-data from the docs’ example and set your key with sv_licenseKey. The line-by-line meaning of that file is in the pillar guide. Then start the server from the server-data folder:

cd ~/FXServer/server-data && bash ~/FXServer/server/run.sh +exec server.cfg

The working directory matters. A Cfx forum reply to a Linux owner whose resources were not found put it in one line: “PWD must be server-data folder”.

Keep the Server Running After You Close SSH

A server started straight from your SSH prompt is tied to that session. The Cfx forum’s arm64 guide says that to keep it active “even after leaving the console”, you run the command inside tmux, and QBCore’s Linux page starts the server inside screen. A systemd service goes further and also brings the server back after a reboot.

MethodKeeps running after you disconnectStarts again after a rebootConsole
tmuxYesNo, start it again by handInteractive; reattach at any time
systemd serviceYesYes, once enabledRead-only log in the journal; with txAdmin, type commands in its Live Console

txAdmin already restarts the game server: its feature list includes “Auto Restart FXServer on crash or hang” and scheduled restarts. systemd watches the outer process that run.sh starts, the one that hosts txAdmin.

Run FXServer in tmux

tmux is a terminal multiplexer whose sessions “may be detached from a screen and continue running in the background, then later reattached”. As fivem:

tmux new -s fivem
bash ~/FXServer/server/run.sh

For a vanilla server, run the cd ~/FXServer/server-data && bash ~/FXServer/server/run.sh +exec server.cfg line from the vanilla section in the tmux session instead.

Detach with Ctrl+b, then d: Ctrl+b is tmux’s default prefix key, and d detaches the client. Reconnect later with:

tmux attach -t fivem

Run FXServer as a systemd Service on Linux

Qbox’s Linux tutorial includes a systemd unit file. Its ExecStart runs a script that “automatically downloads the latest FiveM artifacts” from a third-party JSON feed, not the Cfx download page, and extracts them over the server folder on every start. txAdmin has a console error for that situation: “This likely means you did not erase the previous artifact files before adding new ones.” The unit below keeps Qbox’s settings and starts run.sh directly.

Type exit to leave the fivem account, then create the file as your sudo user:

sudo nano /etc/systemd/system/fivem.service
[Unit]
Description=FiveM Server
After=network.target mariadb.service

[Service]
Type=simple
User=fivem
Group=fivem
WorkingDirectory=/home/fivem/FXServer/server
ExecStart=/bin/bash /home/fivem/FXServer/server/run.sh
Restart=on-failure
RestartSec=5
SyslogIdentifier=fivem-server

[Install]
WantedBy=multi-user.target

Compared with Qbox’s version, WorkingDirectory and ExecStart point at the official run.sh. Three lines are left out. StandardOutput=syslog and StandardError=syslog are dropped because the systemd manual does not list syslog among the output values, and output already goes to the journal by default. Environment=NODE_ENV=production is dropped because txAdmin’s environment configuration page lists only TXHOST_* variables.

LineWhat it does
After=network.target mariadb.serviceOrders the start after the network and MariaDB. Remove mariadb.service if the database runs on another machine
User=fivem and Group=fivemRuns the server as fivem; for system services the default user is root
WorkingDirectory=The folder the process starts in
ExecStart=The start command; the first argument must be an absolute path or a plain program name
Restart=on-failureRestarts after a non-zero exit code, an unclean signal or a timeout, but not after systemctl stop. The manual calls it “the recommended choice for long-running services”
RestartSec=5Waits 5 seconds before a restart instead of the default 100 ms
WantedBy=multi-user.targetLets systemctl enable link the unit so it starts at boot

For a vanilla server, change two lines so the process starts in the server-data folder with your config:

WorkingDirectory=/home/fivem/FXServer/server-data
ExecStart=/bin/bash /home/fivem/FXServer/server/run.sh +exec server.cfg

Stop any copy still running in tmux, then load, enable and start the service with Qbox’s commands:

sudo systemctl daemon-reload
sudo systemctl enable fivem.service
sudo systemctl start fivem.service
sudo systemctl status fivem.service

On the first start, Qbox’s tutorial says to read the txAdmin PIN from systemctl status fivem.service. Follow the full log with sudo journalctl -u fivem.service -f, and use sudo systemctl restart fivem.service or sudo systemctl stop fivem.service to restart or stop it. A service has no keyboard: systemd connects its standard input to /dev/null, so “all read attempts by the process will result in immediate EOF”. Run a vanilla server in tmux if you need to type console commands.

txAdmin on Linux: Port, txData and Environment Variables

txAdmin’s README says that some settings, “such as TCP interface & port”, are only available through environment variables. Since txAdmin v8.0.0, those are the TXHOST_* variables, which also set the data path.

VariableDefaultNotes
TXHOST_TXA_PORT40120The TCP port of the panel. It “cannot be 30120”
TXHOST_INTERFACE0.0.0.0The interface txAdmin binds and makes FXServer bind to
TXHOST_DATA_PATHThe folder that contains run.sh, plus txDataWhere txAdmin keeps its logs, configs and data
TXHOST_TXA_URLNot setThe public URL shown in the boot message instead of the detected one

txAdmin’s docs give two ways to set them on Linux: add export lines to run.sh before the line that starts with exec $SCRIPTPATH/, or put the export lines in an env.sh file and start with source env.sh && ./run.sh. A new artifact archive brings its own run.sh, so the separate env.sh is the one that survives updates. For example, ~/FXServer/server/env.sh with one line:

export TXHOST_TXA_PORT=40125

Then start the server from that folder:

cd ~/FXServer/server && source env.sh && ./run.sh

Under systemd, put the same assignment on an Environment= line in the [Service] section, for example Environment=TXHOST_TXA_PORT=40125. txAdmin’s docs ask that these variables “be set specifically for the boot process” and not be available to other processes. If you change the port, change the ufw rule to match. Login and port problems have their own txAdmin login guide.

Update FXServer on Linux Without Losing txData

On Linux, txData sits next to the binaries, inside the folder that contains run.sh. Never delete ~/FXServer/server to make room for a new build.

  1. Stop the server and back up txData. Use sudo systemctl stop fivem.service, or stop it in the tmux session, then copy txData (and server-data on a vanilla server) somewhere safe.
  2. Replace only the build. Download the new fx.tar.xz, move the old alpine folder aside and extract the new archive, which brings a new alpine folder and run.sh. Do not extract on top of the old files.
  3. Start it again the way you started it before.

The full procedure, with rollback and the end-of-life errors, is in the FXServer artifact update guide.

FiveM for GTAV Enhanced on Linux

FiveM for GTAV Enhanced is in early access and runs on Cfx Server, a separate download with txAdmin still embedded, according to Development Update #3.

  • Archive. On December 2, 2026 the Server Download page offered cfx-server_linux_x64.tar.xz, build 177, for Linux, under the FiveM for GTAV Enhanced platform choice. The vanilla guide spells it cfx-server-linux_x64; take the file the download page gives you and extract it with tar xf cfx-server_linux_x64.tar.xz. The vanilla guide names no other Linux difference, so the steps above apply with that archive.
  • Recipe name. The txAdmin recipe list for Enhanced servers, added on July 23, 2026, names the basic template FiveM Basic Server (Enhanced) instead of FiveM Basic Server (CFX Default).
  • Same base. Development Update #3 says Linux builds “continue to use Alpine rootfs, so all requirements remain the same as with FiveM for GTAV Legacy”. txAdmin’s enhanced branch starts Cfx Server through alpine/lib/ld-musl-x86_64.so.1, so Enhanced is x86-64 only as well.
  • No Visual C++ step. The Microsoft Visual C++ 2017 Redistributable appears only in the Windows prerequisites.
  • Docker. Cfx also plans “an official Docker image, with more details to follow later”.

What changes for resources and settings is covered in the FiveM Enhanced server setup guide.

Troubleshooting

“cannot execute binary file: Exec format error”

The full line reads run.sh: line 8: .../alpine/opt/cfx-server/ld-musl-x86_64.so.1: cannot execute binary file: Exec format error. Forum reports show it on a Raspberry Pi and on an ARM instance running Ubuntu. The machine is not x86-64; check with uname -m. The fix is an x86-64 server: the arm64 guide on the Cfx forum states there is “no way to run FiveM server on an aarch64 machine natively” and runs it through an emulator instead.

“ld-musl-x86_64.so.1: Permission denied” when running run.sh

The forum answer to this error was “Don’t extract the files with sudo.” Remove the files that were extracted with sudo, then run tar xf fx.tar.xz again as the account that runs the server, without sudo.

There is no run.sh after extracting

The archive is not the Linux build. “FiveM linux artifacts ship with a file named run.sh”; in the forum thread with this problem, the owner had used the wrong artifacts. The Windows download on the Server Download page is server.7z. Select Linux there and download fx.tar.xz.

tar cannot extract fx.tar.xz

tar xf fx.tar.xz needs xz. The docs: “you need to have xz installed, on Debian/Ubuntu this is in the xz-utils package”. Run sudo apt install xz-utils.

“Failed to start resource” or no resources found on a vanilla server

The vanilla guide: “If you don’t get any ‘resources found’, and it says ‘Failed to start resource’, you didn’t ‘cd’ to the right folder.” Run cd ~/FXServer/server-data before run.sh, or set WorkingDirectory= to that folder in the service.

“no license key was specified”, timed out or connection refused

If nothing starts and players get “timed out” or “connection refused”, the docs say you “didn’t add +exec”. “no license key was specified” can come from either of those two mistakes: the wrong folder or a missing +exec server.cfg. A txAdmin server is the opposite case: it must start without +exec.

txAdmin does not load at http://SERVER_IP:40120

Check that sudo ufw status allows TCP 40120 from your current address, and that your provider’s firewall does too. Use the server’s real address, not the literal your-public-ip from the boot box. The txAdmin login guide covers PIN and password problems.

The server stops when you close the SSH window

It ran in the SSH session itself. Start it in tmux or as the systemd service above.

sudo su - fivem does not open a shell

The account was created with --disabled-login, which set its shell to /usr/sbin/nologin; that program displays a message that the account is not available and exits. Give it a shell with sudo usermod -s /bin/bash fivem.

Where is the txAdmin PIN when the server runs as a service?

The boot box goes to the journal. Read it with sudo systemctl status fivem.service or sudo journalctl -u fivem.service.

Next Steps

Browse FiveCrate assets

Original FiveM assets made in-house, with free updates and a multi-server license.

Browse assets →

Official documentation and repository references