LogoOpenClawAI
  • Features
  • Get Started
  • Blog
Deploy MoltBot on VPS - Ubuntu Server Guide
2026/01/30

Deploy MoltBot on VPS - Ubuntu Server Guide

Install MoltBot on VPS. Ubuntu deployment with systemd, nginx, and production best practices.

Deploy MoltBot on a VPS

Running MoltBot on a VPS gives you a 24/7 AI assistant accessible from anywhere. This guide covers deploying on Ubuntu Server with production-ready configuration.

Recommended VPS Specs

Minimum

  • CPU: 1 vCPU
  • RAM: 2 GB
  • Storage: 20 GB SSD
  • OS: Ubuntu 22.04 LTS

Recommended

  • CPU: 2+ vCPU
  • RAM: 4 GB
  • Storage: 40 GB SSD
  • OS: Ubuntu 22.04 LTS

For Local Models

  • CPU: 4+ vCPU
  • RAM: 16 GB+
  • GPU: Optional NVIDIA GPU

Initial Server Setup

Connect to Your Server

ssh root@your-server-ip

Create a Non-Root User

adduser moltbot
usermod -aG sudo moltbot
su - moltbot

Update System

sudo apt update && sudo apt upgrade -y

Install Essential Packages

sudo apt install -y curl git build-essential

Installing Node.js

Using nvm (Recommended)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install 20
nvm use 20

Verify Installation

node --version  # Should be v20.x.x
npm --version

Installing MoltBot

Method 1: npm

npm install -g moltbot

Method 2: From Source

git clone https://github.com/moltbot/moltbot.git
cd moltbot
npm install
npm run build

Initial Configuration

moltbot setup

Environment Configuration

Create Environment File

mkdir -p ~/.moltbot
nano ~/.moltbot/.env

Add your configuration:

# AI Provider
ANTHROPIC_API_KEY=sk-ant-xxx

# Or use other providers
# OPENAI_API_KEY=sk-xxx
# GOOGLE_AI_API_KEY=xxx

# Messaging (optional)
TELEGRAM_BOT_TOKEN=xxx
DISCORD_BOT_TOKEN=xxx

# Production settings
NODE_ENV=production
LOG_LEVEL=info

Secure the File

chmod 600 ~/.moltbot/.env

Running with systemd

Create Service File

sudo nano /etc/systemd/system/moltbot.service

Add:

[Unit]
Description=MoltBot AI Assistant
After=network.target

[Service]
Type=simple
User=moltbot
WorkingDirectory=/home/moltbot
ExecStart=/home/moltbot/.nvm/versions/node/v20.10.0/bin/moltbot start
Restart=always
RestartSec=10
EnvironmentFile=/home/moltbot/.moltbot/.env

# Security hardening
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=read-only
ReadWritePaths=/home/moltbot/.moltbot

[Install]
WantedBy=multi-user.target

Enable and Start

sudo systemctl daemon-reload
sudo systemctl enable moltbot
sudo systemctl start moltbot

Check Status

sudo systemctl status moltbot

View Logs

sudo journalctl -u moltbot -f

Firewall Configuration

Using UFW

# Enable firewall
sudo ufw enable

# Allow SSH
sudo ufw allow ssh

# Allow HTTP/HTTPS (if using web interface)
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# Check status
sudo ufw status

Reverse Proxy with Nginx

If MoltBot has a web interface or webhook:

Install Nginx

sudo apt install -y nginx

Configure Site

sudo nano /etc/nginx/sites-available/moltbot

Add:

server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        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;
        proxy_cache_bypass $http_upgrade;
    }
}

Enable Site

sudo ln -s /etc/nginx/sites-available/moltbot /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

SSL with Let's Encrypt

Install Certbot

sudo apt install -y certbot python3-certbot-nginx

Get Certificate

sudo certbot --nginx -d your-domain.com

Auto-Renewal

sudo systemctl enable certbot.timer

Using Docker (Alternative)

Install Docker

curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker moltbot

Docker Compose Setup

Create docker-compose.yml:

version: '3.8'

services:
  moltbot:
    image: moltbot/moltbot:latest
    container_name: moltbot
    restart: unless-stopped
    env_file:
      - .env
    volumes:
      - ./data:/app/data
    ports:
      - "127.0.0.1:3000:3000"

Start with Docker

docker compose up -d

Monitoring

With PM2

npm install -g pm2
pm2 start moltbot --name moltbot
pm2 save
pm2 startup

Health Check Script

Create /home/moltbot/healthcheck.sh:

#!/bin/bash
if ! systemctl is-active --quiet moltbot; then
    echo "MoltBot is down! Restarting..." | mail -s "MoltBot Alert" you@email.com
    sudo systemctl restart moltbot
fi

Add to crontab:

crontab -e
# Add:
*/5 * * * * /home/moltbot/healthcheck.sh

Backup Strategy

Automated Backups

Create /home/moltbot/backup.sh:

#!/bin/bash
BACKUP_DIR="/home/moltbot/backups"
DATE=$(date +%Y%m%d)

mkdir -p $BACKUP_DIR
tar -czf $BACKUP_DIR/moltbot-$DATE.tar.gz /home/moltbot/.moltbot

# Keep only last 7 days
find $BACKUP_DIR -name "*.tar.gz" -mtime +7 -delete

Schedule daily backups:

crontab -e
# Add:
0 3 * * * /home/moltbot/backup.sh

Offsite Backup

# Install rclone
curl https://rclone.org/install.sh | sudo bash

# Configure (e.g., for S3)
rclone config

# Add to backup script
rclone sync $BACKUP_DIR remote:moltbot-backups

Security Hardening

SSH Key Only

# On local machine
ssh-copy-id moltbot@your-server-ip

# On server
sudo nano /etc/ssh/sshd_config
# Set: PasswordAuthentication no
sudo systemctl restart sshd

Fail2Ban

sudo apt install -y fail2ban
sudo systemctl enable fail2ban

Automatic Updates

sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades

Updating MoltBot

npm Installation

npm update -g moltbot
sudo systemctl restart moltbot

Docker Installation

docker compose pull
docker compose up -d

Troubleshooting

Service Won't Start

# Check logs
sudo journalctl -u moltbot -n 100

# Check permissions
ls -la ~/.moltbot/

Memory Issues

# Check memory
free -h

# Add swap if needed
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

High CPU Usage

Limit MoltBot resources in config or use cgroups.


Your MoltBot is now running 24/7 on your VPS! Need help? Join our Discord community.

All Posts

Categories

    Deploy MoltBot on a VPSRecommended VPS SpecsMinimumRecommendedFor Local ModelsInitial Server SetupConnect to Your ServerCreate a Non-Root UserUpdate SystemInstall Essential PackagesInstalling Node.jsUsing nvm (Recommended)Verify InstallationInstalling MoltBotMethod 1: npmMethod 2: From SourceInitial ConfigurationEnvironment ConfigurationCreate Environment FileSecure the FileRunning with systemdCreate Service FileEnable and StartCheck StatusView LogsFirewall ConfigurationUsing UFWReverse Proxy with NginxInstall NginxConfigure SiteEnable SiteSSL with Let's EncryptInstall CertbotGet CertificateAuto-RenewalUsing Docker (Alternative)Install DockerDocker Compose SetupStart with DockerMonitoringWith PM2Health Check ScriptBackup StrategyAutomated BackupsOffsite BackupSecurity HardeningSSH Key OnlyFail2BanAutomatic UpdatesUpdating MoltBotnpm InstallationDocker InstallationTroubleshootingService Won't StartMemory IssuesHigh CPU Usage

    More Posts

    MoltBot GitHub - Source Code, Installation & Contributing Guide

    MoltBot GitHub - Source Code, Installation & Contributing Guide

    Official MoltBot GitHub repository. Clone, install from source, and contribute to the open source project. Complete guide to MoltBot GitHub.

    2026/01/30

    ClawdBot is Now MoltBot - Migration Guide

    ClawdBot has been rebranded to MoltBot. Learn how to migrate from ClawdBot to MoltBot seamlessly. All features remain the same.

    2026/01/30
    MoltBot Skills: Extend Your AI with 50+ Integrations

    MoltBot Skills: Extend Your AI with 50+ Integrations

    Explore MoltBot's extensive skill system with 50+ built-in integrations. Learn how to use existing skills and create your own custom integrations.

    2026/01/30

    Newsletter

    Join the community

    Subscribe to our newsletter for the latest news and updates

    LogoOpenClawAI

    The AI that actually does things. Open-source personal AI assistant.

    GitHubGitHubEmail
    Product
    • Features
    • FAQ
    Resources
    • Blog
    Company
    • About
    • Contact
    Legal
    • Cookie Policy
    • Privacy Policy
    • Terms of Service
    Š 2026 OpenClawAI All Rights Reserved.