Game Server Guide

    Terraria Dedicated Server

    Host your own Terraria multiplayer world on RamNode VPS. Full control over settings, mods, and player management.

    Ubuntu 22.04 / Debian 12
    Multiplayer
    ⏱️ 20-30 minutes

    Prerequisites & VPS Selection

    Terraria is a popular 2D sandbox adventure game that supports multiplayer gameplay through dedicated servers. This guide will walk you through deploying a Terraria dedicated server with full control.

    Before starting, ensure you have:

    • Ubuntu 22.04 LTS or Debian 12
    • SSH root or sudo access to your VPS
    • Basic command-line knowledge

    Small Server

    • • 2GB RAM (min)
    • • 2 CPU cores
    • • 1-4 players

    Recommended

    • • 4GB RAM
    • • 2+ CPU cores
    • • 8+ players

    Large Server

    • • 8GB+ RAM
    • • 4+ CPU cores
    • • 16+ players
    2

    Initial Server Setup

    Connect to your VPS via SSH and update the system:

    Update System
    apt update && apt upgrade -y
    Install Dependencies
    apt install -y wget unzip screen tmux nano

    Create a Dedicated User

    Create a dedicated user for running the server (security best practice):

    Create Terraria User
    useradd -m -s /bin/bash terraria
    passwd terraria
    3

    Download and Install Terraria Server

    Switch to the terraria user and download the server files:

    Switch to Terraria User
    su - terraria
    Create Server Directory
    mkdir -p ~/terraria-server
    cd ~/terraria-server
    Download Terraria Server
    wget https://terraria.org/api/download/pc-dedicated-server/terraria-server-1449.zip
    Extract and Setup
    unzip terraria-server-1449.zip
    cd 1449/Linux/
    chmod +x TerrariaServer.bin.x86_64

    💡 Tip: Check the official Terraria website for the latest server version number and update the download URL accordingly.

    4

    Configure the Server

    Create a server configuration file:

    Create Config File
    nano serverconfig.txt
    serverconfig.txt
    # Server configuration
    world=/home/terraria/terraria-server/Worlds/MyWorld.wld
    autocreate=2
    # World size: 1=small, 2=medium, 3=large
    
    worldname=MyWorld
    difficulty=1
    # Difficulty: 0=Classic, 1=Expert, 2=Master, 3=Journey
    
    maxplayers=8
    port=7777
    password=YourSecurePassword
    
    # Server messages
    motd=Welcome to my Terraria server!
    
    # World settings
    seed=
    worldrollbackstokeep=2
    
    # Network settings
    npcstream=60
    priority=1
    
    # Security
    secure=1
    
    # Language
    language=en-US
    Create Worlds Directory
    mkdir -p /home/terraria/terraria-server/Worlds

    ⚠️ Important: Replace 'YourSecurePassword' with a strong, unique password for your server!

    5

    Configure Firewall

    Exit back to root user (Ctrl+D) and configure firewall rules:

    UFW Firewall Rules
    ufw allow 7777/tcp
    ufw allow 7777/udp
    ufw reload

    Alternative: Using iptables

    iptables Rules
    iptables -A INPUT -p tcp --dport 7777 -j ACCEPT
    iptables -A INPUT -p udp --dport 7777 -j ACCEPT
    iptables-save > /etc/iptables/rules.v4
    6

    Create Startup Script

    Switch back to terraria user and create a startup script:

    Create Startup Script
    su - terraria
    nano ~/start-terraria.sh
    start-terraria.sh
    #!/bin/bash
    cd /home/terraria/terraria-server/1449/Linux/
    ./TerrariaServer.bin.x86_64 -config /home/terraria/terraria-server/serverconfig.txt
    Make Executable
    chmod +x ~/start-terraria.sh

    Running with Screen (Simple)

    Start with Screen
    # Start a screen session
    screen -S terraria
    
    # Run the server
    ~/start-terraria.sh
    
    # Detach: Press Ctrl+A, then D
    # Reattach later:
    screen -r terraria
    7

    Systemd Service (Recommended)

    Create a systemd service for automatic startup and management:

    Create Service File (as root)
    nano /etc/systemd/system/terraria.service
    terraria.service
    [Unit]
    Description=Terraria Server
    After=network.target
    
    [Service]
    Type=simple
    User=terraria
    WorkingDirectory=/home/terraria/terraria-server/1449/Linux/
    ExecStart=/home/terraria/terraria-server/1449/Linux/TerrariaServer.bin.x86_64 -config /home/terraria/terraria-server/serverconfig.txt
    Restart=on-failure
    RestartSec=10
    
    [Install]
    WantedBy=multi-user.target
    Enable and Start Service
    systemctl daemon-reload
    systemctl enable terraria
    systemctl start terraria
    Check Status
    systemctl status terraria
    
    # View logs
    journalctl -u terraria -f
    8

    Server Management

    In-Game Admin Commands

    Connect to your server console and use these commands:

    • help - List all commands
    • playing - Show connected players
    • kick <player> - Kick a player
    • ban <player> - Ban a player
    • save - Save the world
    • exit - Shutdown gracefully

    Systemd Management

    Service Commands
    # Start server
    systemctl start terraria
    
    # Stop server
    systemctl stop terraria
    
    # Restart server
    systemctl restart terraria
    
    # View status
    systemctl status terraria
    
    # Enable auto-start on boot
    systemctl enable terraria
    
    # Disable auto-start
    systemctl disable terraria
    9

    Performance Optimization

    Adjust Server Priority

    Add to your systemd service for better performance:

    Add to [Service] section
    Nice=-10
    IOSchedulingClass=realtime
    IOSchedulingPriority=0

    Configure Swap Memory

    For servers with limited RAM:

    Create Swap
    fallocate -l 2G /swapfile
    chmod 600 /swapfile
    mkswap /swapfile
    swapon /swapfile
    echo '/swapfile none swap sw 0 0' >> /etc/fstab

    Monitor Resources

    Install and Use htop
    apt install htop
    htop
    10

    Backup Strategy

    Create an automated backup script:

    Create Backup Script
    nano /home/terraria/backup-world.sh
    backup-world.sh
    #!/bin/bash
    BACKUP_DIR="/home/terraria/backups"
    WORLD_DIR="/home/terraria/terraria-server/Worlds"
    DATE=$(date +%Y%m%d_%H%M%S)
    
    mkdir -p $BACKUP_DIR
    
    # Copy world files
    cp -r $WORLD_DIR/* $BACKUP_DIR/world_backup_$DATE/
    
    # Keep only last 7 days of backups
    find $BACKUP_DIR -type d -mtime +7 -exec rm -rf {} +
    
    echo "Backup completed: $DATE"
    Schedule Daily Backups
    chmod +x /home/terraria/backup-world.sh
    crontab -e
    
    # Add this line for daily backup at 3 AM:
    0 3 * * * /home/terraria/backup-world.sh

    Automatic Restarts

    Add to crontab
    # Daily restart at 4 AM
    0 4 * * * systemctl restart terraria
    11

    Security Hardening

    Enable Fail2Ban

    Install and Configure
    apt install fail2ban
    nano /etc/fail2ban/jail.local
    jail.local
    [sshd]
    enabled = true
    port = ssh
    filter = sshd
    logpath = /var/log/auth.log
    maxretry = 3
    bantime = 3600
    Restart Fail2Ban
    systemctl restart fail2ban

    Security Best Practices

    • Use complex server passwords
    • Change default SSH port (optional)
    • Disable root SSH login after setting up sudo user
    12

    Installing TShock (Optional)

    TShock adds advanced admin features, permissions, and plugins:

    Download TShock
    cd /home/terraria
    wget https://github.com/Pryaxis/TShock/releases/download/v5.2.0/TShock-5.2-for-Terraria-1.4.4.9.zip
    unzip TShock-5.2-for-Terraria-1.4.4.9.zip -d tshock
    cd tshock
    chmod +x TShock.Server

    💡 Note: Update your startup script to use TShock.Server instead of the vanilla server executable.

    Connecting to Your Server

    1. Launch Terraria
    2. Select "Multiplayer"
    3. Choose "Join via IP"
    4. Enter: your-vps-ip:7777
    5. Enter the server password

    Troubleshooting