Step-by-Step Guide to Setting Up a FiveM Server
Prerequisites
- Windows or Linux: You can set up the server on either OS, but this guide will focus on Windows.
- FiveM Server Files: Download from the FiveM website.
- Basic knowledge of using Windows Command Prompt or Linux terminal.
Instructions
-
Download the FiveM Server Files
- Go to the FiveM Server Download page and download the server files (usually a .zip file).
- Extract the contents to a folder where you want your server files to reside (e.g.,
C:\FiveM_Server
).
-
Install the Required Dependencies
- Visual C++ Redistributable: Download and install the latest version from Microsoft.
- Ensure you have the latest version of .NET Framework installed.
-
Set Up the Server Configuration
- Inside your server folder, create a new file named
server.cfg
. - Here’s a basic configuration example:
# Server Information sv_hostname "My FiveM Server" sv_maxclients 32 sv_scriptHookAllowed 1 # Set your server's license key (Get yours from the Keymaster) sv_licenseKey "YOUR_LICENSE_KEY" # Load resources start mapmanager start chat start spawnmanager start sessionmanager start hardcap start fivem # Your server's resource names start your_resource_name_here
- Inside your server folder, create a new file named
-
Obtain a License Key
- Go to the FiveM Keymaster and create an account.
- Add a new server and obtain the license key to be placed in your
server.cfg
.
-
Add Resources
- Download any additional resources or mods you want (like scripts or maps) and put them in the
resources
folder inside your server directory. - Make sure to add
start resource_name
lines in yourserver.cfg
for each resource.
- Download any additional resources or mods you want (like scripts or maps) and put them in the
-
Run the Server
- Open Command Prompt (or PowerShell) and navigate to your server directory:
bash cd C:\FiveM_Server
- Run the server with the following command:
bash run.cmd +exec server.cfg
- If all goes well, your server should start running.
- Open Command Prompt (or PowerShell) and navigate to your server directory:
-
Connect to Your Server
- Launch FiveM on your PC.
- Click on "Direct Connect" and enter your server’s IP address or hostname (e.g.,
localhost
if you're running it locally).
-
Adjust Firewall Settings
- Make sure to allow the server through your firewall:
- Go to Control Panel > System and Security > Windows Defender Firewall > Allowed apps.
- Add
run.bat
orrun.cmd
to the allowed apps.
- Make sure to allow the server through your firewall:
Additional Tips
- Backup: Regularly back up your server files and configuration.
- Optimize: Depending on your needs, adjust settings in
server.cfg
for performance (like player limits, resource optimizations). - Community: Join FiveM communities or forums for support and resources.
Now you should have a basic FiveM server up and running! Enjoy hosting your game and connecting with friends!