I’m using docker for Guacamole, but using a local instance of mysql already installed, so this guide will show you how to install Mariadb/Mysql which is the same method I used to install it previous.
Install Docker
Update the repo to get latest versions
sudo apt update
Install the latest version
sudo apt install docker.io
Set Docker to start on startup
sudo systemctl enable --now docker
Give your user permissions to docker, replacing user
with your username
sudo usermod -aG docker user
Test it has installed correctly by getting the docker version
docker --version
Docker Compose
I also install docker-compose as some dockers need you to compose from a yml file. This downloads v2.16.0, just change this if the version updates to a later version
sudo curl -L "https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Give permissions to this
sudo chmod +x /usr/local/bin/docker-compose
Test it has installed correctly by getting the docker-compose version
docker-compose --version
Installing MariaDB
First, update the repo to get latest versions (you can ignore this step if you ran it above for the above installs)
sudo apt update
Install Maridadb-server
and mariadb-client
sudo apt install mariadb-server mariadb-client
Secure the installation
sudo mysql_secure_installation
First will prompt you for current password, this will be blank so just press enter
Enter current password for root (enter for none):
Next, it will ask you to set a root password. Press Y and enter a password, and then confirm.
Set root password? [Y/n] Y
The rest, accept the defaults, and complete the configuration.
Enable the service to start on boot.
sudo systemctl enable mariadb-server
Creating database for Guacamole
Run the following to create the sql needed to create the database
docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --mysql > initdb.sql
Login to mysql, this was prompt you for your password you set earlier.
sudo mysql -u root -p
Create database
CREATE DATABASE guacamole_db;
Create a user (Please change the password at the end to a secure password)
create user 'guacamole_user'@'%' identified by 'your-password';
Grant privileges to the above account
grant all privileges ON guacamole_db.* TO 'guacamole_user'@'%';
Flush privileges and exit
flush privileges;
exit;
As we need to connect from a docker instance, change the bind-address
to 0.0.0.0 to allow mysql to listen on all interfaces.
sudo nano /etc/mysql/my.cnf
Paste the below at the end
skip-networking
bind-address = 0.0.0.0
Restart mysql
sudo systemctl restart mysql.service
Run the initialization script.
cat initdb.sql | sudo mysql -u root -p guacamole_db
Install Guacamole
We need to create 2 linked containers, the first one is guacd.
docker run --name some-guacd -d guacamole/guacd
Lastly we need to create the guacamole docker. I’m using port 8080 for something else, so picked 8189 for it. If you want to use the default, change 8189:8080
in the below back to 8080:8080
.
docker run --name some-guacamole --link some-guacd:guacd -e MYSQL_HOSTNAME=192.168.0.52 -e MYSQL_DATABASE='guacamole_db' -e MYSQL_USER='guacamole_user' -e MYSQL_PASSWORD='guacamole' -d -p 8189:8080 guacamole/guacamole
First run
Browse to http://serverip:8189/guacamole and you will get the login screen. Default user is guacadmin and password guacadmin