On Linux, FiveM runs just as well as on Windows and leaves more free memory for the server, because the system itself uses very little. You will also need your licence key and, for QBCore/ESX/Qbox, MariaDB.
1. Prepare the user and folder
apt install -y xz-utils wget screen
adduser --disabled-password --gecos "" fivem
su - fivem
mkdir -p ~/server && cd ~/server
2. Download the artifact
Open https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/ in your browser, right-click Latest Recommended and copy the link. Then, on the server:
wget -O fx.tar.xz "PASTE_THE_LINK_HERE"
tar xf fx.tar.xz
rm fx.tar.xz
3. Start it
screen -S fivem
./run.sh
The console shows a PIN for txAdmin. Leave screen without stopping it with Ctrl + A then D (more about screen).
4. Reach txAdmin through an SSH tunnel
txAdmin listens on 40120, but do not open it to the internet. From your PC, open a tunnel:
ssh -L 40120:localhost:40120 root@YOUR_IP
With that window open, go to http://localhost:40120 in your PC's browser. Enter the PIN, link your Cfx.re account and deploy the recipe (QBCore, ESX Legacy or Qbox) with your key and the database details.
5. Open the ports
ufw allow 30120/tcp
ufw allow 30120/udp
6. Make it start by itself
To stop depending on screen, turn it into a service. As root, create /etc/systemd/system/fivem.service:
[Unit]
Description=FiveM server
After=network-online.target mariadb.service
Wants=network-online.target
[Service]
User=fivem
WorkingDirectory=/home/fivem/server
ExecStart=/home/fivem/server/run.sh
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now fivem
First close the screen session (screen -r fivem and stop the server) so there are not two running. From then on you manage everything from txAdmin.
Joining
In FiveM, F8 → connect YOUR_IP:30120. If it does not connect, go through the checklist.