Renting a VPS and installing FiveM yourself takes about an hour and gives you plenty of freedom. This guide covers the full procedure on a bare Linux server, from the first apt update to a server that restarts by itself, with the pitfalls that waste an evening.
1. What you need
FiveM runs on a modest machine, but game logic relies heavily on one thread, so a fast CPU helps more than many cores.
Minimum to start: 2 vCPUs, 4 GB of RAM and 20 GB of disk on a Linux VPS with Debian 12 or Ubuntu 22.04. For a full roleplay server with a framework and a database, plan 8 GB. You also need root SSH access and a Cfx.re account.
2. Prepare the VPS
apt update && apt upgrade -y
apt install -y curl xz-utils git screen
Never run FXServer as root. It runs third-party scripts, and a malicious resource would control the whole machine. Create a dedicated user:
adduser --disabled-password --gecos "" fivem
mkdir -p /home/fivem/server
chown -R fivem:fivem /home/fivem
su - fivem
3. Install the FiveM artifacts
Artifacts are the server itself (FXServer). Download them from runtime.fivem.net/artifacts/fivem/build_proot_linux/master/. Pick a recent recommended build, copy the link to fx.tar.xz, and replace XXXX below with the exact value from the link.
cd /home/fivem/server
wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/XXXX/fx.tar.xz
tar xf fx.tar.xz
rm fx.tar.xz
Then get the base resources maintained by Cfx.re:
cd /home/fivem
git clone https://github.com/citizenfx/cfx-server-data.git server-data
Keeping server (the engine) and server-data (resources and configuration) separate makes updates much simpler.
4. Get the Cfx.re key
A FiveM server needs a licence key. Sign in at portal.cfx.re, generate a server key with your VPS IP address and keep it safe. One key is for one server.
5. Write server.cfg
Place server.cfg in server-data. Here is a minimal but complete configuration to adapt:
# Network: 0.0.0.0 listens on all interfaces
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
# Name shown in the server list
sv_hostname "My RP server"
sets locale "en-GB"
sets tags "roleplay"
# Base resources
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap
# Players and synchronization
sv_maxclients 48
set onesync on
# Licence and security
sv_licenseKey "YOUR_CFX_KEY"
rcon_password "a-long-unique-password"
# Administrator (use your identifier)
add_ace group.admin command allow
add_principal identifier.fivem:YOUR_ID group.admin
- sv_maxclients: without OneSync, a server is limited to 32 players. Above 48, your Cfx.re key must be tied to a subscription that allows it.
- rcon_password: never leave it empty or set to "changeme", because it gives full console access.
6. First start and txAdmin
To start directly with your configuration:
cd /home/fivem/server
bash run.sh +exec /home/fivem/server-data/server.cfg
Or use txAdmin, the web interface shipped with the artifacts, which handles restarts, bans and backups:
cd /home/fivem/server
bash run.sh
The console shows a link with a one-time code. Open http://VPS_IP:40120, create the administrator account with a strong password and follow the steps. txAdmin can point to an existing server-data folder.
7. The database, if you use a framework
ESX and QBCore store characters, inventory and economy in a MySQL database. Install MariaDB as root:
apt install -y mariadb-server
mysql_secure_installation
Create a dedicated database and user rather than using root:
CREATE DATABASE fivem CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'a-long-password';
GRANT ALL PRIVILEGES ON fivem.* TO 'fivem'@'localhost';
FLUSH PRIVILEGES;
Then set the connection in server.cfg, before the resources that need it:
set mysql_connection_string "mysql://fivem:a-long-password@localhost/fivem?charset=utf8mb4"
Keep MariaDB listening locally only: a database exposed to the Internet is quickly found by scanners. See securing MariaDB.
8. Make the server restart by itself
Started by hand, the server stops when you close SSH and does not return after a reboot. Create /etc/systemd/system/fivem.service:
[Unit]
Description=FiveM server
After=network.target mariadb.service
[Service]
Type=simple
User=fivem
WorkingDirectory=/home/fivem/server
ExecStart=/bin/bash /home/fivem/server/run.sh +exec /home/fivem/server-data/server.cfg
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now fivem
systemctl status fivem
Read logs with journalctl -u fivem -f. If you drive the server with txAdmin, run txAdmin as the service instead, so that two managers do not fight over the same instance.
9. Check that everything works
ss -tulpn | grep 30120
You should see one TCP line and one UDP line. Then, in FiveM, open the F8 console and type connect VPS_IP:30120. The server can take a few minutes to appear in the list after its first start.
10. Update the artifacts
Replace the contents of server, never server-data. Replace XXXX with the build you want.
systemctl stop fivem
mv /home/fivem/server /home/fivem/server.old
mkdir /home/fivem/server && cd /home/fivem/server
wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/XXXX/fx.tar.xz
tar xf fx.tar.xz && rm fx.tar.xz
chown -R fivem:fivem /home/fivem/server
systemctl start fivem
Keep the old folder for a few days: if the new build breaks a resource, going back takes a minute.
11. Back up
mkdir -p /home/fivem/backups
mysqldump -u fivem -p fivem > /home/fivem/backups/fivem-$(date +%F).sql
tar czf /home/fivem/backups/server-data-$(date +%F).tar.gz /home/fivem/server-data
Schedule this and copy the archives off the VPS: a backup stored on the machine it protects does not protect much.
12. Secure the server
In order of importance: a dedicated non-root user, SSH keys instead of passwords (see SSH hardening and two-factor SSH), a long RCON password, txAdmin restricted to your IP, and system updates. Game servers are frequent DDoS targets: see Anti-DDoS and FiveM protection. Be wary of resources from file-sharing sites: an obfuscated script can steal player data or mine cryptocurrency.
13. Common problems
- "Invalid license key": the key is revoked, tied to another IP or copied incorrectly. See common startup errors.
- The server starts and stops immediately: read
journalctl -u fivem -n 50. It is often a missing resource or a syntax error. - Nobody can connect: check that port 30120 is reachable in UDP as well as TCP.
- Port already in use: a previous instance is still running.
- Lag at peak times: see FiveM server lag.
Frequently asked questions
What VPS do I need for a FiveM server?
2 vCPUs and 4 GB of RAM are enough to start and test. For a 64-player roleplay server with a framework and a database, plan 8 GB and a fast CPU.
Do I have to pay for a FiveM licence?
A basic Cfx.re server key is free from the portal. Above 48 slots, you need a subscription that allows that number of players.
Can I install FiveM on a Windows VPS?
Yes, but Linux is the usual choice: lower memory use, simple automatic restarts, and most community guides assume Linux.










