Apache Guacamole is a powerful, clientless remote desktop application that allows you to access remote machines and servers using a web browser. It supports popular protocols like VNC, RDP, and SSH, and utilizes HTML5 for seamless remote connections. In this article, we will walk you through the installation process of Apache Guacamole as a Docker container on Ubuntu 22.04.

Prerequisites

Before we begin, make sure you have the following:

  • A server running Ubuntu 22.04.
  • A root password configured on the server.

Installing Docker Engine

To start the installation, it is recommended to install the latest version of Docker on your Ubuntu server. Follow these steps:

  1. Install the necessary dependencies:
apt install ca-certificates curl gnupg lsb-release -y
  1. Add the Docker GPG key and repository:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor > /etc/apt/trusted.gpg.d/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
  1. Update the repository and install the Docker Engine package:
apt update -y
apt install docker-ce docker-ce-cli containerd.io -y
  1. Verify the Docker version:
docker --version

You should see the Docker version displayed, confirming a successful installation:

Docker version 20.10.18, build b40c2f6

Installing Docker Compose

Next, you need to install Docker Compose, which will allow you to define and manage multi-container Docker applications. Follow these steps:

  1. Download Docker Compose:
curl -sL "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
  1. Verify the Docker Compose version:
docker-compose --version

You should see the Docker Compose version displayed:

docker-compose version 1.29.2, build 5becea4c

Downloading Apache Guacamole Server and Client Images

Now that Docker and Docker Compose are installed, let’s download the Apache Guacamole Server and Client images from the Docker registry. Follow these steps:

  1. Download the server image:
docker pull guacamole/guacd
  1. Download the client image:
docker pull guacamole/guacamole
  1. Verify the downloaded images:
docker images

You should see the following output:

REPOSITORY

TAG

IMAGE ID

CREATED

SIZE

guacamole/guacd

latest

4086ac9e35a7

9 hours ago

271MB

guacamole/guacamole

latest

959856a45436

10 hours ago

432MB

Launching Apache Guacamole MySQL Container

Before launching the Guacamole server and client containers, you need to set up a MySQL container for authentication. Follow these steps:

  1. Download and launch the MySQL container:
docker run --name guacamoledb -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=guacdb -d mysql/mysql-server
  1. Create a directory to store the database:
mkdir -p /opt/guacamole/mysql
  1. Generate the MySQL initialization script:
docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --mysql > /opt/guacamole/mysql/01-initdb.sql
  1. Copy the Guacamole MySQL database initialization script to the MySQL Docker container:
docker cp /opt/guacamole/mysql/01-initdb.sql guacamoledb:/docker-entrypoint-initdb.d
  1. Connect to the MySQL database container:
docker exec-it guacamoledb bash
  1. List the MySQL initialization script:
cd /docker-entrypoint-initdb.d/
ls

You should see the 01-initdb.sql file listed.

  1. Connect to the MySQL shell:
mysql -u root -p
  1. Switch the database to guacd and initialize the Guacamole database:
use guacdb;
source01-initdb.sql;
  1. Verify all tables:
show tables;

You should see a list of Guacamole tables displayed.

  1. Create an admin user and set a password:
create user guacadmin@'%' identified by 'password';
grant SELECT,UPDATE,INSERT,DELETE on guacdb.* to guacadmin@'%';
  1. Flush the privileges and exit from the MySQL shell:
flush privileges;
exit;
  1. Exit from the MySQL container:
exit
  1. Verify the running container:
docker ps

You should see the MySQL container listed.

Launching Guacamole Server Container

Now, it’s time to launch the Guacamole server container. Follow these steps:

  1. Start the Guacamole server container:
docker run --name guacamole-server -d guacamole/guacd
  1. Check the container logs:
docker logs --tail10 guacamole-server

You should see the Guacamole server started successfully.

  1. Verify the running container:
docker ps

You should see the Guacamole server container listed.

Launching Guacamole Client Container

Finally, let’s launch the Guacamole client container. Follow these steps:

  1. Start the Guacamole client container:
docker run --name guacamole-client --link guacamole-server:guacd --link guacamoledb:mysql -e MYSQL_DATABASE=guacdb -e MYSQL_USER=guacadmin -e MYSQL_PASSWORD=password -d -p 80:8080 guacamole/guacamole
  1. Verify the running container:
docker ps

You should see the Guacamole client container listed.

Accessing Apache Guacamole Dashboard

Now that everything is set up, you can access the Apache Guacamole web interface using the URL: http://your-server-ip/guacamole. Follow these steps:

  1. Open your web browser and enter the URL.
  2. You should see the Guacamole login screen.
  3. Enter the default credentials:
  • User: guacadmin
  • Password: guacadmin
  1. Click on the Login button.
  2. You should now see the Guacamole dashboard, allowing you to create new connections and access remote servers through a web browser.

Congratulations! You have successfully installed Apache Guacamole as a Docker container on your Ubuntu 22.04 server. You can now securely access and manage remote machines and servers with ease.

If you have any questions or need further assistance, feel free to reach out to our team at Shape.host. We provide reliable and scalable cloud hosting solutions, including Cloud VPS, to empower businesses with efficient remote access capabilities.