How to install Guacamole in Docker

From HyperSecurity Wiki
Revision as of 05:28, 27 May 2025 by Srapaz (talk | contribs) (Created page with "#!/bin/bash set -e # === Configuration === GUAC_VERSION="1.5.5" MYSQL_ROOT_PASSWORD="some_password" GUAC_DB="guacamole_db" GUAC_USER="guacamole_user" GUAC_PASSWORD="some_p...")
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search
  1. !/bin/bash

set -e

  1. === Configuration ===

GUAC_VERSION="1.5.5" MYSQL_ROOT_PASSWORD="some_password" GUAC_DB="guacamole_db" GUAC_USER="guacamole_user" GUAC_PASSWORD="some_password" INSTALL_DIR="/opt/guacamole"

echo "[+] Updating system..." apt-get update -y

echo "[+] Installing Docker and Docker Compose..." apt-get install -y docker.io docker-compose

echo "[+] Creating directory structure..." mkdir -p "$INSTALL_DIR/initdb" cd "$INSTALL_DIR"

echo "[+] Writing docker-compose.yml..." cat > docker-compose.yml <<EOF version: '2' services:

 guacd:
   image: guacamole/guacd:${GUAC_VERSION}
   container_name: guacd
   restart: always

 guacdb:
   image: mariadb:10.5
   container_name: guacdb
   restart: always
   environment:
     MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
     MYSQL_DATABASE: ${GUAC_DB}
     MYSQL_USER: ${GUAC_USER}
     MYSQL_PASSWORD: ${GUAC_PASSWORD}
   volumes:
     - ./initdb:/docker-entrypoint-initdb.d

 guacamole:
   image: guacamole/guacamole:${GUAC_VERSION}
   container_name: guacamole
   restart: always
   ports:
     - "8080:8080"
   environment:
     GUACD_HOSTNAME: guacd
     MYSQL_HOSTNAME: guacdb
     MYSQL_DATABASE: ${GUAC_DB}
     MYSQL_USER: ${GUAC_USER}
     MYSQL_PASSWORD: ${GUAC_PASSWORD}
   depends_on:
     - guacd
     - guacdb

EOF

echo "[+] Downloading Guacamole MySQL init script..." docker run --rm guacamole/guacamole:${GUAC_VERSION} /opt/guacamole/bin/initdb.sh --mysql > initdb/initdb.sql

echo "[+] Starting all containers..." docker-compose up -d

echo "[+] Done. Guacamole is being deployed. Waiting for containers to initialize..."

  1. Wait for Guacamole to be healthy (basic check)

sleep 20

  1. Show status

docker ps

echo echo "======================================" echo " Guacamole setup complete!" echo " Access it at: http://<your-server-ip>:8080/guacamole" echo echo " Default login: guacadmin / guacadmin" echo " CHANGE THE DEFAULT PASSWORD after login." echo "======================================"