VPS Installation Guide

Deploy rengine on cloud providers like DigitalOcean, AWS, or Azure

Last updated: July 11, 2024

VPS Installation Guide

Deploy rengine on cloud Virtual Private Servers (VPS) for scalable reconnaissance. This guide covers deployment on popular cloud providers.

Why Use a VPS?

Benefits of cloud deployment:

  • Scalable resources - Upgrade CPU/RAM as needed
  • Better network connectivity - Faster scans and downloads
  • 24/7 availability - Run long reconnaissance tasks
  • Geographic distribution - Deploy closer to targets
  • Cost effective - Pay only for what you use

Cloud Provider Recommendations

Recommended Droplet sizes:

Droplet Type vCPUs RAM Storage Price/month Use Case
Basic 2 2GB 50GB $12 Testing/Small scans
General Purpose 2 4GB 80GB $24 Standard use
CPU-Optimized 4 8GB 160GB $48 Heavy scanning

AWS EC2

Recommended instance types:

  • t3.medium (2 vCPU, 4GB RAM) - Standard use
  • c5.large (2 vCPU, 4GB RAM) - CPU-intensive tasks
  • m5.large (2 vCPU, 8GB RAM) - Memory-intensive tasks

Azure

Recommended VM sizes:

  • Standard_B2s (2 vCPU, 4GB RAM) - Burstable performance
  • Standard_D2s_v3 (2 vCPU, 8GB RAM) - General purpose

DigitalOcean Deployment

Step 1: Create Droplet

Using doctl CLI
# Install doctl
curl -OL https://github.com/digitalocean/doctl/releases/download/v1.94.0/doctl-1.94.0-linux-amd64.tar.gz
tar xf doctl-1.94.0-linux-amd64.tar.gz
sudo mv doctl /usr/local/bin

# Authenticate
doctl auth init

# Create droplet
doctl compute droplet create rengine-server \\
  --image ubuntu-22-04-x64 \\
  --size s-2vcpu-4gb \\
  --region nyc1 \\
  --ssh-keys YOUR_SSH_KEY_ID

Step 2: Connect to Droplet

SSH Connection
# Get droplet IP
doctl compute droplet list

# Connect via SSH
ssh root@YOUR_DROPLET_IP

Step 3: Initial Server Setup

Server Hardening
# Update system
apt update && apt upgrade -y

# Create non-root user
adduser rengine
usermod -aG sudo rengine

# Configure SSH key for new user
mkdir -p /home/rengine/.ssh
cp /root/.ssh/authorized_keys /home/rengine/.ssh/
chown -R rengine:rengine /home/rengine/.ssh
chmod 700 /home/rengine/.ssh
chmod 600 /home/rengine/.ssh/authorized_keys

Step 4: Install rengine

Switch to the rengine user and install:

Install rengine
# Switch to rengine user
su - rengine

# Install rengine
curl -fsSL https://raw.githubusercontent.com/yogeshojha/rengine/master/install.sh | bash

Step 5: Configure Firewall

Setup UFW Firewall
# Enable firewall
sudo ufw enable

# Allow SSH
sudo ufw allow ssh

# Allow rengine web interface
sudo ufw allow 8000

# Check status
sudo ufw status

AWS EC2 Deployment

Step 1: Launch Instance

Using AWS CLI:

Launch EC2 Instance
# Configure AWS CLI first
aws configure

# Launch instance
aws ec2 run-instances \\
  --image-id ami-0c02fb55956c7d316 \\
  --count 1 \\
  --instance-type t3.medium \\
  --key-name your-key-pair \\
  --security-group-ids sg-your-security-group \\
  --subnet-id subnet-your-subnet

Step 2: Configure Security Group

Allow required ports:

Security Group Rules
# Allow SSH
aws ec2 authorize-security-group-ingress \\
  --group-id sg-your-security-group \\
  --protocol tcp \\
  --port 22 \\
  --cidr 0.0.0.0/0

# Allow rengine web interface  
aws ec2 authorize-security-group-ingress \\
  --group-id sg-your-security-group \\
  --protocol tcp \\
  --port 8000 \\
  --cidr 0.0.0.0/0

Step 3: Connect and Install

Connect to EC2
# Connect via SSH
ssh -i your-key.pem ubuntu@your-instance-ip

# Install rengine
curl -fsSL https://raw.githubusercontent.com/yogeshojha/rengine/master/install.sh | bash

Security Configuration

SSL/TLS Setup

For production deployments, configure HTTPS:

Install Nginx and Certbot
# Install nginx
sudo apt install nginx certbot python3-certbot-nginx

# Configure nginx reverse proxy
sudo nano /etc/nginx/sites-available/rengine
Nginx Configuration
server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
Enable Site and SSL
# Enable site
sudo ln -s /etc/nginx/sites-available/rengine /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

# Get SSL certificate
sudo certbot --nginx -d your-domain.com

Firewall Configuration

Production Firewall Rules
# Allow HTTP/HTTPS only
sudo ufw delete allow 8000
sudo ufw allow 'Nginx Full'
sudo ufw allow ssh

# Limit SSH connections
sudo ufw limit ssh

# Check rules
sudo ufw status numbered

Performance Optimization

Resource Monitoring

Install Monitoring Tools
# Install htop and iotop
sudo apt install htop iotop netdata

# Configure netdata (optional)
sudo systemctl enable netdata
sudo systemctl start netdata

Auto-scaling Configuration

For AWS, configure auto-scaling:

CloudWatch Monitoring
# Install CloudWatch agent
wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
sudo rpm -U ./amazon-cloudwatch-agent.rpm

Backup and Maintenance

Automated Backups

Backup Script
#!/bin/bash
# /home/rengine/backup.sh

BACKUP_DIR="/home/rengine/backups"
DATE=$(date +%Y%m%d_%H%M%S)

# Create backup directory
mkdir -p $BACKUP_DIR

# Backup database
docker exec rengine_postgres pg_dump -U rengine rengine > $BACKUP_DIR/db_backup_$DATE.sql

# Backup configuration
tar -czf $BACKUP_DIR/config_backup_$DATE.tar.gz /home/rengine/rengine/.env

# Remove old backups (keep last 7 days)
find $BACKUP_DIR -name "*.sql" -mtime +7 -delete
find $BACKUP_DIR -name "*.tar.gz" -mtime +7 -delete
Schedule Backups
# Make script executable
chmod +x /home/rengine/backup.sh

# Add to crontab
crontab -e
# Add line: 0 2 * * * /home/rengine/backup.sh

System Updates

Update Script
#!/bin/bash
# /home/rengine/update.sh

cd /home/rengine/rengine

# Pull latest changes
git pull origin master

# Rebuild containers
docker-compose build --no-cache

# Restart services
docker-compose down
docker-compose up -d

# Run migrations
docker-compose exec web python manage.py migrate

Cost Optimization

Reserved Instances (AWS)

For long-term deployments, consider reserved instances for 30-60% savings.

Spot Instances

For non-critical workloads, use spot instances:

Launch Spot Instance
aws ec2 request-spot-instances \\
  --spot-price "0.05" \\
  --instance-count 1 \\
  --type "one-time" \\
  --launch-specification '{
    "ImageId": "ami-0c02fb55956c7d316",
    "InstanceType": "t3.medium",
    "KeyName": "your-key-pair",
    "SecurityGroupIds": ["sg-your-security-group"]
  }'

Scheduled Scaling

Automatically stop instances during off-hours:

Scheduled Stop/Start
# Stop instance at 6 PM
0 18 * * * aws ec2 stop-instances --instance-ids i-your-instance-id

# Start instance at 8 AM
0 8 * * * aws ec2 start-instances --instance-ids i-your-instance-id

Troubleshooting

Common VPS Issues

Out of memory errors:

Add Swap Space
# Create 2GB swap file
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

# Make permanent
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Disk space issues:

Clean Docker Resources
# Remove unused Docker resources
docker system prune -a --volumes

# Clean APT cache
sudo apt autoremove
sudo apt autoclean

Network connectivity issues:

Network Diagnostics
# Check DNS resolution
nslookup google.com

# Test connectivity
curl -I https://google.com

# Check listening ports
netstat -tulpn

Next Steps

With rengine deployed on your VPS:

  1. Configure your first scan →
  2. Set up automated scanning →
  3. Configure monitoring →

Deployment Complete!

Your rengine instance is now running on a VPS. Remember to regularly update the system and backup your data.


Need help? Check our VPS troubleshooting guide or ask the community.