Database Guide

    Self-Hosted Firebird

    Deploy Firebird, a powerful open-source RDBMS with InterBase heritage, on RamNode VPS. Full ACID compliance, multi-generational architecture, and zero-administration design.

    Ubuntu/Debian/RHEL
    Firebird 4.0
    ⏱️ 15-20 minutes

    Key Features of Firebird

    Full ACID compliance with multi-generational architecture
    Lightweight footprint with minimal resource requirements
    Cross-platform: Linux, Windows, macOS, Unix variants
    Zero-administration design for embedded deployments
    Stored procedures, triggers, and UDFs
    Three editions: Embedded, Classic, SuperServer

    Prerequisites & VPS Selection

    Development

    • • 1GB RAM
    • • 1 vCPU
    • • 10GB SSD

    Small Production

    • • 2GB RAM
    • • 2 vCPU
    • • 25GB SSD

    Medium Production

    • • 4GB+ RAM
    • • 4 vCPU
    • • 50GB+ SSD

    What You'll Need

    • Ubuntu 22.04/24.04, Debian 11/12, or AlmaLinux/Rocky Linux 8/9
    • Root or sudo access
    • SSH client for remote access
    • Basic Linux command line familiarity
    2

    Install Firebird (Ubuntu/Debian)

    Install Firebird from the official repositories:

    Step 1: Update System Packages
    sudo apt update && sudo apt upgrade -y
    Step 2: Install Firebird 4.0 (Recommended)
    sudo apt install firebird4.0-server firebird4.0-utils -y
    Install Firebird 3.0 (Legacy Support)
    sudo apt install firebird3.0-server firebird3.0-utils -y

    ⚠️ SYSDBA Password: During installation, you'll be prompted to set the SYSDBA password. This is the superuser account - choose a strong, unique password and store it securely.

    Change SYSDBA Password Later
    sudo dpkg-reconfigure firebird4.0-server
    Verify Installation
    # Check service status
    sudo systemctl status firebird4.0
    
    # Check Firebird version
    isql-fb -z
    3

    Install Firebird (AlmaLinux/Rocky Linux)

    Download and install Firebird from official release packages:

    Step 1: Install Dependencies
    sudo dnf install wget tar libicu libncurses libtommath -y
    Step 2: Download Firebird
    cd /tmp
    wget https://github.com/FirebirdSQL/firebird/releases/download/v4.0.4/Firebird-4.0.4.3010-0.amd64.tar.gz
    tar -xzf Firebird-4.0.4.3010-0.amd64.tar.gz
    cd Firebird-4.0.4.3010-0.amd64
    Step 3: Run Installation Script
    sudo ./install.sh

    Follow the prompts to complete installation and set the SYSDBA password.

    Step 4: Enable and Start Service
    sudo systemctl enable firebird-superserver
    sudo systemctl start firebird-superserver
    Verify Installation
    # Check service status
    sudo systemctl status firebird-superserver
    
    # Check Firebird version
    isql-fb -z
    4

    Configuration

    Configure Firebird for your environment:

    Configuration File Locations

    • Debian/Ubuntu: /etc/firebird/4.0/firebird.conf
    • RHEL/Manual: /opt/firebird/firebird.conf
    • Database aliases: databases.conf
    Edit Configuration
    sudo nano /etc/firebird/4.0/firebird.conf
    Network Settings
    # Bind to specific IP (use 0.0.0.0 for all interfaces)
    RemoteBindAddress = 127.0.0.1
    
    # Default port (change if needed)
    RemoteServicePort = 3050
    
    # Enable wire compression for remote connections
    WireCompression = true
    Performance Settings
    # Database cache pages (increase for larger datasets)
    DefaultDbCachePages = 2048
    
    # Temporary file directory
    TempDirectories = /tmp
    
    # Sort memory limit
    TempCacheLimit = 67108864
    Security Settings
    # Authentication method (Srp256 is most secure)
    AuthServer = Srp256
    
    # User manager plugin
    UserManager = Srp
    
    # Wire encryption (Required, Enabled, or Disabled)
    WireCrypt = Required
    Restart After Changes
    sudo systemctl restart firebird4.0

    Configure Database Aliases

    Database aliases hide actual file paths for security:

    Edit databases.conf
    sudo nano /etc/firebird/4.0/databases.conf
    Database Alias Examples
    # Format: alias = /path/to/database.fdb
    production = /var/lib/firebird/4.0/data/production.fdb
    staging = /var/lib/firebird/4.0/data/staging.fdb
    
    # With additional options
    myapp {
      filename = /var/lib/firebird/4.0/data/myapp.fdb
      DefaultDbCachePages = 4096
    }
    5

    Security Hardening

    Secure your Firebird installation:

    Firewall Configuration (UFW)

    UFW Rules (Ubuntu/Debian)
    # Allow from specific IP
    sudo ufw allow from 10.0.0.100 to any port 3050
    
    # Allow from subnet
    sudo ufw allow from 10.0.0.0/24 to any port 3050
    
    # Enable firewall
    sudo ufw enable
    Firewalld Rules (RHEL-based)
    # Create rich rule for specific IP
    sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.100" port port="3050" protocol="tcp" accept'
    
    # Reload firewall
    sudo firewall-cmd --reload

    ⚠️ Warning: Never expose Firebird directly to the internet. Use VPN, SSH tunneling, or restrict access to specific IP addresses.

    Create Database Users

    Avoid using SYSDBA for application connections:

    Create Users and Grant Permissions
    # Connect to security database
    isql-fb -user SYSDBA -password your_password
    
    # Create new user
    CREATE USER app_user PASSWORD 'strong_password';
    
    # Grant permissions on specific database (connect to database first)
    GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE customers TO app_user;
    GRANT EXECUTE ON PROCEDURE process_order TO app_user;
    
    COMMIT;

    Wire Encryption: Set WireCrypt = Required in firebird.conf to enforce encrypted connections.

    6

    Database Operations

    Create and manage Firebird databases:

    Create a New Database
    isql-fb -user SYSDBA -password your_password
    
    CREATE DATABASE '/var/lib/firebird/4.0/data/myapp.fdb'
    PAGE_SIZE 16384
    DEFAULT CHARACTER SET UTF8;
    Set Database Permissions
    sudo chown firebird:firebird /var/lib/firebird/4.0/data/myapp.fdb
    sudo chmod 660 /var/lib/firebird/4.0/data/myapp.fdb
    Connect to Database
    # Using file path
    isql-fb -user SYSDBA -password your_password /var/lib/firebird/4.0/data/myapp.fdb
    
    # Using database alias
    isql-fb -user SYSDBA -password your_password localhost:myapp
    
    # Remote connection
    isql-fb -user SYSDBA -password your_password server.example.com:myapp
    Basic SQL Operations
    -- Create a table
    CREATE TABLE customers (
      id INTEGER NOT NULL PRIMARY KEY,
      name VARCHAR(100) NOT NULL,
      email VARCHAR(255),
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
    );
    
    -- Create generator (sequence)
    CREATE GENERATOR gen_customer_id;
    
    -- Create trigger for auto-increment
    SET TERM ^ ;
    CREATE TRIGGER tr_customer_bi FOR customers
    ACTIVE BEFORE INSERT POSITION 0
    AS
    BEGIN
      IF (NEW.id IS NULL) THEN
        NEW.id = GEN_ID(gen_customer_id, 1);
    END^
    SET TERM ; ^
    
    -- Insert data
    INSERT INTO customers (name, email) VALUES ('John Doe', 'john@example.com');
    
    -- Query data
    SELECT * FROM customers;
    
    COMMIT;
    7

    Backup & Recovery

    Use gbak for consistent backups:

    Create Backups
    # Full backup
    gbak -b -v -user SYSDBA -password your_password \
      /var/lib/firebird/4.0/data/myapp.fdb \
      /backup/myapp_$(date +%Y%m%d).fbk
    
    # Backup with compression
    gbak -b -v -user SYSDBA -password your_password \
      /var/lib/firebird/4.0/data/myapp.fdb stdout | \
      gzip > /backup/myapp_$(date +%Y%m%d).fbk.gz

    💡 Tip: Always test backup restoration regularly. A backup is only as good as its ability to be restored.

    Restore from Backup
    # Restore to new database
    gbak -c -v -user SYSDBA -password your_password \
      /backup/myapp_20240115.fbk \
      /var/lib/firebird/4.0/data/myapp_restored.fdb
    
    # Restore with page size change
    gbak -c -v -page_size 16384 -user SYSDBA -password your_password \
      /backup/myapp_20240115.fbk \
      /var/lib/firebird/4.0/data/myapp_restored.fdb
    Automated Backup Script
    #!/bin/bash
    # /usr/local/bin/firebird-backup.sh
    
    BACKUP_DIR="/backup/firebird"
    DB_PATH="/var/lib/firebird/4.0/data"
    DATABASES=("production" "staging")
    RETENTION_DAYS=30
    DATE=$(date +%Y%m%d_%H%M%S)
    
    mkdir -p $BACKUP_DIR
    
    for DB in "${DATABASES[@]}"; do
      gbak -b -g -user SYSDBA -password "$FB_PASSWORD" \
        ${DB_PATH}/${DB}.fdb \
        ${BACKUP_DIR}/${DB}_${DATE}.fbk
    
      gzip ${BACKUP_DIR}/${DB}_${DATE}.fbk
    done
    
    # Remove old backups
    find $BACKUP_DIR -name "*.fbk.gz" -mtime +$RETENTION_DAYS -delete
    Schedule with Cron
    # Make executable
    chmod +x /usr/local/bin/firebird-backup.sh
    
    # Add to crontab (daily at 2 AM)
    0 2 * * * FB_PASSWORD='your_password' /usr/local/bin/firebird-backup.sh
    8

    Performance Tuning

    Optimize Firebird for your workload:

    Database Cache Configuration

    Global Cache Setting (firebird.conf)
    DefaultDbCachePages = 4096
    Per-Database Setting (databases.conf)
    production {
      filename = /var/lib/firebird/4.0/data/production.fdb
      DefaultDbCachePages = 8192
    }

    Cache Sizing Guidelines

    • Small databases (<100MB): 2048-4096 pages
    • Medium databases (100MB-1GB): 4096-16384 pages
    • Large databases (>1GB): 16384+ pages (up to 25% of RAM)

    Database Maintenance

    Maintenance Commands
    # Sweep database (remove old record versions)
    gfix -sweep -user SYSDBA -password your_password database.fdb
    
    # Check and repair database
    gfix -validate -full -user SYSDBA -password your_password database.fdb
    
    # Get database statistics
    gstat -h database.fdb  # Header info
    gstat -r database.fdb  # Record statistics
    
    # Backup-restore cycle (most thorough maintenance)
    gbak -b database.fdb backup.fbk
    gbak -c backup.fbk database_new.fdb

    Query Optimization

    Index and Query Analysis
    -- Create index
    CREATE INDEX idx_customer_email ON customers (email);
    
    -- Analyze query plan
    SET PLAN ON;
    SELECT * FROM customers WHERE email = 'test@example.com';
    
    -- Recompute selectivity statistics
    SET STATISTICS INDEX idx_customer_email;
    9

    Monitoring

    Monitor active connections and database statistics:

    Query Active Connections (Firebird 3.0+)
    SELECT
      MON$ATTACHMENT_ID,
      MON$USER,
      MON$REMOTE_ADDRESS,
      MON$STATE,
      MON$TIMESTAMP
    FROM MON$ATTACHMENTS
    WHERE MON$ATTACHMENT_ID <> CURRENT_CONNECTION;
    Database Statistics
    # Database header information
    gstat -h /var/lib/firebird/4.0/data/myapp.fdb
    
    # Full statistics report
    gstat -a /var/lib/firebird/4.0/data/myapp.fdb > stats_report.txt
    10

    Troubleshooting

    Firebird Deployed Successfully!

    Your Firebird database is ready. Its lightweight footprint and robust feature set make it an excellent choice for applications requiring a reliable relational database without the overhead of larger RDBMS solutions.

    Production Checklist:

    • ✓ Implement regular backup schedules
    • ✓ Monitor database performance
    • ✓ Keep Firebird updated with security patches
    • ✓ Use dedicated users instead of SYSDBA
    • ✓ Enable wire encryption for all connections

    Ready to Deploy Firebird?

    Get started with a RamNode VPS and deploy Firebird in minutes. Our high-performance infrastructure is perfect for your database workloads.

    View VPS Plans →