How to Set Up Your Own FiveM Server
A truly beginner-friendly, copy-paste guide to hosting your own FiveM server - no prior Linux or Windows Server experience required. Every folder, every command, every click explained. Pick your platform below; both paths are covered end to end, from an empty VPS to the moment a player connects.
Running your own FiveM server gives you full control - your own rules, your own scripts, your own economy. The two popular ways to host are Windows (via RDP) and Linux (via SSH). Windows is easier if you're comfortable clicking through a GUI; Linux is cheaper, faster, and what almost every large production server runs on. This guide covers both, step by step, assuming you've never touched a server before.
What you'll have at the end
A fully running FiveM server you can connect to from GTA V, with MariaDB/MySQL ready for scripts like ESX or QBCore, txAdmin web panel for easy management, and a correct firewall configuration on both the OS and provider level.
1. Choose the Right Hardware
FiveM is extremely single-threaded. Almost all game logic runs on ONE CPU core. A server with 16 slow cores will perform dramatically worse than one with 4 fast cores. Ignore marketing numbers - look at single-core clock speed and make sure it's at least 3.5 GHz, ideally 4.5 GHz or higher.
Up to 32 players: 4 vCPU (3.5 GHz+) · 8 GB RAM · 80 GB SSD
Up to 64 players: 6 vCPU (4.0 GHz+) · 16 GB RAM · 160 GB SSD
Up to 128 players: 8 vCPU (4.5 GHz+) · 32 GB RAM · 250 GB NVMe
200+ players: Dedicated Ryzen 7950X3D or i9-14900K + 64 GB DDR5
CPU clock speed is king
FiveM runs almost all of its game logic on a single main thread. A 5.0 GHz CPU with 4 cores will run circles around a 3.5 GHz CPU with 16 cores. When picking a VPS or dedicated server, always prioritize single-core clock speed over total core count.
2. Pick a Windows RDP Provider
An RDP provider rents you a remote Windows machine you control like you'd sit in front of it. Good options for FiveM:
- OVH / SoYouStart - Competitive pricing, gaming-optimized network with free DDoS protection. Best overall price-to-quality.
- Zap-Hosting - Gaming-focused, easy Windows VPS setup with automatic FiveM installer. Great for absolute beginners.
- Kimsufi - Cheapest dedicated option. Older hardware but fine for up to ~32 players.
- Hetzner Dedicated - European datacenters, excellent hardware. Windows Server license is an extra monthly fee.
Order a Windows Server 2019 or 2022 image (never Windows Desktop editions - they're not designed for this). You'll receive an email with three things: IP address, administrator username, and a password. Keep these safe.
2. Pick a Linux VPS Provider
A Linux VPS is cheaper per performance unit than Windows (no OS license fee) and what basically every production FiveM server runs on.
- Hetzner Cloud - Best price-to-performance in Europe. CPX31 or CPX41 plans are perfect for up to 64 players. Includes unlimited traffic.
- Netcup - German provider, excellent VPS pricing, unlimited bandwidth.
- OVH VPS - Global datacenters, free anti-DDoS. Pick a location close to your players.
- Contabo - Very cheap but shared CPUs, only recommended for under 32 players.
Order a fresh Ubuntu 22.04 LTS or Ubuntu 24.04 LTS image. You'll receive an email with the server's IP address and a root password (or an SSH key if you uploaded one during setup).
3. Connect to Your Windows RDP
RDP = Remote Desktop Protocol. It's how you control a remote Windows machine from your own PC.
-
Open the Remote Desktop app
On Windows: press
Win + R, typemstsc, hit Enter. A "Remote Desktop Connection" window opens.On macOS: install the free "Microsoft Remote Desktop" app from the App Store.
-
Enter the IP address
Paste your server's IP into the Computer field (exactly as it came in the provider's email - just the IP, no http, no port). Click Connect.
-
Enter credentials
Windows will ask for a username and password. Use what the provider emailed you - usually
Administratoras the username. If it asks about a certificate warning, click Yes to accept. -
First-time setup inside Windows
Once logged in, you're on the remote Windows desktop. Immediately do two things:
- Open Windows Update and install every available update, then reboot. A fresh VPS is often months behind on security patches.
- Open System Properties → Change Password and set a new, strong password. The provider's default password is in their database.
3. Connect to Your Linux VPS via SSH
SSH = Secure Shell. It's how you control a remote Linux machine from a terminal. No graphical interface - just commands.
-
Open a terminal
On Windows 10/11: open PowerShell (press Start, type "PowerShell", Enter).
On macOS: open Terminal (Cmd + Space, type "Terminal", Enter).
On Linux: open any terminal emulator (Ctrl + Alt + T on most distros).
-
Connect via SSH
Type the command below, replacing
YOUR.SERVER.IPwith the IP from your provider's email:ssh root@YOUR.SERVER.IPFirst time: it asks "Are you sure you want to continue connecting?" - type
yesand press Enter. Then it asks for the root password - paste it from the provider's email (nothing will appear as you type, that's normal). -
Update the system
A fresh VPS is often weeks behind on security patches. Update first, every time:
apt update && apt upgrade -yIf asked any questions during the upgrade ("keep local config file?" etc.), press Enter to keep defaults.
-
Create a non-root user (security best practice)
Running FiveM as root is dangerous - a single bug in a script could wipe your system. Create a dedicated user:
adduser fivem usermod -aG sudo fivemSet a password when prompted (write it down). You can skip the Full Name / Room Number questions by pressing Enter. From now on, log in as this user:
su - fivem
4. Configure the Windows Firewall
FiveM uses port 30120 (TCP + UDP). Without opening it, nobody can connect. txAdmin (the web management panel, set up in step 6) uses port 40120.
-
Open PowerShell as Administrator
Click Start, type
PowerShell, right-click the result, choose Run as administrator. Click Yes on the UAC prompt. -
Run the firewall commands
Copy-paste all three lines into PowerShell and press Enter. You'll see a table of rule details as confirmation:
PowerShell (Administrator)New-NetFirewallRule -DisplayName "FiveM TCP" -Direction Inbound -Protocol TCP -LocalPort 30120 -Action Allow New-NetFirewallRule -DisplayName "FiveM UDP" -Direction Inbound -Protocol UDP -LocalPort 30120 -Action Allow New-NetFirewallRule -DisplayName "txAdmin" -Direction Inbound -Protocol TCP -LocalPort 40120 -Action Allow -
Also open your provider's cloud firewall
This is the #1 mistake people make. OVH, Hetzner, AWS etc. have their own firewall in their web dashboard - it sits in front of the Windows Firewall and blocks everything by default. Log into your provider's panel, find "Firewall" or "Security Groups", and add the same inbound rules:
- TCP port 30120 - source: any IPv4
- UDP port 30120 - source: any IPv4
- TCP port 40120 - source: any IPv4 (only if you want to access txAdmin from your home PC)
4. Configure the UFW Firewall
Ubuntu ships with UFW (Uncomplicated Firewall). FiveM uses port 30120 (TCP + UDP), and txAdmin uses 40120 (TCP only).
Allow SSH (port 22) first - always
If you enable UFW without allowing SSH, you'll instantly lock yourself out of your own server. The commands below are in the correct order - follow them exactly.
-
Allow SSH, FiveM, and txAdmin ports
sudo ufw allow 22/tcp sudo ufw allow 30120/tcp sudo ufw allow 30120/udp sudo ufw allow 40120/tcp -
Enable the firewall
This is the only command that could lock you out if step 1 was skipped. If you did step 1, it's safe:
sudo ufw enableType
yand press Enter when it asks to confirm. -
Verify the rules
sudo ufw statusYou should see four "ALLOW" rules. If anything's missing, re-run the corresponding
allowcommand. -
Open your provider's cloud firewall too
Hetzner Cloud, OVH, AWS etc. have a separate firewall in their web dashboard that sits in front of UFW. Even if UFW allows it, the cloud firewall will drop it. Log into your provider's panel, find "Firewalls" / "Security Groups" / "Network", and add the same inbound rules (TCP + UDP 30120, TCP 40120, TCP 22).
5. Download the FiveM Server Artifacts
"Artifacts" is FiveM's term for the actual server binary (the FXServer.exe file that runs your server). New builds are released multiple times a week - always grab the latest RECOMMENDED build, not the bleeding-edge one.
-
Open the artifacts page in your RDP browser
Inside your RDP session, open Edge or Chrome and navigate to:
runtime.fivem.net/artifacts/fivem/build_server_windows/master/
You'll see a long list of build numbers. At the top, look for the row marked "LATEST RECOMMENDED" - click it.
-
Download server.7z
On the build page, find
server.7z. Right-click it and choose "Save link as…". Save it to your Desktop for now. -
Install 7-Zip (required to extract)
.7zis a compressed archive format Windows can't open natively. Download 7-Zip (free) from 7-zip.org and install it with default options. -
Create your FiveM folder structure
Open File Explorer (
Win + E) and create this exact structure on the C: drive:C:\ └── FXServer\ ├── server\ # FXServer.exe lives here (binaries) └── server-data\ # Your server.cfg + resources live hereTo create them: right-click empty space in
C:\→ New → Folder → name itFXServer. Open it, then create two subfolders:serverandserver-data. -
Extract server.7z into C:\FXServer\server
Right-click
server.7zon your Desktop → 7-Zip → Extract files… → in the "Extract to:" field enterC:\FXServer\server\→ click OK.When done,
C:\FXServer\servershould containFXServer.exe, a bunch of.dllfiles, and subfolders likecitizenanddata. If instead you see a single folder namedserverinside, move everything one level up soFXServer.exesits directly insideC:\FXServer\server. -
Download the server-data template
FiveM provides a ready-made
server-datatemplate with example configs and basic resources. Open PowerShell and run:cd C:\FXServer\server-data git clone https://github.com/citizenfx/cfx-server-data.git .No Git installed? Download Git for Windows first (default options during install). Alternatively, download the ZIP from the cfx-server-data repo and extract its contents (not the containing folder) into
C:\FXServer\server-data.
5. Download the FiveM Server Artifacts (Linux)
"Artifacts" is FiveM's term for the server binary (the FXServer executable). New builds are released multiple times a week - always grab the latest recommended build.
-
Install required tools
As the
fivemuser you created earlier, install everything needed:sudo apt install -y curl wget xz-utils git screenwgetdownloads the artifact,xz-utilsextracts.tar.xzfiles,gitclones the server-data template, andscreenkeeps the server running when you disconnect SSH. -
Create the folder structure
mkdir -p ~/FXServer/server mkdir -p ~/FXServer/server-data cd ~/FXServer/serverYou'll end up with
~/FXServer/server(the binaries) and~/FXServer/server-data(your configs and resources). -
Find the latest build URL
Visit runtime.fivem.net/artifacts/fivem/build_proot_linux/master/. Find the "LATEST RECOMMENDED" row at the top and copy the full URL to
fx.tar.xz. It looks like:https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/12345-abc.../fx.tar.xz -
Download and extract
Replace
PASTE_URL_HEREwith the URL you just copied:cd ~/FXServer/server wget PASTE_URL_HERE tar xf fx.tar.xz rm fx.tar.xzVerify with
ls- you should seerun.sh,FXServer, and a folder calledalpine. -
Clone the server-data template
cd ~/FXServer/server-data git clone https://github.com/citizenfx/cfx-server-data.git .The trailing
.matters - it clones into the current folder instead of a new subfolder. After cloning,lsshould show folders likeresourcesand a file calledserver.cfg(a template - you'll replace it in step 8).
6. Set Up txAdmin (Highly Recommended)
txAdmin is the official web-based management panel for FiveM. It handles 90% of this tutorial's remaining work through a guided web interface - creating server.cfg, downloading a starter framework (ESX, QBCore, vMenu…), setting up admin accounts, and restart scheduling. You can always edit files manually later; txAdmin doesn't lock you into anything.
Why txAdmin is worth the 5 minutes
txAdmin is bundled with every FiveM build - no extra install. You get a web console, live chat, player management, automatic restarts, crash recovery, and a one-click framework installer. Skipping it and configuring manually is three times the work for no real benefit.
Start FXServer for the first time
Open Command Prompt (Win + R, type cmd, Enter) and run:
cd C:\FXServer\server-data
C:\FXServer\server\FXServer.exe +set serverProfile default
A console window opens with a lot of output. Near the top, look for lines like:
[txAdmin] Bootstrap PIN: 1234
[txAdmin] Open http://localhost:40120 to continue
Note down the PIN. Open a browser inside your RDP session and go to http://localhost:40120. If you opened port 40120 in both firewalls earlier, you can also access it from your home PC via http://YOUR.SERVER.IP:40120.
Start FXServer inside a screen session
screen creates a persistent terminal that survives SSH disconnects - crucial on a remote server. Start a session named "fivem":
screen -S fivem
cd ~/FXServer/server-data
bash ~/FXServer/server/run.sh +set serverProfile default
The server boots and prints (near the top):
[txAdmin] Bootstrap PIN: 1234
[txAdmin] Open http://YOUR.SERVER.IP:40120 to continue
Note the PIN. Open that URL in your home PC's browser. To detach from screen (server keeps running): press Ctrl + A, then D. To reattach later: screen -r fivem.
Complete the txAdmin web setup
In the browser, you'll see the txAdmin setup wizard:
-
Enter the Bootstrap PIN
Paste the PIN from the console output. It only works for 5 minutes - if it times out, stop the server (Ctrl+C) and start it again to get a new PIN.
-
Link your Cfx.re account
Use the same Cfx.re account you use to play FiveM. This becomes the admin that can log into txAdmin in the future.
-
Enter your server license key
Get a FREE license at keymaster.fivem.net. Click "+ New", enter your server's public IP, and copy the generated key (format:
cfxk_xxxxxxxxxx_xxxxxx). Paste it into txAdmin. -
Pick a framework / starter template
txAdmin offers one-click installs:
- ESX Legacy - The most popular roleplay framework. Pick this if unsure.
- QBCore - Growing RP framework with modern architecture.
- vMenu - Freeroam / admin trainer menu. Good for sandbox or racing servers.
- Empty - Blank - you add everything yourself.
-
Finish and stop for now
txAdmin generates a working
server.cfg. Don't start the server yet - we need to set up the database in step 7.
7. Install MariaDB / MySQL (Windows)
Almost every serious script (ESX, QBCore, inventories, housing…) requires a MySQL-compatible database. On Windows, the easiest path is XAMPP, which bundles MariaDB and phpMyAdmin with a GUI.
-
Download and install XAMPP
Get the latest Windows installer from apachefriends.org. Install to the default path (
C:\xampp). -
Start MariaDB + Apache
Open the XAMPP Control Panel (Start menu → XAMPP). Click Start next to "Apache" and "MySQL" (the name is legacy - it's really MariaDB). Both should turn green.
-
Open phpMyAdmin
In your browser, open http://localhost/phpmyadmin. This is a graphical database manager.
-
Create the FiveM database
Click "New" in the left sidebar. Enter:
- Database name:
fivem_server - Collation:
utf8mb4_unicode_ci(critical for special characters!)
Click Create.
- Database name:
-
Create a dedicated database user
Click the new
fivem_serverdatabase in the sidebar → tab Privileges → Add user account. Enter:- User name:
fivem - Host name:
localhost - Password: generate a strong one and save it
- Tick "Grant all privileges on database fivem_server"
Click Go. Your MySQL connection string is:
mysql://fivem:YOUR_PASSWORD@localhost/fivem_server?charset=utf8mb4 - User name:
7. Install MariaDB (Linux)
MariaDB is an open-source, drop-in MySQL replacement - faster and completely free.
-
Install the server
sudo apt install -y mariadb-server -
Run the security hardening wizard
sudo mysql_secure_installationAnswer as follows:
- "Enter current password for root" → just press Enter
- "Switch to unix_socket authentication?" → n
- "Change the root password?" → y, set a strong one and save it
- "Remove anonymous users?" → y
- "Disallow root login remotely?" → y
- "Remove test database?" → y
- "Reload privilege tables?" → y
-
Create the FiveM database + user
sudo mysql -u root -pPaste the password you just set. You'll see a
MariaDB [(none)]>prompt. Run all of this (replaceYOUR_STRONG_PASSWORDwith an actual strong password and save it):CREATE DATABASE fivem_server CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'YOUR_STRONG_PASSWORD'; GRANT ALL PRIVILEGES ON fivem_server.* TO 'fivem'@'localhost'; FLUSH PRIVILEGES; EXIT;Your MySQL connection string is:
mysql://fivem:YOUR_STRONG_PASSWORD@localhost/fivem_server?charset=utf8mb4
8. Configure server.cfg
server.cfg is the main configuration file for FXServer. If you used txAdmin, one was auto-generated - edit it via txAdmin's "Configuration" menu. For a manual setup, here's the minimum config that actually works.
Windows path: C:\FXServer\server-data\server.cfg
Linux path: ~/FXServer/server-data/server.cfg
# ===== Endpoints (do not change unless you know why) =====
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
# ===== Server identity =====
sv_hostname "^2My FiveM Server ^7| ^3Roleplay"
sv_projectName "My FiveM Server"
sv_projectDesc "A fresh FiveM roleplay server"
sv_maxclients 64
# ===== License key (REQUIRED, get one at keymaster.fivem.net) =====
sv_licenseKey cfxk_XXXXXXXXXXXXXXXXXXXX_XXXXXX
# ===== Database =====
set mysql_connection_string "mysql://fivem:YOUR_PASSWORD@localhost/fivem_server?charset=utf8mb4"
# ===== Base resources =====
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure fivem
ensure hardcap
ensure rconlog
ensure scoreboard
ensure playernames
# ===== Permissions =====
add_ace group.admin command allow
add_ace group.admin command.quit deny
add_principal identifier.fivem:YOUR_FIVEM_ID group.admin
# ===== Convars =====
set steam_webApiKey "none"
sv_enforceGameBuild 3095
sv_licenseKey is mandatory - server won't start without it
Replace the cfxk_XXXX… placeholder with an actual key from keymaster.fivem.net. The license is tied to your server's public IP - if you change providers, generate a new one. A missing or invalid license produces "License key not found" in the console and the server immediately quits.
Things to customize for your setup:
sv_hostname- name shown in the FiveM server browser.^2,^3,^7are color codes (2=green, 3=yellow, 7=white - see color reference).sv_maxclients- player slots. Don't exceed what your CPU can handle (see step 1).mysql_connection_string- use the exact value prepared in step 7.add_principal identifier.fivem:YOUR_FIVEM_ID- replaceYOUR_FIVEM_IDwith your numeric FiveM ID. Find it by joining any server and typingstatusin the F8 console.sv_enforceGameBuild- forces players onto a specific GTA V DLC build (3095 = good modern default). Remove this line to allow any build.
9. Start the Server (Windows)
Create a batch file for easy one-click starts. Open Notepad, paste the contents below, then File → Save As:
- Save as type: "All files"
- File name:
start.bat - Save into:
C:\FXServer\server-data\
@echo off
cd /d C:\FXServer\server-data
C:\FXServer\server\FXServer.exe +exec server.cfg
pause
Double-click start.bat. A console window opens. Once you see:
Server started, listening on 0.0.0.0:30120
your server is live. Leave the console window open - closing it stops the server. To properly shut down, type quit in the console and press Enter.
For production: run as a Windows Service
Wrap start.bat with NSSM (Non-Sucking Service Manager) so it auto-starts on reboot and auto-restarts on crash. Or just let txAdmin handle restart scheduling via its web UI.
9. Start the Server (Linux)
For quick testing, use screen. For production, use systemd.
Quick test with screen
screen -S fivem
cd ~/FXServer/server-data
bash ~/FXServer/server/run.sh +exec server.cfg +set onesync on
Detach with Ctrl + A, then D. Reattach with screen -r fivem. To shut down, reattach and type quit.
Production setup: systemd service
systemd auto-starts FiveM on reboot and auto-restarts on crash. Create the unit file:
sudo nano /etc/systemd/system/fivem.service
Paste the following (replace fivem in User= / paths if your Linux username is different):
[Unit]
Description=FiveM Server
After=network.target mariadb.service
[Service]
Type=simple
User=fivem
WorkingDirectory=/home/fivem/FXServer/server-data
ExecStart=/bin/bash /home/fivem/FXServer/server/run.sh +exec server.cfg +set onesync on
Restart=on-failure
RestartSec=10
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
Save (Ctrl+X, then Y, Enter), then enable and start:
sudo systemctl daemon-reload
sudo systemctl enable fivem
sudo systemctl start fivem
sudo systemctl status fivem
View live logs:
sudo journalctl -u fivem -f
Useful commands:
sudo systemctl restart fivem- restartsudo systemctl stop fivem- stopsudo systemctl status fivem- check status
10. Connect From Your Game
On your gaming PC (not the server!):
-
Launch FiveM
Open the FiveM client you'd normally use to join servers.
-
Open the in-game console
Once FiveM loads, press F8. A console drops down from the top.
-
Type the connect command
Replace
YOUR.SERVER.IPwith your server's public IP:connect YOUR.SERVER.IP:30120Press Enter. Within 5-15 seconds, you should load onto the server. If you do - congratulations, your FiveM server is live. 🎉
Troubleshooting
"Connection timed out" / server doesn't appear in browser
Always a firewall issue. Three things to verify:
- Is the server actually running? Check for "Server started, listening on 0.0.0.0:30120" in the console.
- Is the OS firewall (Windows Firewall / UFW) open for 30120 TCP + UDP?
- Is the provider cloud firewall (Hetzner / OVH / AWS dashboard) open for 30120 TCP + UDP? This is forgotten 90% of the time.
Quick external test: telnet YOUR.SERVER.IP 30120. If it connects (or at least doesn't say "timed out"), TCP reaches the server.
"Invalid server license key"
Your license is bound to the IP you registered. If you've migrated IPs, go to keymaster.fivem.net and edit the key's IP - or generate a new one.
Poor performance / lag spikes
Connect to your server and type resmon in the F8 console. Red bars = problem. Common culprits:
- Windows Defender scans every FiveM file continuously. Add
C:\FXServerto Defender's exclusions (Windows Security → Virus & threat protection → Exclusions). - Inefficient scripts - many free scripts use
while true do ... Wait(0) endloops. Replace with optimized alternatives. - Too many players for your CPU - see step 1's spec table.
Random server crashes (Windows)
Almost always Windows Update auto-restarting. Disable automatic updates:
- Press
Win + R→ typegpedit.msc→ Enter - Navigate: Computer Configuration → Administrative Templates → Windows Components → Windows Update
- Open "Configure Automatic Updates" → set to Disabled → OK
- Reboot once - updates are now manual only.
Database connection errors on startup
If the console shows oxmysql: unable to connect, your connection string is wrong. Double-check: username, password, host (localhost unless your DB is on another machine), database name, and the ?charset=utf8mb4 suffix.
FXServer.exe crashes immediately on Windows
Install the Visual C++ Redistributable 2015-2022 (x64). A fresh Windows Server image often ships without it, and FXServer won't start until it's present.
Need premium FiveM scripts?
Browse our escrowed scripts, handcrafted with performance in mind.
Browse Store