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.
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:
- Performance VPS - Dedicated resources and fast processors, ideal for RedM
- NVMe VPS - For a small server or a test server
- Eco Dedicated Servers - For roleplay servers with many players
- Performance Dedicated Servers - Maximum performance
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
sudo apt update && sudo apt upgrade -yInstalling Dependencies
sudo apt install -y ca-certificates curl tar xz-utils jq cronCreating a Dedicated User
The server must never run as root. Create a dedicated user:
sudo adduser --disabled-password --gecos "" redmCreating the Cfx.re Server Key
Every server needs a free registration key:
- Log in to the Cfx.re portal.
- Create a new registration key for your server.
- 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
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
sudo ufw allow from YOUR_IP to any port 40120 proto tcp
sudo ufw reloadWith iptables
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.v4Saving 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.
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.confInstalling FXServer
Log in as the redm user, create the directories, then download the recommended server version:
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
exitThis 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
sudo nano /etc/systemd/system/redm.serviceFile content:
[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
sudo systemctl daemon-reload
sudo systemctl enable redm.service
sudo systemctl start redm.serviceManagement Commands
# 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 -fMariaDB 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:
sudo apt install -y mariadb-server
sudo systemctl enable --now mariadbOpen the MariaDB console:
sudo mariadbCreate the database and an account dedicated to RedM, with a long and unique password:
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:
sudo -u redm nano /home/redm/.my.cnf[client]
host=127.0.0.1
user=redm
password=ChangeThisPasswordsudo chmod 600 /home/redm/.my.cnfBy 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:
sudo journalctl -u redm.service -n 100 --no-pagerLook for the All ready! Please access: box, followed by Use the PIN below to register:.
Creating the Administrator Account
- Open
http://SERVER_IP:40120in your browser. - Enter the PIN code, then click Link Account.
- Log in with your Cfx.re account and approve the request.
- Choose a fallback password for txAdmin.
Deploying the Server
- At the Server Name step, give your server a short name.
- 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 |
- Keep the suggested deployment folder, then click Go to Recipe Deployer.
- Review the recipe, click Next, then paste your
cfxk_key into Server Registration Key. - 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 |
- For VORP Core, also enter the Steam API key requested by the recipe.
- Click Run Recipe, wait for the deployment to finish, then click Next.
- 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:
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
- Install the RedM client and launch it.
- Open the console with the
F8key. - Type:
connect SERVER_IP:30120Your 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.
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.serviceYour data stays in /home/redm/txData. If something goes wrong, stop the service and put the old version back:
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.serviceAutomatic Backup
Backup Script
sudo nano /home/redm/backup.sh#!/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"sudo chown redm:redm /home/redm/backup.sh
sudo chmod 700 /home/redm/backup.shSchedule Backup
sudo crontab -u redm -eAdd:
# Backup every 6 hours
0 */6 * * * /home/redm/backup.shRestoring the Database
Stop the server before restoring, and replace the file name with that of your backup:
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.serviceRegularly 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 -handfree -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:
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-pagerCould not bind on 0.0.0.0:30120
The port is already in use, often by another server that is still running:
sudo ss -ltnup | grep 30120Stop 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 rdr3is present inserver.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 withsudo systemctl status mariadbAccess denied: the user or password is incorrect. Test them:
sudo -iu redm mariadb -e "SELECT CURRENT_USER();"The mysql_connection_string line in server.cfg must use these same credentials.