Cookbook - Apache Guacamole - Setup Guide

In this setup guide, we’ll set up the Guacamole Proxy and MySQL using Docker containers.

1. Deploy MySQL

First, create a Docker volume where your MySQL server will store all your guacamole data:

$ docker volume create mysql-volume

Then, can run the mysql server, filling in ROOT_PASSWORD with whatever password you’d like:

$ docker run --name=mysql-guac -p 3306:3306 -v mysql-volume:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=ROOT_PASSWORD -d mysql/mysql-server:8.0.20

With this running, you’ll be able to access the mysql instance on port 3306, however MySQL will not allow you access from outside the docker container. To fix this, you can create a guacadmin user in the mysql database like so:

$ docker exec -it mysql-guac bash
$ mysql -u root -p
Enter password: ROOT_PASSWORD
...

mysql> CREATE USER 'guacadmin'@'%' IDENTIFIED BY 'ROOT_PASSWORD';
Query OK, 1 row affected (0.02 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'guacadmin'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

The above will log you into mysql as the guacadmin user and allow clients from outside the docker container to access the database.

2. Deploy Guacamole Proxy

Apache Guacamole is split into two main components, the proxy component (named gaucd), and the web application component. We’ll begin by deploying guacd, which acts as the proxy that allows users to use services like RDP and VNC from within their browser.

Deploying guacd using docker is as simple as starting the container:

$ docker run --name guac-guacd -d guacamole/guacd

You can check to make sure your mysql and guacd containers are running:

$ docker ps
CONTAINER ID   IMAGE                       COMMAND                  CREATED          STATUS                    PORTS                               NAMES
ac89c62d21b8   mysql/mysql-server:8.0.20   "/entrypoint.sh mysq…"   45 seconds ago   Up 43 seconds (healthy)   0.0.0.0:3306->3306/tcp, 33060/tcp   mysql-guac
01be978ac679   guacamole/guacd             "/bin/sh -c '/usr/lo…"   2 minutes ago    Up 2 minutes              4822/tcp                            guac-guacd

3. Instantiate MySQL Database

With guacd and mysql running, we now need to instantiate the MySQL database and prepare it for use with Guacamole. Thankfully this is very straightforward thanks to the built-in database initializer that’s shipped with Guacamole.

We’ve provided a sample script to use for this - save it as initdb.sql to be used from the MySQL Client.

Now we can connect to our MySQL database using the mysql client, and initialize the database using initdb.sql.

$ mysql -h 127.0.0.1 -P 3306 mysql  -u guacadmin -p
Enter password:
...

mysql> source initdb.sql

Your Guacamole deployment is ready to go!



Last modified: Sep 23, 2021