How to set up a FiveM server on Linux with txAdmin
This guide takes a fresh Ubuntu 24.04 VPS to a running FiveM server with txAdmin, a MariaDB database and the framework of your choice. It takes about 30 minutes. You need SSH access to the server and a free license key from the Cfx.re Portal.
Before you start
- A VPS with a fast CPU core. See FiveM server requirements for sizes. 2 vCPU and 8 GB RAM is a good start for a small city.
- Ubuntu 24.04 with root or sudo access over SSH.
- A license key from the Cfx.re Portal.
Cfx.re describes the Linux build as a courtesy port with fewer diagnostic tools, and recommends Windows if you need their help with problems. Plenty of servers run well on Linux; it's just worth knowing the trade-off.
1. Prepare the server
Update the system, install the tools FXServer needs, and create a user to run it, so the game server never runs as root:
sudo apt update && sudo apt upgrade -y sudo apt install -y xz-utils git tmux sudo adduser --disabled-password --gecos "" fivem
2. Open the firewall
Allow SSH first so you don't lock yourself out, then the game port for players, and txAdmin's web panel for your own IP only:
sudo ufw allow OpenSSH sudo ufw allow 30120/tcp sudo ufw allow 30120/udp sudo ufw allow from your-home-ip to any port 40120 proto tcp sudo ufw enable
Nodewave VPS plans have no provider firewall in front of your ports, so ufw on the server is your firewall. If your host has its own firewall panel, open the same ports there too.
3. Create the database
QBCore, Qbox and ESX all keep players, money and items in a database. Install MariaDB and open its prompt:
sudo apt install -y mariadb-server sudo mysql
Then create a database and a user for the server, with a strong password of your own:
CREATE DATABASE fivem; CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'choose-a-strong-password'; GRANT ALL PRIVILEGES ON fivem.* TO 'fivem'@'localhost'; FLUSH PRIVILEGES; EXIT;
Ubuntu 24.04 installs MariaDB 10.11, which also meets Qbox's minimum of 10.9. MariaDB only listens on the server itself by default, so keep port 3306 closed to the internet.
4. Download FXServer
Open the Linux server builds page and copy the link of the latest recommended build. Then switch to the fivem user, download it and unpack it:
sudo -iu fivem mkdir -p ~/FXServer/server && cd ~/FXServer/server wget -O fx.tar.xz "paste-the-link-here" tar xf fx.tar.xz
5. Start txAdmin
Start FXServer inside tmux, so it keeps running after you close SSH:
tmux new -s fivem cd ~/FXServer/server ./run.sh
On the first start, the console prints a PIN and the address of txAdmin's web panel, on port 40120. Open http://your-server-ip:40120 in your browser, enter the PIN, and sign in with your Cfx.re account to create the admin account.
6. Deploy a framework
txAdmin then offers to set up a server for you. Choose a popular recipe, such as ESX Legacy, QBCore or the QBox Framework (see QBCore vs ESX vs Qbox), and fill in:
- License key: the key from the Cfx.re Portal.
- Database: host
localhost, port3306, and the user, password and database name from step 3.
txAdmin downloads the resources, imports the database tables, writes server.cfg and starts the server. When the console settles, open FiveM, press F8 and type connect your-server-ip:30120.
7. Keep it running
Detach from tmux with Ctrl+B, then D; the server keeps running. Reattach later with tmux attach -t fivem. From now on, start, stop and restart the server from txAdmin, and set up its scheduled restarts.
If the VPS reboots, log in as the fivem user and start ./run.sh in tmux again, or create a systemd service that does it for you.
8. Updating FXServer later
Back up the server folder and the database first. Then stop the server, download the new recommended build into ~/FXServer/server and unpack it over the old one. Unpacking replaces only the build's own files, so your txAdmin settings and server data stay in place.
Common problems
- txAdmin won't open. Check that port 40120 is allowed from your current IP, and use http, not https.
- “No license key was specified”. The server didn't load server.cfg. Start it through txAdmin, or from the folder that holds server.cfg with
+exec server.cfg. - Database errors on start. Check the user, password and database name in the connection string in server.cfg. Special characters in the password can break it.
- Players can't connect. Follow our guide to the “Failed to connect after 3 attempts” error.
If the server refuses to start, see how to fix the license key error. If players can't join, see what the CURL error codes mean.
Host your FiveM server in Singapore
Low ping for players in India, Malaysia and Indonesia, on AMD EPYC with NVMe and Gcore DDoS protection on every IP.
