Tutorial

Complete Setup Guide: Deploy Moltbot on VPS with Detailed Instructions

12 min read

Why Deploy Moltbot on a VPS?

Running Moltbot on your local machine works great for testing, but for 24/7 availability, a Virtual Private Server (VPS) is essential. This guide walks you through deploying Moltbot on popular VPS providers.

Benefits of VPS Deployment

  • 24/7 Availability: Your AI assistant stays online even when your laptop is off
  • Better Performance: Dedicated resources ensure fast response times
  • Secure & Isolated: Run in an isolated environment separate from your personal machine

Choosing a VPS Provider

Moltbot runs well on any Linux VPS with at least 2GB RAM. Here are the most popular options:

DigitalOcean Droplet - $12/month

Best for beginners

  • 2GB RAM, 1 vCPU, 50GB SSD
  • Simple UI, one-click apps
  • Great documentation
  • Recommended for: First-time VPS users, rapid deployment

AWS EC2 t3.small - $15/month

Best for scalability

  • 2GB RAM, 2 vCPU, unlimited bandwidth
  • AWS ecosystem integration
  • Free tier available (12 months)
  • Recommended for: Teams, enterprise use, existing AWS users

Hetzner Cloud CX21 - $5/month

Best for budget

  • 4GB RAM, 2 vCPU, 40GB SSD
  • Best price-to-performance ratio
  • European data centers (GDPR friendly)
  • Recommended for: Budget-conscious users, EU residents

Step-by-Step Setup (DigitalOcean Example)

Step 1: Create a Droplet

Log into DigitalOcean and create a new Droplet:

  • Image: Ubuntu 22.04 LTS
  • Plan: Basic - $12/month (2GB RAM, 1 vCPU)
  • Datacenter: Choose closest to your location
  • Authentication: SSH keys (recommended) or password
  • Hostname: moltbot-server

Step 2: SSH into Your Server

ssh root@your-server-ip

# Update system packages
sudo apt update && sudo apt upgrade -y

Step 3: Install Node.js and npm

# Install Node.js 20 LTS
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

# Verify installation
node --version  # Should show v20.x.x
npm --version   # Should show 10.x.x

Step 4: Install Moltbot

# Install Moltbot globally
npm install -g moltbot@latest

# Run the setup wizard
moltbot onboard --install-daemon

# Configure environment variables
moltbot config set ANTHROPIC_API_KEY=your_api_key_here
moltbot config set OPENAI_API_KEY=your_openai_key_here

Step 5: Set Up PM2 for Process Management

PM2 ensures Moltbot stays running and automatically restarts after crashes or server reboots.

# Install PM2
npm install -g pm2

# Start Moltbot with PM2
pm2 start moltbot --name "moltbot-assistant"

# Enable PM2 startup on boot
pm2 startup
pm2 save

# Check status
pm2 status

Step 6: Configure Firewall

# Set up UFW firewall
sudo ufw allow OpenSSH
sudo ufw allow 8080  # If using web dashboard
sudo ufw enable

# Check status
sudo ufw status

Advanced Configuration

Set Up HTTPS with Let's Encrypt

If you're running a web dashboard, secure it with free SSL certificates:

sudo apt install certbot
sudo certbot certonly --standalone -d yourdomain.com

Set Up Monitoring with PM2 Plus

Get real-time monitoring and alerts:

pm2 link your-secret-key your-public-key
pm2 install pm2-logrotate

Configure Automatic Backups

Set up daily backups of your Moltbot configuration:

crontab -e
# Add: 0 2 * * * tar -czf ~/backups/moltbot-$(date +%Y%m%d).tar.gz ~/.moltbot

Troubleshooting Common Issues

Issue: Moltbot won't start

Solution: Check PM2 logs for errors:

pm2 logs moltbot-assistant

Issue: High memory usage

Solution: Restart Moltbot and enable memory limits:

pm2 restart moltbot-assistant --max-memory-restart 1G

Issue: WhatsApp connection drops

Solution: Reconnect using QR code:

moltbot channels login whatsapp

Security Best Practices

  1. Use SSH keys instead of password authentication
  2. Enable automatic security updates: sudo apt install unattended-upgrades
  3. Set up fail2ban to prevent brute force attacks
  4. Use a non-root user for running Moltbot
  5. Keep your API keys in environment variables, never hardcode them

Next Steps

Now that your Moltbot is running 24/7 on a VPS:

  • Configure messaging integrations (WhatsApp, Telegram, Discord)
  • Set up daily briefings and notifications
  • Explore automation workflows
  • Join the Discord community for tips and tricks

Your AI assistant is now always available, whether you're at home, at work, or on the go!

Explore More Moltbot Resources

Discover tutorials, guides, and community stories to get the most out of your AI assistant.

Back to All News