linuxserver setupsystemd13 min read · updated 9/11/2026

Setting up a FiveM server on Linux

Linux is the most common home for FiveM servers on a VPS or dedicated machine: it is free, stable and light. The setup is a handful of commands — download the artifacts, run txAdmin once, and make the server start by itself. This guide uses Ubuntu or Debian and a dedicated user so the server never runs as root.

Short answer: Install xz-utils and curl, create a fivem user, download the latest recommended Linux artifacts (fx.tar.xz) from the Cfx runtime server, extract them, and run ./run.sh to start txAdmin on port 40120. Open ports 30120 TCP/UDP (and 40120 for txAdmin, ideally restricted) in the firewall, then create a systemd service so the server restarts on boot and crash.

FiveM Linux Server Setup (Ubuntu/Debian): Artifacts, txAdmin, systemd

#Step 1: prepare the machine

As root (or with sudo)
apt update && apt -y upgrade
apt -y install xz-utils curl git screen
adduser --disabled-password --gecos "" fivem
su - fivem

#Step 2: download the artifacts

The Linux builds are listed on the Cfx runtime server under build_proot_linux. Copy the link of the latest recommended build’s fx.tar.xz.

As the fivem user
mkdir -p ~/server && cd ~/server
curl -L -o fx.tar.xz "<paste the fx.tar.xz link of the recommended build>"
tar xf fx.tar.xz
rm fx.tar.xz
ls   # you should see run.sh and alpine/

#Step 3: first run and txAdmin

bash
cd ~/server
./run.sh

txAdmin starts and prints its address and a PIN. Open http://<your-server-ip>:40120, enter the PIN and complete the setup — see the txAdmin setup guide. txAdmin keeps its own data (admins, player database, settings) in a txData folder; the path is printed in the console when it starts.

#Step 4: the firewall

ufw example (as root)
ufw allow 22/tcp
ufw allow 30120/tcp
ufw allow 30120/udp
# txAdmin only from your own IP:
ufw allow from <your.home.ip> to any port 40120 proto tcp
ufw enable

Port details and why each is needed are in ports and firewall.

#Step 5: start on boot with systemd

/etc/systemd/system/fivem.service
[Unit]
Description=FiveM server (txAdmin)
After=network-online.target mariadb.service
Wants=network-online.target

[Service]
User=fivem
WorkingDirectory=/home/fivem/server
ExecStart=/home/fivem/server/run.sh
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
As root
systemctl daemon-reload
systemctl enable --now fivem
journalctl -u fivem -f   # follow the output

#Updating artifacts

  1. Download the new fx.tar.xz next to the old one.
  2. Stop the service, move the old alpine/ and run.sh aside, extract the new archive.
  3. Start the service and check the console; roll back by restoring the old files if needed.

Which build to choose and why “recommended” matters is in artifacts and updates.

Questions

Can FiveM run on Linux?
Yes. The server has native Linux builds; download fx.tar.xz from the Cfx runtime server’s Linux artifacts and run ./run.sh.
Which Linux distribution should I use?
Ubuntu LTS or Debian are the common, well-documented choices.
Should I run FiveM as root?
No. Create a dedicated user; a compromised resource then cannot take over the whole machine.
How do I keep the server running after I close SSH?
Use a systemd service (or screen/tmux for quick tests).
Which ports does a Linux FiveM server need?
30120 TCP and UDP for players, and 40120 TCP for txAdmin (restrict it to your IP).

Ready to pick a map?

Twelve themes on three base map styles, $8 each, instant download.