🎮 Install a FiveM Server on Linux VPS#
Create your own FiveM server for GTA V on a Debian or Ubuntu VPS. This guide covers the complete installation with txAdmin to easily manage your roleplay server.
🎯 Objective#
- Prepare the VPS for FiveM
- Install FiveM artifacts (fx server)
- Configure txAdmin for server management
- Launch and maintain the server
🧰 Prerequisites#
- A VPS running Debian 11/12 or Ubuntu 20.04/22.04/24.04
- Minimum 2 vCPU, 4 GB RAM, 30 GB SSD
- Root or sudo access
- A CFX license key (free at Cfx.re Keymaster)
- SSH connection
1️⃣ Update the system#
sudo apt update && sudo apt upgrade -y sudo apt autoremove --purge -y
2️⃣ Install dependencies#
🔹 Required packages#
sudo apt install -y wget curl tar xz-utils screen git nano
🔹 Create a dedicated user#
⚠️ Important: Never run FiveM as root for security reasons.
sudo adduser fivem sudo usermod -aG sudo fivem
Switch to this user:
su - fivem
3️⃣ Download FiveM artifacts#
🔹 Create the installation directory#
mkdir -p ~/fxserver/server cd ~/fxserver/server
🔹 Download the latest version#
Get the latest artifacts link from runtime.fivem.net then:
wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/XXXX-XXXXXXXXX/fx.tar.xz
💡 Tip: Replace
XXXX-XXXXXXXXXwith the most recent build number (recommended: latest stable version).
🔹 Extract the files#
tar -xvf fx.tar.xz rm fx.tar.xz
4️⃣ Obtain a CFX license key#
- Go to Cfx.re Keymaster
- Log in with your Cfx.re account (or create one)
- Click on "Register a new server"
- Fill in the information:
- Label: Your server name
- Server IP Address: Your VPS IP
- Server Type: VPS / Dedicated Server
- Click on "Generate"
- Copy the generated key (format:
cfxk_xxxxxxxxxxxxxxxxxxxx_xxxxx)
⚠️ Important: Keep this key secret. Never share it publicly.
5️⃣ First launch and txAdmin configuration#
🔹 Launch the server for the first time#
⚠️ Important: On first launch, do not use
+exec server.cfgbecause the file doesn't exist yet. txAdmin will guide us to create it.
cd ~/fxserver/server screen -S fivem
Once in the screen, launch the server:
./run.sh
You should see something like:
████████████████████████████████ █████████████████████████████████████ txAdmin v7.x.x starting... Use the PIN below to register: ======================== 1234 ======================== Admin URL: http://0.0.0.0:40120/
💡 Note: Write down the 4-digit PIN displayed, you'll need it to configure txAdmin.
🔹 Detach from screen#
Press Ctrl + A then D to detach from screen (the server continues running in the background).
🔹 Access txAdmin#
- Open your browser and go to:
http://YOUR_VPS_IP:40120
-
Enter the PIN displayed in the terminal
-
Create your administrator account for txAdmin (username + password)
-
Follow the configuration wizard:
Step 1 - Backup: Skip or configure as needed
Step 2 - Server Name: Give your server a name
Step 3 - Deploy Type: Choose "Popular Recipes" then select a template:
- CFX Default: Basic vanilla server
- QBCore: Popular RP framework
- ESX Legacy: Another popular RP framework
Step 4 - Data Location: Set the path:
/home/fivem/fxserver/server-dataStep 5 - License Key: Paste your CFX license key (obtained in step 4 of this guide)
Step 6 - Review & Save: Review and confirm
-
txAdmin will download resources and create
server.cfgautomatically -
Once complete, click "Start Server" in txAdmin
🔹 Useful screen commands#
| Command | Description |
|---|---|
screen -S fivem | Create a new screen named "fivem" |
Ctrl + A then D | Detach screen (server continues) |
screen -r fivem | Resume the screen |
screen -ls | List active screens |
exit or Ctrl + D | Close screen (⚠️ stops the server) |
🔹 If you have issues with screen#
If screen closes immediately, run directly without screen to see errors:
./run.sh
Read the error messages displayed, then fix the issue before relaunching with screen.
6️⃣ server.cfg configuration#
The server.cfg file is located in your server-data folder. Here are the essential settings:
nano ~/fxserver/server-data/server.cfg
🔹 Basic settings#
# Server name and description sv_hostname "My FiveM Server - LibraHost" sv_projectDesc "GTA V Roleplay Server" sv_projectName "MyServer" # License key (generated on Keymaster) sv_licenseKey "cfxk_xxxxxxxxxxxxxxxxxxxx_xxxxx" # Maximum number of players sv_maxclients 32 # Enable OneSync (recommended) set onesync on # Server endpoint endpoint_add_tcp "0.0.0.0:30120" endpoint_add_udp "0.0.0.0:30120" # RCON (optional - for remote administration) rcon_password "VerySecurePassword123!" # Tags for server list (optional) sets tags "roleplay, english, custom" # Language sets locale "en-US"
🔹 Essential resources#
# Base resources ensure mapmanager ensure chat ensure spawnmanager ensure sessionmanager ensure basic-gamemode ensure hardcap
7️⃣ Automatic startup on boot (optional)#
💡 Note: This method replaces using screen. Choose either screen (step 5), or systemd (this step), but not both at the same time.
🔹 Create a systemd service#
sudo nano /etc/systemd/system/fivem.service
Paste the following content:
[Unit] Description=FiveM Server After=network.target [Service] Type=simple User=fivem WorkingDirectory=/home/fivem/fxserver/server ExecStart=/home/fivem/fxserver/server/run.sh Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target
🔹 Enable the service#
sudo systemctl daemon-reload sudo systemctl enable fivem sudo systemctl start fivem
🔹 Management commands#
| Command | Description |
|---|---|
sudo systemctl start fivem | Start the server |
sudo systemctl stop fivem | Stop the server |
sudo systemctl restart fivem | Restart the server |
sudo systemctl status fivem | View status |
journalctl -u fivem -f | View logs in real-time |
8️⃣ Adding resources#
🔹 Folder structure#
~/fxserver/ ├── server/ # FiveM artifacts └── server-data/ # Server data ├── resources/ # Your scripts and mods ├── server.cfg # Configuration └── cache/ # Server cache
🔹 Install a resource#
- Download the resource (GitHub, CFX forums, etc.)
- Place it in the
resourcesfolder:
cd ~/fxserver/server-data/resources git clone https://github.com/example/my-resource.git
- Add it to
server.cfg:
ensure my-resource
- Restart the server or use txAdmin
9️⃣ FAQ & Common Issues#
-
Can't access txAdmin? Make sure you're using
http://IP:40120(not https). Ensure the server is running. -
Players can't connect? Make sure the license key is valid and associated with the correct IP on Cfx.re Keymaster.
-
"Could not find server.cfg" error? This is normal on first launch. Follow the txAdmin wizard which will create the file automatically.
-
Screen closes immediately? Run
./run.shwithout screen to see errors. Make sure you're in the/home/fivem/fxserver/serverdirectory. -
Server crashes on startup? Check logs with
journalctl -u fivem -f(if using systemd) or in screen. Often caused by a misconfigured resource. -
Server not visible in the list? Add
sv_master1 ""in server.cfg if you want to stay hidden, or check yoursetsparameters. -
Slow performance / lag? Enable OneSync with
set onesync on. Make sure your VPS has enough RAM (minimum 4 GB recommended). -
How to update artifacts? Stop the server, download new artifacts to
~/fxserver/server, extract them, then restart. -
Screen or systemd? Use screen for testing and development (more flexible). Use systemd for production (automatic restart).
✅ Conclusion#
Your FiveM server is now installed and running on your LibraHost VPS. Use txAdmin to easily manage players, resources and settings. Don't forget to regularly backup your server-data folder.