FiveM servers are most commonly hosted on Windows, as it is the officially supported environment and typically the easiest to manage. However, for advanced users, FiveM does provide native Linux builds that allow you to host a server on a remote Linux VPS or dedicated server without Wine or Windows emulation.
This guide walks through how to set up a FiveM server on a Linux system using the official native artifacts.
To get started, you will need:
A Linux VPS or dedicated server (Ubuntu 20.04 LTS or newer is recommended)
Root or sudo access
Remote DDoS protection from your hosting provider or a third-party service
At least 4 GB RAM and a modern CPU
A FiveM license key from https://keymaster.fivem.net
First, update your package list and system packages:
sudo apt update && sudo apt upgrade -y
Install required utilities:
sudo apt install git wget curl xz-utils screen -y
(Optional) Reboot after major updates:
sudo reboot
Ensure your firewall is open on port 30120 (both TCP and UDP), which is the default port used by FiveM servers.
Create a directory for the server:
mkdir -p ~/fivem_server
Navigate to the directory:
cd ~/fivem_server
Download the latest Linux artifact from FiveM. As of now, the latest stable build is:
Extract the archive:
tar xf fx.tar.xz
(Optional) Delete the archive to free up space:
rm fx.tar.xz
Clone the default server-data folder:
git clone https://github.com/citizenfx/cfx-server-data.git ~/fivem_server/server-data
Navigate to the new folder:
cd ~/fivem_server/server-data
Create the server configuration file:
nano server.cfg
Example configuration:
sv_hostname "My Linux FiveM Server"
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
sv_maxclients 32
licenseKey "YOUR_LICENSE_KEY"
sv_scriptHookAllowed 1
sets sv_enforceGameBuild 2699
Replace "YOUR_LICENSE_KEY"
with your actual key from keymaster.fivem.net.
Return to your main server folder:
cd ~/fivem_server
Start a persistent screen session:
screen -S fivem
Launch the server:
./run.sh +exec server.cfg
To detach from the screen session while leaving the server running:
Press Ctrl + A, then D
To reattach later:
screen -r fivem
Choose a FiveM remote DDoS protection provider.
If you opt not to use a remote protection provider, you can take steps to help harden your server:
Change the default SSH port and use key-based authentication.
Configure your firewall (UFW example shown):
sudo ufw allow 22/tcp
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
sudo ufw enable
Monitor resource usage and access logs regularly.
Although FiveM now provides native Linux support, there are still a few unique challenges that can arise when running a FiveM server in a Linux environment. These issues are not typically encountered on Windows-based servers and may require a bit more experience to troubleshoot effectively.
Some community-developed scripts or resources may assume a Windows file structure or use backslashes (\
) in file paths. These will need to be manually corrected to use Unix-style forward slashes (/
).
Linux enforces strict file permissions. If you see a “permission denied” error when running run.sh
, you may need to make it executable using chmod +x run.sh
.
Depending on your Linux distribution, certain libraries like libc6
, libstdc++6
, or SSL-related packages may be missing. You can check for missing libraries with ldd ./fxserver
.
If your server appears to be online but players cannot connect, it's likely a firewall issue. Make sure both TCP and UDP traffic is allowed on port 30120, and confirm that your hosting provider has not blocked these ports.
If you're not using a terminal multiplexer like screen
, your server will stop when your SSH session ends. Always use screen
, tmux
, or configure the server as a systemd service to ensure it runs persistently.
Your license key must be tied to the public IP address of your server as registered in the FiveM Keymaster system. Using a private IP or mismatched license will prevent the server from launching.
Task | Command |
---|---|
Update package lists and system | sudo apt update && sudo apt upgrade -y |
Install required utilities | sudo apt install git wget curl xz-utils screen -y |
Create server directory | mkdir -p ~/fivem_server |
Navigate to server directory | cd ~/fivem_server |
Download latest FiveM Linux artifact | wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/7290-a654bcc2adfa27c4e020fc915a1a6343c3b4f921/fx.tar.xz |
Extract the archive | tar xf fx.tar.xz |
Remove archive (optional) | rm fx.tar.xz |
Clone server-data | git clone https://github.com/citizenfx/cfx-server-data.git ~/fivem_server/server-data |
Navigate to server-data | cd ~/fivem_server/server-data |
Create/edit server.cfg | nano server.cfg |
Start screen session | screen -S fivem |
Run the server | ./run.sh +exec server.cfg |
Detach from screen | Press Ctrl + A , then D |
Reattach to screen | screen -r fivem |
Allow SSH through firewall | sudo ufw allow 22/tcp |
Allow FiveM TCP and UDP traffic | sudo ufw allow 30120/tcp and sudo ufw allow 30120/udp |
Enable UFW firewall | sudo ufw enable |
Issue | Solution |
---|---|
Server won't start after run.sh | Make sure server.cfg is correctly located in server-data and contains a valid license key. |
Permission denied when launching run.sh | Set execute permissions: chmod +x run.sh |
Firewall blocking players from connecting | Verify ports 30120 TCP/UDP are open in your firewall and host panel. |
Missing libraries or runtime errors | Ensure xz-utils , libc6 , and other dependencies are installed. Run ldd ./fxserver to check. |
Screen not installed | Install with: sudo apt install screen |
Resource path errors | Double-check file paths in server.cfg and ensure no Windows-style slashes (\ ) are used. |
Server stops when terminal closes | Use screen or another process manager like tmux or systemd to keep it running in the background. |
License key not working | Check that the key is registered to your server’s external IP address in Keymaster. |
Although Windows remains the most compatible environment for FiveM servers, Linux hosting is a viable alternative for experienced users. The native FiveM Linux artifacts now make Wine unnecessary, simplifying setup and improving performance.
Keep in mind that some community resources or scripts may require slight adjustments for Linux-based file paths or permissions. With proper setup and DDoS protection, Linux can provide a secure, stable, and scalable platform for your FiveM server.