Skip to content
CyberNex
CyberNex
services
Back to Knowledge Base
FiveM9 min

FiveM on VPS — Complete Setup Guide

Set up FiveM on a Linux VPS from scratch. Installation, configuration, database setup, resource management, and production deployment.

VPS Prerequisites

Minimum: 2GB RAM (4GB for production), Ubuntu 22.04/24.04 LTS, 2+ vCPU cores, NVMe SSD. Install dependencies: sudo apt update && sudo apt install -y screen git wget curl unzip xz-utils. Create a dedicated user for FiveM: sudo adduser fivem, sudo usermod -aG sudo fivem. Never run FiveM as root.

Installing FiveM Server

Create server directory: mkdir ~/fxserver && cd ~/fxserver. Download latest artifacts from the Cfx.re build server. Extract with tar xf fx.tar.xz. Create server.cfg in the same directory. Configure: sv_licenseKey 'your-key', sv_hostname 'Your Server', endpoints_add_tcp '127.0.0.1:30120', endpoints_add_udp '127.0.0.1:30120'.

Database Setup

Install MariaDB: sudo apt install -y mariadb-server. Secure: sudo mysql_secure_installation. Create database: CREATE DATABASE fivem; CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'password'; GRANT ALL ON fivem.* TO 'fivem'@'localhost';. In server.cfg: set mysql_connection_string. For OX MySQL: set oxmysql_connection_string with the same credentials.

Running as a Service

Create systemd service: sudo nano /etc/systemd/system/fivem.service. Configure ExecStart to run the fxserver binary with correct flags. Enable: sudo systemctl enable fivem. Start: sudo systemctl start fivem. Monitor logs: sudo journalctl -u fivem -f. The service auto-restarts on crash and starts on boot.

Firewall Configuration

Allow FiveM ports: sudo ufw allow 30120/tcp, sudo ufw allow 30120/udp, sudo ufw allow 40120/tcp (txAdmin). Enable firewall: sudo ufw enable. Verify: sudo ufw status. Test external connectivity by connecting from your FiveM client to the VPS IP.

Resource Installation

Upload resources to ~/fxserver/resources/. In server.cfg: add 'ensure <resource-name>' for each resource (or use 'ensure *' to load all in resources folder). Start resources one at a time and test. txAdmin (embedded) is available at http://yourserver:40120 for web-based management.

Frequently Asked Questions

Managed hosting vs VPS for FiveM?

Managed hosting: 60-second deployment, zero setup, support included. VPS: full control, can run multiple instances, requires Linux knowledge. Most server owners start with managed and move to VPS when running 3+ FiveM instances or custom infrastructure.

How do I update FiveM on VPS?

Stop the server, download the latest artifacts, replace the old files (keep server.cfg and resources), restart. Schedule updates during off-peak hours. Test on a staging server before updating production.

Still have questions?

Our support team is available 24/7 on Discord. Join our community for real-time help from engineers who run game servers.

FiveM on VPS — Complete Setup Guide | CyberNex Knowledge Base