How to Set Up a FiveM Server (GTA V Roleplay) on a VPS
Build your own FiveM (GTA V roleplay) server on a Linux VPS: install FXServer, add your license key, run server.cfg, and keep it online with systemd.

FiveM powers the huge GTA V roleplay scene, and running your own server means your own city, jobs, economy, and community. This guide installs a FiveM (FXServer) instance on a Linux VPS, gets it listed, and keeps it online. Players need a legitimate copy of GTA V to connect.
Requirements
- A VPS: Ubuntu 22.04, at least 2 vCPU and 4 GB RAM for a small RP server; a busy ESX/QBCore server with many resources wants 6–8 GB and strong single-thread CPU.
- A license key: free from the FiveM keymaster at keymaster.fivem.net. You'll paste it into
server.cfg. - Port: TCP and UDP 30120 (game), plus 40120 for txAdmin if you use it.
Step 1: User and dependencies
sudo adduser --disabled-password --gecos "" fivem
sudo apt update
sudo apt install -y curl xz-utils git
Step 2: Download FXServer
Grab the latest recommended Linux artifact from the FiveM build server. Visit the artifacts page, copy the latest recommended build URL, then:
sudo su - fivem
mkdir -p ~/FXServer/server ~/FXServer/server-data
cd ~/FXServer/server
wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/LATEST-HASH/fx.tar.xz
tar xf fx.tar.xz
Replace LATEST-HASH with the current recommended build path.
Step 3: Get the server data files
Clone the official server-data (resources, default config):
cd ~/FXServer/server-data
git clone https://github.com/citizenfx/cfx-server-data.git .

Step 4: Create server.cfg
Create ~/FXServer/server-data/server.cfg with the essentials:
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
sv_hostname "My Nxeon GTA RP Server"
sv_maxclients 48
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap
set steam_webApiKey ""
sv_licenseKey YOUR_LICENSE_KEY_HERE
Paste your keymaster key into sv_licenseKey. We break down every line of this file in how to configure a FiveM server (server.cfg explained).
Step 5: Open the firewall
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
sudo ufw allow 40120/tcp
sudo ufw reload
Open the same ports in your provider's network firewall.
Step 6: Start the server
cd ~/FXServer/server-data
bash ~/FXServer/server/run.sh +exec server.cfg
The first run may print a txAdmin PIN — open http://YOUR_SERVER_IP:40120 to finish web-based setup, which is the easiest way to manage the server.
Step 7: Keep it online with systemd
Create /etc/systemd/system/fivem.service:
[Unit]
Description=FiveM (FXServer)
After=network.target
[Service]
Type=simple
User=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
sudo journalctl -u fivem -f
Next steps: frameworks and resources
Most RP servers run a framework — ESX or QBCore — plus dozens of resources for jobs, inventory, and vehicles. Learn how to add them safely in how to add resources to a FiveM server. Because RP servers grow resource-heavy, size your box with Game Server Specs Explained: CPU, RAM and Bandwidth.
Managing the server with txAdmin
txAdmin is the web control panel bundled with FXServer, and it's the easiest way to run a server. On first launch it prints a PIN; open http://YOUR_SERVER_IP:40120 and use it to create an admin account. From there you get:
- One-click start/stop/restart and a live console.
- Scheduled restarts and automatic recovery if the server hangs.
- Player management, bans, and a live map.
- A deployer for popular recipes (ESX, QBCore) that scaffolds a whole server.
Run txAdmin behind the systemd service above so it survives reboots.
Troubleshooting first-boot problems
- "sv_licenseKey" errors: the key is missing, wrong, or already bound to a different IP — regenerate it in keymaster.
- Can't connect from the game: confirm TCP and UDP 30120 are open on both firewalls and endpoints bind to
0.0.0.0. - Resources won't start: check the
ensureorder and dependencies — details in the server.cfg guide. - Stuck on "Awaiting server OneSync status": enable OneSync in
server.cfg.
FAQ
Do players need to own GTA V?
Yes. Every player needs a legitimate copy of Grand Theft Auto V and the free FiveM client to connect.
Where do I get a FiveM license key?
Free from the FiveM keymaster at keymaster.fivem.net. Generate one key per server and paste it into sv_licenseKey.
What port does FiveM use?
TCP and UDP 30120 by default (set in server.cfg), plus 40120 for the txAdmin web panel.
How much RAM does a FiveM RP server need?
A small server runs on 4 GB; a busy ESX/QBCore server with many resources and 48+ players wants 6–8 GB and fast single-thread CPU.
Ready to build your city? Launch on an NVMe game server VPS from Nxeon with full root access, or use our Node.js hosting if you're also running companion web services for your community.