#!/bin/bash ################################################################################ # Chatwoot Quick Installation Script # Supports: Ubuntu 20.04, 22.04, 24.04 LTS # Simple method using official Chatwoot installation script # Usage: sudo bash chatwoot_quick_install.sh ################################################################################ set -e # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # Check if running as root if [ "$EUID" -ne 0 ]; then echo -e "${RED}Error: This script must be run as root${NC}" echo "Run: sudo bash chatwoot_quick_install.sh" exit 1 fi echo -e "${GREEN}╔════════════════════════════════════════════╗${NC}" echo -e "${GREEN}║ Chatwoot Installation - Ubuntu 20.04+ ║${NC}" echo -e "${GREEN}╚════════════════════════════════════════════╝${NC}" echo "" # Check Ubuntu version if [ ! -f /etc/os-release ]; then echo -e "${RED}Error: Cannot detect Ubuntu version${NC}" exit 1 fi . /etc/os-release echo -e "${GREEN}[✓]${NC} Ubuntu $VERSION_ID detected" # Validate Ubuntu version case $VERSION_ID in 20.04|22.04|24.04) echo -e "${GREEN}[✓]${NC} Supported Ubuntu version" ;; *) echo -e "${YELLOW}[!]${NC} Ubuntu $VERSION_ID is not officially supported" echo " Supported versions: 20.04, 22.04, 24.04" read -p "Continue anyway? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1 fi ;; esac echo "" read -p "Install Postgres and Redis? (yes/no): " install_postgres_redis install_postgres_redis=${install_postgres_redis:-yes} echo "" read -p "Configure domain and SSL? (yes/no): " configure_domain configure_domain=${configure_domain:-no} domain="" email="" if [ "$configure_domain" = "yes" ]; then echo "" echo "Make sure you have created an A record for your domain" read -p "Enter your domain (e.g., chatwoot.example.com): " domain read -p "Enter email for Let's Encrypt: " email if [ -z "$domain" ] || [ -z "$email" ]; then echo -e "${RED}Error: Domain and email are required for SSL${NC}" configure_domain="no" fi fi echo "" echo -e "${YELLOW}Starting installation...${NC}" echo "" # Update system echo -e "${GREEN}[1/6]${NC} Updating system..." apt-get update -qq apt-get upgrade -y -qq # Download official Chatwoot installation script echo -e "${GREEN}[2/6]${NC} Downloading Chatwoot installation script..." cd /tmp wget -q https://raw.githubusercontent.com/chatwoot/chatwoot/develop/deployment/setup_20.04.sh -O chatwoot_setup.sh chmod +x chatwoot_setup.sh # Run installation echo -e "${GREEN}[3/6]${NC} Running Chatwoot installation..." echo "" # Prepare script arguments install_args="--install" if [ "$install_postgres_redis" != "yes" ]; then install_args="$install_args --web-only" fi # Run the official script with automatic answers bash ./chatwoot_setup.sh $install_args <