Skip to content

Instantly share code, notes, and snippets.

@clonn
Last active January 28, 2026 13:16
Show Gist options
  • Select an option

  • Save clonn/768963b1aa9fbad64db7ab1c488a267f to your computer and use it in GitHub Desktop.

Select an option

Save clonn/768963b1aa9fbad64db7ab1c488a267f to your computer and use it in GitHub Desktop.
molt bot (clawdbot) installation script for ubuntu 24.04
#!/bin/bash
# ==============================================================================
# Moltbot Deployment Script for Ubuntu 24.04
# Optimized for: 4GB Swap, Node v24, Google DNS, and Custom Port Access
# ==============================================================================
# Exit immediately if a command exits with a non-zero status
set -e
# --- CONFIGURATION ---
CUSTOM_PORT=8888 # Change this to your desired port
# ---------------------
echo "--- [1/8] Configuring Google DNS (8.8.8.8) ---"
# Force set DNS to Google
sudo sed -i '/nameserver/d' /etc/resolv.conf || true
echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
echo "--- [2/8] Updating system package lists ---"
sudo apt update && sudo apt upgrade -y
echo "--- [3/8] Installing core tools and security software ---"
sudo apt install -y build-essential git curl wget unzip jq ffmpeg bubblewrap ufw fail2ban
echo "--- [4/8] Configuring 4GB Virtual Memory (Swap) ---"
# Increased to 4GB to support Node v24 and Chromium instances
if [ ! -f /swapfile ]; then
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Persist swap across reboots
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
echo "Swap configured to 4GB successfully."
else
echo "Swap file already exists. Skipping."
fi
echo "--- [5/8] Hardening Firewall & Opening Custom Port ---"
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow $CUSTOM_PORT/tcp
sudo ufw --force enable
echo "Firewall enabled. Port $CUSTOM_PORT is now open for external access."
echo "--- [6/8] Installing Node.js v24 via fnm ---"
curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "$HOME/.fnm" --skip-shell
# Inject fnm into current session
export PATH="$HOME/.fnm:$PATH"
eval "`$HOME/.fnm/fnm env`"
fnm install 24
fnm use 24
fnm default 24
npm install -g pnpm
echo "Node version: $(node -v)"
echo "--- [7/8] Installing Browser Environment (Ubuntu 24.04 t64) ---"
sudo apt install -y \
chromium-browser \
chromium-chromedriver \
libnss3 \
libatk1.0-0t64 \
libatk-bridge2.0-0t64 \
libcups2t64 \
libdrm2 \
libxkbcommon0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libasound2t64
echo "--- [8/8] Installing Moltbot ---"
# Using the new installation source
curl -fsSL https://molt.bot/install.sh | bash
echo "===================================================="
echo "✅ Environment Setup Complete! (Ubuntu 24.04 Ready)"
echo "===================================================="
echo "Please follow these next steps:"
echo "1. Reload shell config: source ~/.bashrc"
echo "2. Start Moltbot on Port $CUSTOM_PORT:"
echo " moltbot onboard --port $CUSTOM_PORT"
echo "----------------------------------------------------"
echo "💡 Tip: Ensure your Cloud Provider's Security Group"
echo " also allows inbound traffic on Port $CUSTOM_PORT."
echo "===================================================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment