SSD Nodes Learn Hosting plans →
How to do am Matt ConnorBy Matt Connor

How to Run FiveM Server for VPS

Install FXServer for Ubuntu, pin your artifact build, add your Cfx.re licence key, open TCP and UDP port 30120, and keep txAdmin private.

Wetin FiveM server for VPS need

FiveM server for VPS na one unprivileged Linux user, one artifact build from Cfx.re, one licence key, and one port wey open for both TCP and UDP. The installation dey take about ten minutes. The remaining part of this guide dey cover the things wey decide whether server go play well: speed of one CPU core, memory wey your resources need, and management panel wey you no suppose leave open for public address.

Three prerequisites dey fixed. Server binaries, wey dem dey call artifacts, come from official Cfx.re build listing. Licence key come from Cfx.re portal for portal.cfx.re, the service wey older guides dey call keymaster, and the key dey tied to address of the machine wey dey use am. Every player wey connect need their own legitimate copy of GTA V (Grand Theft Auto V) for Steam, Rockstar Games Launcher or Epic Games, plus free Cfx.re account. Client dey check game ownership when e start, so server wey build on anything else no go work, and no workaround content of any kind dey covered here.

Hosting the server na different work from playing on the box. The question of whether you fit run the game itself for VPS na separate question with different answer.

Why single core speed dey decide how a FiveM server feel

FXServer, the FiveM server binary, dey run game logic for one main thread. Every resource script, every event handler, and every state update dey pass through that single loop. Extra cores fit help the kernel, the database, and the network stack. Dem no dey split the game loop. So 4 vCPU box for slow core fit stutter under load, while 2 vCPU box for fast core go remain smooth.

This one dey turn the usual VPS shopping habit upside down, because core count na usually the headline number. Check per core speed before you commit money. Start with the CPU model:

lscpu | grep -E 'Model name|MHz'

Then look up the published single thread score for that model. The PassMark single thread rating and the Geekbench single-core score dey public. Both dey measure one core wey dey do work, and na that number matter here. After that, measure the box wey dem actually give you:

sudo apt update && sudo apt install -y sysbench
sysbench cpu --cpu-max-prime=20000 --threads=1 run

Read the events per second line. Run the same command for two candidate providers, and you fit compare dem honestly because the workload na the same and e dey confined to one core. How to run VPS benchmark wey you fit repeat show how to keep those numbers comparable between boxes.

Then check say the core really belong to you:

vmstat 1 5

The last column, st, na steal time: the share of time wey your virtual CPU ready to run, but the hypervisor make am wait. Steady figure above 1 or 2 mean say you dey share physical core with busy neighbours. Game loop go feel am immediately as rubber banding. Steal time from noisy neighbour explain how to read that column and wetin you fit do about am.

Memory dey scale with the resources wey you run, not with slots alone. The base server data from Cfx.re dey use few hundred megabytes. Roleplay framework with forty or fifty resources and MariaDB database for the same box na different machine: 4 GB na sensible floor, and 8 GB dey comfortable for 32 to 64 slots. Community setups usually publish figures like these, so use dem as starting point and monitor free -m under real player load.

Create user and install dependencies

Run the server as ordinary user, never as root. Reason dey two. Using root no good for any service wey dey face internet. Also, the Linux artifact dey run inside bundled Alpine Linux root filesystem. So, files wey root unpack no fit run by anybody else. Na this dey commonly make fresh install refuse to start.

sudo adduser --disabled-password --gecos "" fivem
sudo apt update
sudo apt install -y git xz-utils curl tcpdump
sudo -iu fivem

Everything for here dey run as the fivem user. xz-utils dey required because the download na .tar.xz archive, and dem dey use git clone the base server data.

Download pinned artifact build

The Linux build dey inside the build_proot_linux channel for Cfx.re artifact server. The listing dey mark one build as the latest recommended one, and that label dey move go new build every few weeks. Use the numbered folder as fixed version instead. If you rebuild your server next month, you go still get the same binary wey you test this month. Upgrade go become decision wey you make intentionally.

mkdir -p ~/FXServer/server
cd ~/FXServer/server
curl -fLO https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/25770-8ddccd4e4dfd6a760ce18651656463f961cc4761/fx.tar.xz
tar xf fx.tar.xz
ls

Build 25770 carry the recommended label when I check the listing for August 2026. Open the same directory for browser to see the current one. Then paste that folder name for the URL. The name na the build number plus a commit hash.

ls suppose now show run.sh and one alpine directory. That directory na the main trick. The Linux artifact carry small Alpine root filesystem by itself. E use proot, wey be userspace tool wey dey emulate chroot without root privileges, to start the server inside that filesystem. Na why one download dey run for Ubuntu, Debian, and Rocky without distribution-specific packages.

Now clone the base server data. E hold the default resources wey your server.cfg dey start:

git clone https://github.com/citizenfx/cfx-server-data.git ~/FXServer/server-data

Get licence key and write server.cfg

Log in for portal.cfx.re with your Cfx.re account, then create server key. The portal go ask for the IP address of the machine wey go use am, and the key go bind to that address. If you move go new VPS, edit the key for the portal; no create second one. The edit dey apply immediately, but FXServer go only validate the key again when e restart.

Write ~/FXServer/server-data/server.cfg:

endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap

sv_hostname "My FiveM server"
sv_maxclients 48
set onesync on
sv_scriptHookAllowed false

sv_licenseKey ChangeMe

add_ace group.admin command allow
add_principal identifier.fivem:1 group.admin

sv_maxclients dey accept value from 1 to 2048. Value of 32 or more need make onesync set to on or legacy, while value wey pass 64 need on. OneSync na the server state awareness mode. Na am dey allow server pass the small slot count wey the base game get. If you set 128 slots while OneSync dey off, you no go get 128 slots. Instead, server go reject the config.

sv_licenseKey dey take the key without quotes and without trailing space. FXServer dey split that line for whitespace, so one extra character fit break validation and make server refuse to start.

rcon_password no dey inside that file intentionally. RCON (remote console) go only turn on when you set the variable, and e go then listen on the same UDP port wey the game dey use. RCON password for public port na remote command channel into your server. Leave am unset unless you get specific need. If you use am, make the password long and random.

sv_scriptHookAllowed remain false. Official documentation mark am as not recommended, because allowing Script Hook V clients fit expose the server to client-side abuse.

add_principal identifier.fivem:1 dey give admin rights to Cfx.re account ID 1. Replace 1 with your own numeric ID. Otherwise, you don give admin rights to another person account and you no give yourself any.

Start am once by hand:

cd ~/FXServer/server-data
bash ~/FXServer/server/run.sh +exec server.cfg

From another SSH session, ask the server about itself:

curl -s http://127.0.0.1:30120/info.json | head -c 200

JSON wey name your server variables and resources show say FXServer don bind and e dey answer. Connection refused mean say e never bind the port, so read the console output instead of guessing.

Server wey no get key go print this message and stop:

This server does not have a license key specified. Please set the sv_licenseKey console variable to a key from https://keymaster.fivem.net/.

The message still dey show the old keymaster address. That address go take you to the same Cfx.re portal. If the key dey set but server still refuse to run, the usual cause na say the IP address registered with the key no longer match this machine.

Which ports FiveM server need open?

Port 30120 for TCP (transmission control protocol) and UDP (user datagram protocol). FiveM dey use one port number for two protocols, and e need both. If you open only TCP, the symptom go confuse you: http://your.ip:30120/info.json go answer for browser, so e go look like say server dey healthy. But game client go remain for Failed to get info from server and never join, because client query and game traffic dey use UDP.

sudo ufw allow OpenSSH
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
sudo ufw enable
sudo ufw status verbose

Keep second SSH session open while you dey enable any firewall. The ufw basics for VPS dey explain default deny policy wey make the rules above enough by themselves.

Most providers still dey run network firewall outside the guest, and you dey control am from the panel, no be shell. ufw rule no prove anything about that layer. When TCP dey answer from outside but players still no fit connect, monitor the wire while person dey try connect:

sudo tcpdump -ni any udp port 30120

If packets dey arrive, outer firewall dey okay and the problem dey inside server. If everywhere quiet, something before the box dey drop the packets, so check provider panel next.

Manage server with txAdmin without exposing am

txAdmin dey inside the artifact wey you don download already. Start run.sh without any +exec argument, and e go open web panel for TCP port 40120. E go print panel URL and short-lived PIN for console. You go use that PIN once to link your Cfx.re account. After that, you go log in with the admin account wey e create.

txAdmin no get default password, so the risk no be say you forget change one credential. The risk na wetin the panel be: remote console. E fit restart server, edit server.cfg, deploy server data, and run commands as your server user. If you leave 40120 reachable from internet, you don put login page for all these actions on public address. Scanners fit find open panel ports within hours. No open 40120 for firewall. Reach am through SSH tunnel from your own machine:

ssh -N -L 40120:127.0.0.1:40120 fivem@YOUR_SERVER_IP

Then open http://127.0.0.1:40120 for your browser. The panel traffic go pass inside the SSH connection, and the port go remain closed to everybody else.

One trap dey wey you need know before you try another way to fix this matter. txAdmin dey read TXHOST_INTERFACE (default 0.0.0.0) to decide which interface e go bind to. Documentation talk clearly say the same value go apply to FXServer too. If you set am to 127.0.0.1 to hide the panel, you go also bind game server to loopback. This one mean say no player fit reach the server at all. Close the panel port with firewall, no be with that variable. To move the panel go another port, set TXHOST_TXA_PORT. E accepts any value except 30120. The older +set txAdminPort convar dey appear for many guides. txAdmin own documentation mark am as deprecated and talk say e go stop working for future release.

Make the server continue to run after you log out

bash run.sh go stop when your SSH session end. tmux dey okay while you dey test: run tmux new -s fivem, start the server, press Ctrl-b then d to detach, and use tmux attach -t fivem to come back. tmux session no dey survive reboot, so anything wey matter to you suppose dey inside systemd unit.

Write /etc/systemd/system/fivem.service:

[Unit]
Description=FiveM FXServer
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=fivem
Environment=HOME=/home/fivem
WorkingDirectory=/home/fivem/FXServer/server-data
ExecStart=/bin/bash /home/fivem/FXServer/server/run.sh +exec server.cfg
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now fivem
systemctl status fivem
journalctl -u fivem -f

enable --now get two jobs: e start the service immediately, and e bring the service back after reboot. Server wey you start by hand go disappear after the next kernel update. journalctl -u fivem -f na your console now, because systemd service no get terminal wey you fit type inside. If you dey manage the server through txAdmin instead, remove +exec server.cfg from ExecStart and point WorkingDirectory to /home/fivem/FXServer/server, because txAdmin dey start the game server itself and keep its data folder beside run.sh.

Wetin to back up, and where dem dey

The artifacts no worth backing up, because you fit download the pinned build again within one minute. Four things belong to you alone.

  • ~/FXServer/server-data/resources: every resource wey you install, buy, or write.
  • server.cfg, anywhere e dey: the complete server configuration, including your admin principals.
  • ~/FXServer/server/txData: txAdmin configuration, admin list, and logs. With the Linux artifact, this folder dey created beside run.sh.
  • The MariaDB or MySQL database, if your framework dey use one. Characters, money, vehicles, and inventories dey there and nowhere else, so resource backup without database dump go restore empty world.
mkdir -p ~/backups
mysqldump -u fivem -p --single-transaction fivem_db > ~/backups/fivem-$(date +%F).sql

Dump wey dey for the same disk with the server no be backup, because na the disk fit fail. Push am comot from the box on schedule. Na wetin restic backups from a VPS dey do.

Failure modes and the strings you will see

Permission denied on the loader. Server go stop immediately and show line like this:

run.sh: line 8: /home/fivem/FXServer/server/alpine/opt/cfx-server/ld-musl-x86_64.so.1: Permission denied

Dis one happen because dem extract archive with sudo, so everything wey dey under alpine/ belong to root and fivem user no fit execute loader inside am. Use sudo chown -R fivem:fivem /home/fivem/FXServer to correct the ownership, or delete the folder and extract am again as fivem.

tar refuses to open the download. tar (child): xz: Cannot exec: No such file or directory mean say xz-utils package no dey installed, so tar no fit decompress .tar.xz archive. Install am and extract again. Download wey finish too quickly usually na HTML error page wey save as fx.tar.xz, and tar report say na corrupt archive.

The server runs and nobody can join. Check the ports first, for dis order: ufw rule for both TCP and UDP on 30120, then provider own network firewall, then the registered IP for the licence key. curl against info.json from outside the box go separate network problem from server problem with one command.

Tick time climbs as players arrive. txAdmin performance panel dey show server tick time. When e rise as player count increase while overall CPU use still look low, one resource dey use up the main thread. Remember the arithmetic: for 4 vCPU box, one fully loaded core go show as roughly 25 percent of total CPU for top, so e fit look idle even when e no be. Stop resources one by one and monitor the tick time to find the one wey dey cost you.

Sey how e compare with other game servers

FiveM server wey players fit use need one fast CPU core plus enough memory for the resource list wey you actually dey run. Slot count dey come from these two things, and plenty vCPUs no fit fix slow core. How to pick VPS for game servers dey explain this trade-off for different game servers, and how to run Minecraft server for VPS get the same basic setup: one main tick loop, so speed per core still dey decide the limit.

FAQ

How much CPU and RAM FiveM server need?

One fast core dey matter pass several slow ones, because FXServer dey run game logic for one main thread. Compare the published single thread score of the CPU model, then confirm am for the server with sysbench cpu --threads=1 run and check say vmstat dey show near zero steal time. For memory, base Cfx.re server data dey use few hundred megabytes, while roleplay framework wey get forty or fifty resources plus local database go dey comfortable with 8 GB and cramped below 4 GB. Na typical community figures be these, so monitor free -m when load dey peak instead make you trust dem.

Players need to own GTA V before dem fit join my FiveM server?

Yes. Every player wey connect need legitimate, licensed copy of GTA V for Steam, Rockstar Games Launcher or Epic Games, plus free Cfx.re account. FiveM client dey check game ownership before e connect. No supported way dey to bypass am, and running server wey dey try bypass am no dey allowed by Cfx.re.

Which ports FiveM server need open?

Port 30120 for TCP and UDP, both. HTTP endpoints like info.json and resource downloads dey use TCP, while game traffic from client dey use UDP. If you open only TCP, browser fit get answer from server but players go see Failed to get info from server. txAdmin need TCP 40120, and you suppose keep that port closed to internet.

E safe to leave txAdmin reachable on port 40120?

No. txAdmin na remote console wey fit restart server, edit configuration and run commands, so exposed panel mean say the whole game server control plane don expose. No default password dey, but public login page dey invite credential attacks wey you no fit see. Keep 40120 closed for firewall and reach the panel through SSH tunnel with ssh -N -L 40120:127.0.0.1:40120 user@server, then browse to http://127.0.0.1:40120. No bind txAdmin to 127.0.0.1 with TXHOST_INTERFACE, because that setting also force game server use loopback and no player go fit connect.

Pin the numbered build folder. Recommended label dey move to new build regularly, so script wey fetch recommended build fit give you different binary for every rebuild, and server wey work yesterday fit break during redeploy for reasons wey no relate to your changes. Record the build number and commit hash wey you test, upgrade deliberately, and keep the previous folder for disk so you fit switch back by editing one path inside your systemd unit.

#fivem#game-server#txadmin#single-thread#vps