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.

#Step 1: prepare the machine
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.
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
cd ~/server
./run.shtxAdmin 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 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 enablePort details and why each is needed are in ports and firewall.
#Step 5: start on boot with systemd
[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.targetsystemctl daemon-reload
systemctl enable --now fivem
journalctl -u fivem -f # follow the output#Updating artifacts
- Download the new
fx.tar.xznext to the old one. - Stop the service, move the old
alpine/andrun.shaside, extract the new archive. - 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?
fx.tar.xz from the Cfx runtime server’s Linux artifacts and run ./run.sh.Which Linux distribution should I use?
Should I run FiveM as root?
How do I keep the server running after I close SSH?
Which ports does a Linux FiveM server need?
Ready to pick a map?
Twelve themes on three base map styles, $8 each, instant download.