Pular para o conteúdo
Set up a FiveM server on Windows

Set up a FiveM server on Windows

Step by step: download the FXServer artifact, extract it, run txAdmin, link your Cfx.re account, deploy a recipe with your license key, and connect. Plus the vanilla way.

Por enquanto, esta documentação está em inglês.

Last updated

This guide sets up a FiveM server on Windows 10, 11 or Windows Server with txAdmin. It works the same on your own PC (for development) and on a Windows VPS. Plan about 15 minutes.

Plays from youtube-nocookie.com after you click.

What you need

1. Create the folders

Make a folder with a short path and no spaces, for example:

Text
C:\FXServer\server

Short paths avoid problems with long resource paths and some tools. Don’t put the server in Program Files, Downloads or a OneDrive synced folder.

2. Download the artifact

  1. Open the official server download page (or https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/).
  2. Pick FiveM / RedM, Windows, Recommended and download server.7z.
  3. Check the build number against our Artifacts page, which flags builds with known problems.

Note

The Enhanced platform (Cfx Server) is a different download on the same page. Pick the FiveM / RedM (Legacy) build unless you know you want Enhanced. See Legacy and Enhanced.

3. Extract it

Open server.7z with 7-Zip and extract everything into C:\FXServer\server. You should now have C:\FXServer\server\FXServer.exe and a citizen folder next to it.

Tip

Windows Defender scanning every file makes FXServer start slowly. The official FAQ suggests excluding the folder: open PowerShell as administrator and run Add-MpPreference -ExclusionPath 'C:\FXServer\'.

4. Start txAdmin

Double click FXServer.exe. A console window opens and, because you did not pass +exec server.cfg, FXServer starts txAdmin. It creates C:\FXServer\txData and opens http://localhost:40120 in your browser. The console also prints a 4 digit PIN.

If the browser does not open, go to http://localhost:40120 yourself. On a VPS, use http://YOUR_VPS_IP:40120 from your own PC (and open TCP 40120 in the Windows firewall, ideally only for your IP).

  1. Check that the PIN is filled in and click Link Account.
  2. Log in with your Cfx.re (forum) account and click Yes, Allow.
  3. Create a backup password. You will use it if Cfx.re login is ever down, so save it in a password manager.

This makes you the master admin of this txAdmin.

6. Run the setup and deployer

  1. Enter a server name and click Next.
  2. Choose Popular Recipes.
  3. Pick a recipe:
    • FiveM Basic Server (Legacy), sometimes shown as CFX Default: a clean, framework free server. Best for learning and for vMenu servers.
    • QBCore, Qbox or ESX Legacy: full roleplay frameworks. These need MariaDB running. See Popular recipes.
  4. Confirm the data location (the default txData\<name>.base is fine) and click Save.
  5. The Recipe Deployer shows the recipe YAML. Click Next.
  6. Paste your license key. For framework recipes, fill in the database host (localhost), port (3306), user (root) and password. Leave the database name empty and txAdmin generates one.
  7. Click Run Recipe. txAdmin downloads the resources and, for frameworks, imports the SQL. This takes a minute or two.
  8. Review the generated server.cfg and click Save & Run Server.

The live console in txAdmin now shows the server starting. When you see resources starting and no red errors, it is up.

Important

QBCore and some other recipes install NPM packages with yarn on first start. Let that finish before you restart. The QBCore docs say this explicitly.

7. Connect

  1. Start FiveM.
  2. Press F8 to open the client console.
  3. Type connect localhost:30120 (same PC) or connect YOUR_PUBLIC_IP:30120 and press Enter.

You can also use the direct connect box in the FiveM main menu with the same address. To let friends connect, see Ports and networking.

8. Make it start on its own

txAdmin restarts FXServer on crashes, but not the whole machine. On a VPS, start FXServer when Windows boots:

  1. Create C:\FXServer\start.bat:
C:\FXServer\start.bat
@echo off
cd /d C:\FXServer\server
FXServer.exe
  1. Open Task Scheduler, create a task that runs start.bat At startup, “Run whether user is logged on or not”, with the account that owns the folder.
  2. In txAdmin, Settings > FXServer, turn on starting the server automatically when txAdmin starts.

Folder layout after setup

Text
C:\FXServer\
├─ server\                 FXServer.exe + citizen\  (replace to update)
├─ start.bat
└─ txData\
   ├─ admins.json          txAdmin accounts
   ├─ default\             txAdmin config, logs, player database
   └─ MyServer.base\
      ├─ server.cfg
      └─ resources\

Your own resources go in resources\[local]\ and get an ensure line in server.cfg. See Installing resources.

The vanilla way (no txAdmin)

Useful for a throwaway dev server or when you want to see exactly what runs. From the official vanilla guide:

bat
cd /d C:\FXServer
git clone https://github.com/citizenfx/cfx-server-data.git server-data

Create C:\FXServer\server-data\server.cfg:

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 dev server"
sv_maxclients 8
sv_licenseKey "cfxk_your_key_here"
sv_enforceGameBuild 3751
set onesync on

Then start it from inside the data folder:

bat
cd /d C:\FXServer\server-data
C:\FXServer\server\FXServer.exe +exec server.cfg

Warning

Always start FXServer from inside the server data folder (or tell txAdmin where it is). If you start it from somewhere else, it cannot find resources and you get “no resources found” or “couldn’t find resource” errors.

Next steps