01
Before you start
Windows is the main platform for the FiveM server: the Cfx.re documentation describes the Linux version as a port provided as a courtesy, and states that issues are more likely to be fixed on Windows. If you prefer Linux, follow the guide installing FiveM on a Linux VPS instead.
- A license key: create it for free on the Cfx.re portal. The guide creating a FiveM server covers this step.
- Remote Desktop: the whole installation takes place in a session on the VPS. If you have never opened one, read connecting to a Windows VPS.
- An archive tool: the Windows artifacts come as a
.7z file. The Cfx.re documentation asks for a third-party tool such as 7-Zip to open it.
- Memory: Windows takes its share before FiveM. Add up what the system, the database and your resources need: a busy roleplay server needs far more than a racing server.
For a FiveM for GTAV Enhanced server, Cfx.re also requires the Microsoft Visual C++ 2017 Redistributable to be installed before the first launch.
02
Download the artifacts and launch txAdmin
The FiveM server is distributed as artifacts. Open the Server Download page of the Cfx.re documentation (docs.fivem.net/docs/server-download/); the old Windows artifacts address, build_server_windows, now redirects to it. Choose the FiveM / RedM platform (or FiveM for GTAV Enhanced), the Windows operating system and the Recommended branch, then download the server.7z file.
Create the server folder in PowerShell, then extract the archive into it with 7-Zip:
New-Item -ItemType Directory -Force C:\FXServer\server
This folder only holds the server programs. txAdmin stores its data (accounts, settings, history) in a txData folder placed next to it, in the parent folder: here C:\FXServer\txData. Artifact updates therefore leave it untouched.
Double-click FXServer.exe (cfx-server.exe for FiveM for GTAV Enhanced). txAdmin starts and opens its page in the VPS's browser, on port 40120. Then, as the Cfx.re documentation describes:
- check that the PIN is filled in and click Link Account to link your Cfx.re account;
- create the admin page password, then give the server a name;
- under Popular Recipes, pick a recipe: CFX Default FiveM for a basic server, or a roleplay framework, which needs a database (next section);
- paste your license key, run the recipe, then click Save & Run Server.
The recipe writes the server.cfg for you: its lines are explained in the FiveM server.cfg, and the txAdmin interface in the txAdmin guide.
03
Install MariaDB for Windows
ESX, QBCore and most roleplay frameworks store their data in MariaDB. Install it before running a recipe that needs it. Download the Windows installer (.msi file, 64-bit) from the official mariadb.org site, then run it:
- Root password: the installer asks for it. Pick a long one and keep it.
- Remote root access: leave this box unchecked. The FiveM server runs on the same machine.
- Windows service: keep the option checked (default name
MariaDB): the database then starts on its own with the VPS.
- Port: 3306 by default. Never open it in the firewall.
The installer also adds HeidiSQL, a graphical tool to browse the database, and a MariaDB Client entry in the Start menu. Open that client, enter the root password, then create a database and a user dedicated to the server:
CREATE DATABASE fivem;
CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'mot-de-passe-long';
GRANT ALL ON fivem.* TO 'fivem'@'localhost';
FLUSH PRIVILEGES;
Then give these details (host localhost, database, user, password) to the txAdmin recipe when it asks for them.
04
Open the ports in Windows Firewall
Windows Firewall blocks incoming connections by default. FiveM's game port is 30120, over TCP and UDP (the endpoint_add_tcp and endpoint_add_udp lines of server.cfg). In PowerShell run as 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
txAdmin (port 40120) is the admin door to the whole server. If you only use it from the VPS's browser, in the Remote Desktop session, open nothing. If you need it from your own computer, restrict the rule to your IP address:
New-NetFirewallRule -DisplayName "txAdmin" -Direction Inbound -Protocol TCP -LocalPort 40120 -RemoteAddress 203.0.113.10 -Action Allow
Replace 203.0.113.10 with your address. A port changed in server.cfg must be changed in the rule too: the guide game server ports explains how to run several servers on one machine. Public roleplay servers attract attacks: see also protecting a game server from DDoS attacks.
05
Automatic start and updates
Started by hand, FXServer stops when you close its window or when the VPS restarts, for example after a Windows update. A scheduled task triggered at startup relaunches it with no session open. First close the FXServer window you opened by hand, then, in PowerShell as administrator:
$cred = Get-Credential -Message "Compte qui lance le serveur"
$action = New-ScheduledTaskAction -Execute "C:\FXServer\server\FXServer.exe" -WorkingDirectory "C:\FXServer\server"
$trigger = New-ScheduledTaskTrigger -AtStartup
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit ([TimeSpan]::Zero) -Priority 4
Register-ScheduledTask -TaskName "FiveM txAdmin" -Action $action -Trigger $trigger -Settings $settings -User $cred.UserName -Password $cred.GetNetworkCredential().Password -RunLevel Highest
Use the account you set up txAdmin with. Without -ExecutionTimeLimit set to zero, Windows would stop the task after 72 hours; -Priority 4 gives it normal priority back. The guide game server on a Windows VPS explains these settings. Test with Start-ScheduledTask -TaskName "FiveM txAdmin", then restart the VPS and check that the server comes back on its own.
Updating the artifacts. Stop the server from txAdmin, then the task (Stop-ScheduledTask -TaskName "FiveM txAdmin"); check in Task Manager that no FXServer.exe is still running. Rename C:\FXServer\server to C:\FXServer\server-precedent, extract the new recommended version into a new C:\FXServer\server folder, then start the task again. txData, your resources and the database stay where they are; if a resource breaks, put the old folder back.
Also choose when Windows updates happen (managing Windows Server updates) and regularly copy off the VPS the txData folder, the server folder created by the recipe and a database export (backing up a Windows VPS).
06
On CloudFive
CloudFive's Windows VPS, from €8.50 per month, suits this installation:
- Windows Server installed, license included, and Remote Desktop ready on delivery;
- an AMD Ryzen 9 9950X, with DDR5 memory and NVMe storage, and a dedicated IPv4 address;
- basic anti-DDoS protection included, snapshots and a console from the customer area, and a plan change from the VPS page if the server grows (the difference is prorated).
The servers are in France, monthly with no commitment, with support in French 7 days a week.
Don't want to manage anything? The FiveM hosting, from €2.50 per month, is ready in about 30 seconds: txAdmin included, ESX, QBCore or Qbox in one click, MariaDB databases, a shared Patreon key provided (limited to 48 players) and Anti-DDoS Premium with a FiveM-specific profile. The customer area shows the installed artifacts version and lets you go back to the previous one, after an automatic backup.
07
Frequently asked questions
Where do I download the FiveM artifacts for Windows?
From the Server Download page of the Cfx.re documentation, docs.fivem.net, where the old build_server_windows address now redirects. Choose the FiveM / RedM platform, the Windows operating system and the Recommended branch, then download the server.7z file.
What is the txAdmin port and should I open it?
txAdmin listens on TCP port 40120 by default. If you use it from the VPS's browser, in Remote Desktop, open nothing. Otherwise, create a firewall rule restricted to your own IP address with the -RemoteAddress option.
Which ports should I open for FiveM on Windows?
Port 30120, over TCP and UDP, with one rule per protocol in Windows Firewall. Never open MariaDB's port 3306, and keep txAdmin's port 40120 restricted to your own address if you need it remotely.
How do I start FiveM when Windows boots?
Create a scheduled task triggered at startup that launches FXServer.exe with the account that set up txAdmin. Remove the task's 72-hour limit and give it normal priority back; txAdmin then takes care of the game server.
Should I choose a Windows VPS or a FiveM plan?
The Windows VPS leaves you in control of everything, at the cost of doing the installation, updates and backups yourself. CloudFive's FiveM plan comes with txAdmin, one-click frameworks, MariaDB and Anti-DDoS Premium already in place.