EN

Game servers

How to Create a RedM Server

Complete guide to install a RedM server with txAdmin on a VPS or dedicated Linux server: Cfx.re key, systemd service, firewall, MariaDB database, updates, backup and troubleshooting.

9 min read, updated on 18 November 2026

On this page

Your values

Enter them once and the commands in this guide update.

This guide explains how to install a RedM server (Cfx.re's multiplayer platform for Red Dead Redemption 2) on your VPS or dedicated Linux server, with the txAdmin administration interface, a dedicated user and a systemd service.

Order a Server

To host your RedM server, HostMyServers offers several options:

Prerequisites

  • SSH access as root or user with sudo privileges
  • 64-bit x86-64 Linux system: Debian 12/13 or Ubuntu 22.04/24.04
  • Active firewall: nftables (recommended), iptables or ufw (use only one firewall tool at a time)
  • A Cfx.re account, to create the server key and access txAdmin
  • Ports 30120 TCP and UDP accessible, and port 40120 TCP (txAdmin) accessible from your fixed IP address only
  • On the player side: Red Dead Redemption 2 on PC and the RedM client

Required Configuration

Cfx.re does not publish a minimum configuration. The values below are rough estimates: consumption mainly depends on the installed resources and the number of players.

Component Basic server Roleplay server (framework and database)
RAM 4 GB 8 GB and more
CPU 2 x86-64 cores 4 cores or more, high frequency
Storage 20 GB SSD 40 GB NVMe SSD

System Update

Terminal
sudo apt update && sudo apt upgrade -y

Installing Dependencies

Terminal
sudo apt install -y ca-certificates curl tar xz-utils jq cron

Creating a Dedicated User

The server must never run as root. Create a dedicated user:

Terminal
sudo adduser --disabled-password --gecos "" redm

Creating the Cfx.re Server Key

Every server needs a free registration key:

  1. Log in to the Cfx.re portal.
  2. Create a new registration key for your server.
  3. Copy the key you get. It starts with cfxk_.

The name, description and tags displayed in the server list are now set on the Cfx.re portal, no longer in server.cfg.

Ports Used

Port Protocol Usage Exposure
30120 TCP and UDP Player connection Public
40120 TCP txAdmin web interface Your IP address only
3306 TCP MariaDB, if you install it Never: local access only

Firewall Configuration

Open the game port and restrict txAdmin to your fixed IP address: replace YOUR_IP.

With UFW

Terminal
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
sudo ufw allow from YOUR_IP to any port 40120 proto tcp
sudo ufw reload

With iptables

Terminal
sudo iptables -A INPUT -p tcp --dport 30120 -j ACCEPT
sudo iptables -A INPUT -p udp --dport 30120 -j ACCEPT
sudo iptables -A INPUT -p tcp -s YOUR_IP --dport 40120 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 40120 -j DROP
sudo iptables-save | sudo tee /etc/iptables/rules.v4

Saving the rules across reboots requires the iptables-persistent package.

With nftables

These commands use the inet filter table and the input chain, present by default in /etc/nftables.conf on Debian.

Terminal
sudo nft add rule inet filter input tcp dport 30120 accept
sudo nft add rule inet filter input udp dport 30120 accept
sudo nft add rule inet filter input ip saddr YOUR_IP tcp dport 40120 accept
sudo nft add rule inet filter input tcp dport 40120 drop
(echo "flush ruleset"; sudo nft list ruleset) | sudo tee /etc/nftables.conf

Installing FXServer

Log in as the redm user, create the directories, then download the recommended server version:

Terminal
sudo -iu redm
mkdir -p ~/server ~/txData ~/backups
chmod 700 ~/txData ~/backups
cd ~/server
URL=$(curl -fsSL https://changelogs-live.fivem.net/api/changelog/versions/linux/server | jq -r .recommended_download)
echo "$URL"
curl -fL -o fx.tar.xz "$URL"
tar -xJf fx.tar.xz
rm fx.tar.xz
ls -l run.sh
exit

This address returns the version listed as recommended on the official download page. FiveM and RedM use the same server: it is the configuration that selects RedM.

Configuration as systemd Service

Create Service File

Terminal
sudo nano /etc/systemd/system/redm.service

File content:

Configuration
[Unit]
Description=RedM Server (txAdmin)
Wants=network-online.target
After=network-online.target mariadb.service

[Service]
Type=simple
User=redm
Group=redm
WorkingDirectory=/home/redm/server
Environment=TXHOST_DATA_PATH=/home/redm/txData
Environment=TXHOST_GAME_NAME=redm
Environment=TXHOST_TXA_PORT=40120
ExecStart=/home/redm/server/run.sh
Restart=on-failure
RestartSec=20
TimeoutStopSec=60
LimitNOFILE=100000

[Install]
WantedBy=multi-user.target
Variable Purpose
TXHOST_DATA_PATH txAdmin data folder, kept separate from the server files to simplify updates
TXHOST_GAME_NAME Restricts txAdmin to RedM: only RedM recipes are offered
TXHOST_TXA_PORT Web interface port

Enable and Start Service

Terminal
sudo systemctl daemon-reload
sudo systemctl enable redm.service
sudo systemctl start redm.service

Management Commands

Terminal
# Check status
sudo systemctl status redm.service

# Stop txAdmin and the server
sudo systemctl stop redm.service

# Restart txAdmin and the server
sudo systemctl restart redm.service

# View logs
sudo journalctl -u redm.service -f

MariaDB Database (if needed)

The RedM Basic Server recipe does not use a database: skip straight to the next section if you choose it. A database is required, however, for a roleplay framework such as VORP Core.

Install MariaDB:

Terminal
sudo apt install -y mariadb-server
sudo systemctl enable --now mariadb

Open the MariaDB console:

Terminal
sudo mariadb

Create the database and an account dedicated to RedM, with a long and unique password:

SQL
CREATE DATABASE redm CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'redm'@'127.0.0.1' IDENTIFIED BY 'ChangeThisPassword';
GRANT ALL PRIVILEGES ON redm.* TO 'redm'@'127.0.0.1';
FLUSH PRIVILEGES;
EXIT;

Save these credentials for the automatic backup, in a file readable only by redm:

Terminal
sudo -u redm nano /home/redm/.my.cnf
Configuration
[client]
host=127.0.0.1
user=redm
password=ChangeThisPassword
Terminal
sudo chmod 600 /home/redm/.my.cnf

By default, MariaDB only listens on 127.0.0.1: do not open port 3306 in the firewall.

Configuration with txAdmin

Getting the PIN Code

On first startup, txAdmin displays its address and a PIN code. Wait a minute if the message does not appear yet:

Terminal
sudo journalctl -u redm.service -n 100 --no-pager

Look for the All ready! Please access: box, followed by Use the PIN below to register:.

Creating the Administrator Account

  1. Open http://SERVER_IP:40120 in your browser.
  2. Enter the PIN code, then click Link Account.
  3. Log in with your Cfx.re account and approve the request.
  4. Choose a fallback password for txAdmin.

Deploying the Server

  1. At the Server Name step, give your server a short name.
  2. Choose Popular Recipes, then a recipe:
Recipe Content Database
RedM Basic Server (CFX Default) Minimal server, no framework No
VORP Core Full roleplay framework Yes, and a Steam API key
  1. Keep the suggested deployment folder, then click Go to Recipe Deployer.
  2. Review the recipe, click Next, then paste your cfxk_ key into Server Registration Key.
  3. For VORP Core, open Show/Hide Database options and fill in:
Field Value
Database Host 127.0.0.1
Database Port 3306
Database Username redm
Database Password Your MariaDB password
Database Name redm
Delete Database Disabled
  1. For VORP Core, also enter the Steam API key requested by the recipe.
  2. Click Run Recipe, wait for the deployment to finish, then click Next.
  3. Review server.cfg, then click Save & Run Server.

Checking the server.cfg File

The file is located at /home/redm/txData/<name>_<date>.base/server.cfg. You can also edit it in txAdmin, with CFG Editor. These lines must be present for RedM:

Text
set gamename rdr3
sv_enforceGameBuild 1491
Parameter Description
set gamename rdr3 Starts the server in RedM mode
sv_enforceGameBuild 1491 Game version enforced on players. It is the only version listed for RedM
sv_licenseKey Server key, filled in by txAdmin
sv_maxclients Maximum number of players
endpoint_add_tcp, endpoint_add_udp Game listening address and port

This file contains secrets (the server key, the database password): do not share it.

Connecting to the Server

  1. Install the RedM client and launch it.
  2. Open the console with the F8 key.
  3. Type:
Text
connect SERVER_IP:30120

Your server may also appear in RedM's server list.

Administration

Most tasks are done in txAdmin, at http://SERVER_IP:40120:

Menu Usage
Live Console Live server console
Resources Start, stop or restart resources
Server Log Event log
CFG Editor Edit server.cfg
Players Players, warnings and bans
Admins Administrator accounts and permissions
Settings txAdmin settings, including scheduled restarts

FXServer's RCON stays disabled as long as rcon_password is not set. Leave it that way: txAdmin is a better replacement.

Server Update

Cfx.re stops supporting old versions. An unsupported version that is more than three months old can no longer be joined from the server list: update yours regularly.

Terminal
sudo systemctl stop redm.service
sudo -iu redm
URL=$(curl -fsSL https://changelogs-live.fivem.net/api/changelog/versions/linux/server | jq -r .recommended_download)
curl -fL -o ~/fx.tar.xz "$URL"
rm -rf ~/server.old
mv ~/server ~/server.old
mkdir ~/server
tar -xJf ~/fx.tar.xz -C ~/server
rm ~/fx.tar.xz
exit
sudo systemctl start redm.service

Your data stays in /home/redm/txData. If something goes wrong, stop the service and put the old version back:

Terminal
sudo systemctl stop redm.service
sudo -u redm bash -c 'rm -rf /home/redm/server && mv /home/redm/server.old /home/redm/server'
sudo systemctl start redm.service

Automatic Backup

Backup Script

Terminal
sudo nano /home/redm/backup.sh
Terminal
#!/bin/bash
BACKUP_DIR="/home/redm/backups"
DATE=$(date +%Y-%m-%d_%H-%M-%S)

mkdir -p "$BACKUP_DIR"
chmod 700 "$BACKUP_DIR"

# txAdmin and server data, without the cache
tar -czf "$BACKUP_DIR/txdata_$DATE.tar.gz" --exclude='txData/*.base/cache' -C /home/redm txData

# Database, if MariaDB is configured
if [ -f /home/redm/.my.cnf ]; then
    mariadb-dump --single-transaction redm | gzip > "$BACKUP_DIR/redm_$DATE.sql.gz"
fi

# Delete backups older than 7 days
find "$BACKUP_DIR" \( -name "txdata_*.tar.gz" -o -name "redm_*.sql.gz" \) -mtime +7 -delete

echo "Backup completed: $DATE"
Terminal
sudo chown redm:redm /home/redm/backup.sh
sudo chmod 700 /home/redm/backup.sh

Schedule Backup

Terminal
sudo crontab -u redm -e

Add:

Text
# Backup every 6 hours
0 */6 * * * /home/redm/backup.sh

Restoring the Database

Stop the server before restoring, and replace the file name with that of your backup:

Terminal
sudo systemctl stop redm.service
sudo -iu redm bash -c 'gunzip -c ~/backups/redm_2026-01-01_00-00-00.sql.gz | mariadb redm'
sudo systemctl start redm.service

Regularly copy these archives off the server. They contain your key and your passwords: keep them in a safe place.

Troubleshooting

The service won't start

  • Check the logs: sudo journalctl -u redm.service -n 100 --no-pager
  • Check that the script is present: ls -l /home/redm/server/run.sh
  • Check the disk space and memory: df -h and free -h

tar fails on the fx.tar.xz file

The xz-utils package is missing or the download is incomplete. Install it, delete the file, then download it again.

Unable to open txAdmin

  • Check that the service is listening: sudo ss -ltnp | grep 40120
  • Your IP address may have changed: update the firewall rule, or use the SSH tunnel
  • Check that no network firewall is blocking the port upstream

Lost PIN code or forgotten txAdmin password

The PIN code only appears as long as no administrator exists. To start over on the accounts side, without touching the server:

Terminal
sudo systemctl stop redm.service
sudo -u redm mv /home/redm/txData/admins.json /home/redm/txData/admins.json.old
sudo systemctl start redm.service
sudo journalctl -u redm.service -n 100 --no-pager

Could not bind on 0.0.0.0:30120

The port is already in use, often by another server that is still running:

Terminal
sudo ss -ltnup | grep 30120

Stop the process concerned, or change the port in server.cfg and in the firewall.

Server Key Error

Check in server.cfg that sv_licenseKey contains your full cfxk_ key, with no spaces, and that it still exists on the Cfx.re portal.

Players can't connect

  • Port 30120 must be open on both TCP and UDP
  • Check that the server is listening: sudo ss -ltnup | grep 30120
  • Test the direct connection with connect SERVER_IP:30120: if it fails, the problem is usually the firewall
  • Check that set gamename rdr3 is present in server.cfg

EOS or EOL Warning on Connection

The server version is no longer supported. A grey warning (EOS) still lets players join the server, but a red warning (EOL) does not. Follow the “Server Update” section. If the warning persists with the recommended version, replace .recommended_download with .latest_download in the command.

Database Connection Error

  • ECONNREFUSED: MariaDB is stopped. Check with sudo systemctl status mariadb
  • Access denied: the user or password is incorrect. Test them:
Terminal
sudo -iu redm mariadb -e "SELECT CURRENT_USER();"

The mysql_connection_string line in server.cfg must use these same credentials.