Installing Apache Guacamole on Ubuntu 24.04: Secure Remote Desktop Gateway

Posted on

Installing Apache Guacamole on Ubuntu 24.04: Secure Remote Desktop Gateway

This guide provides comprehensive steps for Installing Apache Guacamole on Ubuntu 24.04. Guacamole is an open-source remote desktop gateway. It allows you to access your computer and server through a web browser remotely. If you are looking for a complete guide for Installing Apache Guacamole on Ubuntu 24.04, you are on the right place.

A Comprehensive Guide For Installing Apache Guacamole on Ubuntu 24.04

For Installing Apache Guacamole on Ubuntu 24.04, you must have access to your Ubuntu system as a non-root user with sudo privileges. If you want to know how to create a sudo user, you can check this guide on Create a Sudo User on Ubuntu 24.04 From Terminal.

Now follow the steps below to start Guacamole installation on the latest stable version of Ubuntu which is Ubuntu 24.04.

You can check the Video Tutorial Here:

1. Install Requirements for Guacamole on Ubuntu 24.04

First, run the system update with the command below:

sudo apt update

Then, you must install the following packages and dependencies for installing Apache Guacamole on Ubuntu 24.04:

sudo apt install build-essential libcairo2-dev libjpeg-turbo8-dev 
    libpng-dev libtool-bin libossp-uuid-dev libvncserver-dev 
    freerdp2-dev libssh2-1-dev libtelnet-dev libwebsockets-dev 
    libpulse-dev libvorbis-dev libwebp-dev libssl-dev 
    libpango1.0-dev libswscale-dev libavcodec-dev libavutil-dev 
    libavformat-dev -y

2. Download Apache Guacamole Source Code and Install It on Ubuntu 24.04

Now you must visit the Apache Guacamole Downloads page and look for the latest version. At the current time, the latest version of Guacamole is 1.5.5. So you can use the following Wget Command to download the source code of Guacamole on Ubuntu 24.04:

sudo wget https://downloads.apache.org/guacamole/1.5.5/source/guacamole-server-1.5.5.tar.gz
Downloading and Installing Apache Guacamole on Ubuntu 24.04
Installing Apache Guacamole on Ubuntu 24.04 – Download Source Code

Then, extract your Guacamole package and navigate to it with the following commands:

sudo tar -xvf guacamole-server-1.5.5.tar.gz

sudo cd guacamole-server-1.5.5

Build and Install Apache Guacamole

At this point, you start building and installing Apache Guacamole on Ubuntu 24.04 with the following commands:

sudo ./configure --with-init-dir=/etc/init.d --enable-allow-freerdp-snapshots
sudo make
sudo make install

The installation process may take some time to complete. After that, you need to update the installed library cache with the following command:

sudo ldconfig

Enable and Start Guacamole Service

Now you must reload your systemd to apply the changes:

sudo systemctl daemon-reload

Next, use the following commands to enable and start the Guacamole service on Ubuntu 24.04:

sudo systemctl enable guacd
sudo systemctl start guacd

Then, verify your Guacamole service is active and running on Ubuntu 24.04:

sudo systemctl status guacd
Installing Apache Guacamole on Ubuntu 24.04 – Guacd Status

Important Note: You must create the Guacamole configuration files and extensions. These files will used in the later steps. To do this, you can run the command below:

sudo mkdir -p /etc/guacamole/{extensions,lib}

3. Download and Install Guacamole Frontend Interface on Ubuntu 24.04 (Guacamole Web App)

At this step, you must download and install the Apache Guacamole Web Application. For this purpose, you must install Tomcat. At the current time, Apache Guacamole is compatible with Tomcat 9. Because Tomcat 9 is not available in Ubuntu 24.04, we added the Ubuntu 22.04 repository and then install Tomcat 9 with the commands below:

sudo add-apt-repository -y -s "deb http://archive.ubuntu.com/ubuntu/ jammy main universe"

sudo apt install tomcat9 tomcat9-admin tomcat9-common tomcat9-user -y

Next, use the following command to download the Gucamole web app source code. Just remember that the version of the web app must be the same as the Guacamole version.

sudo wget https://downloads.apache.org/guacamole/1.5.5/binary/guacamole-1.5.5.war

Then, you must move the Guacamole Web client to the Tomcat directory with the command below:

sudo mv guacamole-1.5.5.war /var/lib/tomcat9/webapps/guacamole.war

To apply the changes, restart Apache Guacamole and Tomcat services on Ubuntu 24.04:

sudo systemctl restart tomcat9 guacd

4. Set up Guacamole Database Authentication on Ubuntu 24.04

In this step of installing Apache Guacamole on Ubuntu 24.04, you must configure Guacamole database authentication. By default, Guacamole supports basic user authentication that is used for testing. However, we want to use a production-ready database authentication through MariaDB. To do this, follow the steps below:

First, install MariaDB with the following command:

sudo apt install mariadb-server -y

Then, run the MySQL security script to set a password for your MariaDB:

sudo mysql_secure_installation

Download MySQL Java Connector for Apache Guacamole

Next, you must download the MySQL Java Connector. At the current time, the latest MySQL Java connector is Connector/J 9.1.0. To download the package, run the command below:

sudo wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-j-9.1.0.tar.gz

Now extract your downloaded file and copy it to the /etc/guacamole/lib/ directory with the following commands:

sudo tar -xf mysql-connector-j-9.1.0.tar.gz

sudo cp mysql-connector-j-9.1.0/mysql-connector-j-9.1.0.jar /etc/guacamole/lib/

Download Apache Guacamole JDBC AUTH Plugin

At this point, you must download the Apache Guacamole JDBC AUTH Plugin. Just remember that the version you will download same as the version of the Guacamole.

sudo wget https://downloads.apache.org/guacamole/1.5.5/binary/guacamole-auth-jdbc-1.5.5.tar.gz

Then, extract your downloaded file and copy it to /etc/guacamole/extensions/ directory with the commands below:

sudo tar -xf guacamole-auth-jdbc-1.5.5.tar.gz

sudo mv guacamole-auth-jdbc-1.5.5/mysql/guacamole-auth-jdbc-mysql-1.5.5.jar /etc/guacamole/extensions/

Create Apache Guacamole Database and User

In this step of installing Apache Guacamole on Ubuntu 24.04, you must create a user and database. To do this, log in to your MariaDB shell:

sudo mysql -u root -p

Enter the password you have configured for it. From your MariaDB shell, run the following commands to create a database, user database, and grant the privileges to it:

-- MariaDB [(none)]> CREATE DATABASE guac_db;
-- MariaDB [(none)]> CREATE USER 'guac_user'@'localhost' IDENTIFIED BY 'password';
-- MariaDB [(none)]> GRANT SELECT,INSERT,UPDATE,DELETE ON guac_db.* TO 'guac_user'@'localhost';
-- MariaDB [(none)]> FLUSH PRIVILEGES;

When you are finished, exit from your MariaDB shell:

-- MariaDB [(none)]> EXIT;

Import SQL Schema Files For Guacamole

At this point, you must navigate to the MySQL Schema directory with the command below:

cd guacamole-auth-jdbc-1.5.5/mysql/schema

From there, run the command below to import the SQL schema files to the MySQL database:

cat *.sql | mysql -u root -p guac_db

Enter your MariaDB root password to complete the process.

Create Properties Files For Apache Guacamole

Now use your desired text editor like Vi Editor or Nano Editor to create the properties files for Guacamole:

sudo vi /etc/guacamole/guacamole.properties

Add the following configuration settings to the file with your database credentials:

# MySQL properties
mysql-hostname: 127.0.0.1
mysql-port: 3306
mysql-database: guac_db
mysql-username: guac_user
mysql-password: password

Once you are done, save and close the file.

Finally, restart the services to apply the changes:

sudo systemctl restart tomcat9 guacd mysql

5. Access Apache Guacamole Dashboard via Web Interface

Now that you are finished with Installing Apache Guacamole on Ubuntu 24.04, you can access the Guacamole dashboard by following the URL below from your Web browser:

http://server-ip:8080/guacamole

You must see the Guacamole login screen. Enter the following credentials to log in:

username: guacadmin
password: guacadmin

Change Guacamole Admin Password

At this point, you must change your GuacAdmin password for more security and delete the default credentials. To do this, from the guacadmin profile click on Settings.

Then, switch to the Users tab and click on New User.

Under the Edit User section, enter your new username and password. Then, under the Permissions section check the all boxes. When you are done, click Save.

Now log out from the default user and log in back to Apache Guacamole with your new user created. Then, navigate to the settings, and users tab, and delete the guacadmin user.

That’s it, you are done with Installing Apache Guacamole on Ubuntu 24.04. From there, you can securely access your servers and computers.

Summing Up

As you saw, you can use the step-by-step guide provided by the Orcacore team for installing Apache Guacamole on Ubuntu 24.04. With Guacamole you can securely and easily access your servers and computers via the web interface.

Hope you enjoy using it. Also, you may like to read the following articles:

FAQs

What is Apache Guacamole?

As described on the official website, Apache Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH.

What is Apache guacamole used for?

With Guacamole you can securely and easily access your servers and computers via the web interface.

How to access the Guacamole Login Screen?

As you saw in the guide steps for installing Apache Guacamole on Ubuntu 24.04, you can easily access the login screen with the following URL:
http://server-ip:8080/guacamole

Alternative Solutions for Deploying Apache Guacamole

While the above guide details a method for manually installing and configuring Apache Guacamole on Ubuntu 24.04, there are alternative approaches that can streamline the deployment process. These methods offer different trade-offs in terms of complexity, control, and resource utilization. Here are two such alternatives:

1. Docker Container Deployment

Docker provides a way to containerize applications, packaging them with all their dependencies into a single, portable unit. This significantly simplifies deployment and ensures consistency across different environments. Using Docker for Apache Guacamole eliminates the need to manually install dependencies and configure Tomcat.

Explanation:

Instead of manually installing Tomcat, MariaDB, and the Guacamole components, you can use pre-built Docker images for Guacamole. These images contain everything needed to run Guacamole, including the web application, server components, and any necessary dependencies. You can then link these containers together using Docker Compose to create a complete Guacamole deployment.

Steps:

  1. Install Docker and Docker Compose: If you don’t have them already, install Docker and Docker Compose on your Ubuntu 24.04 server.

    sudo apt update
    sudo apt install docker.io docker-compose -y
  2. Create a Docker Compose file: Create a docker-compose.yml file to define the Guacamole deployment. This file will specify the Guacamole containers and their configurations.

    version: "3.8"
    services:
      guacamole:
        image: guacamole/guacamole
        container_name: guacamole
        ports:
          - "8080:8080"
        environment:
          GUACD_HOSTNAME: guacd
          MYSQL_HOSTNAME: db
          MYSQL_DATABASE: guacdb
          MYSQL_USER: guacuser
          MYSQL_PASSWORD: your_mysql_password
        depends_on:
          - guacd
          - db
        restart: unless-stopped
    
      guacd:
        image: guacamole/guacd
        container_name: guacd
        restart: unless-stopped
    
      db:
        image: mariadb:latest
        container_name: db
        environment:
          MYSQL_ROOT_PASSWORD: your_mysql_root_password
          MYSQL_DATABASE: guacdb
          MYSQL_USER: guacuser
          MYSQL_PASSWORD: your_mysql_password
        volumes:
          - db_data:/var/lib/mysql
        restart: unless-stopped
    
    volumes:
      db_data:

    Note: Replace your_mysql_root_password and your_mysql_password with your desired passwords.

  3. Run Docker Compose: Navigate to the directory containing the docker-compose.yml file and run the following command to start the Guacamole deployment:

    sudo docker-compose up -d

    This command will download the necessary Docker images, create the containers, and start them in detached mode.

  4. Access Guacamole: Once the containers are running, you can access the Guacamole web interface by navigating to http://your_server_ip:8080/guacamole in your web browser.

Advantages:

  • Simplified Deployment: Docker automates the installation and configuration process, reducing the risk of errors.
  • Consistency: Ensures that Guacamole runs in a consistent environment, regardless of the underlying operating system.
  • Isolation: Docker containers isolate Guacamole from other applications, improving security and stability.
  • Easy Upgrades: Upgrading Guacamole is as simple as pulling the latest Docker image and restarting the containers.

Disadvantages:

  • Resource Overhead: Docker containers consume more resources than native applications.
  • Learning Curve: Requires familiarity with Docker and Docker Compose.
  • Debugging Complexity: Debugging issues within Docker containers can be more complex than debugging native applications.

2. Using Ansible for Automated Installation

Ansible is an open-source automation tool that can be used to automate the installation and configuration of software on multiple servers. This method is ideal for managing multiple Guacamole instances or for ensuring consistent deployments across different environments.

Explanation:

Ansible uses playbooks, which are YAML files that define the steps required to perform a task. You can create an Ansible playbook to automate the installation and configuration of Guacamole, including installing dependencies, downloading the source code, building the server components, configuring Tomcat, and setting up database authentication.

Steps:

  1. Install Ansible: If you don’t have it already, install Ansible on your control machine (the machine from which you will run the playbook).

    sudo apt update
    sudo apt install ansible -y
  2. Create an Ansible Playbook: Create an Ansible playbook (e.g., guacamole_install.yml) that defines the steps for installing Guacamole. A simplified example is shown below. A complete playbook would include error handling, variable definitions for passwords, and more robust dependency management.

    ---
    - hosts: all
      become: true
      tasks:
        - name: Update apt cache
          apt:
            update_cache: yes
    
        - name: Install Guacamole dependencies
          apt:
            name:
              - build-essential
              - libcairo2-dev
              - libjpeg-turbo8-dev
              - libpng-dev
              - libtool-bin
              - libossp-uuid-dev
              - libvncserver-dev
              - freerdp2-dev
              - libssh2-1-dev
              - libtelnet-dev
              - libwebsockets-dev
              - libpulse-dev
              - libvorbis-dev
              - libwebp-dev
              - libssl-dev
              - libpango1.0-dev
              - libswscale-dev
              - libavcodec-dev
              - libavutil-dev
              - libavformat-dev
            state: present
    
        - name: Download Guacamole server source
          get_url:
            url: "https://downloads.apache.org/guacamole/1.5.5/source/guacamole-server-1.5.5.tar.gz"
            dest: /tmp/guacamole-server-1.5.5.tar.gz
    
        - name: Extract Guacamole server source
          unarchive:
            src: /tmp/guacamole-server-1.5.5.tar.gz
            dest: /tmp/
            remote_src: yes
    
        - name: Configure, make, and install Guacamole server
          shell: |
            cd /tmp/guacamole-server-1.5.5
            ./configure --with-init-dir=/etc/init.d --enable-allow-freerdp-snapshots
            make
            make install
            ldconfig
    
        - name: Start guacd service
          systemd:
            name: guacd
            state: started
            enabled: yes
    
        - name: Install Tomcat 9
          apt:
            name:
              - tomcat9
              - tomcat9-admin
              - tomcat9-common
              - tomcat9-user
            state: present
    
        - name: Download Guacamole web app
          get_url:
            url: "https://downloads.apache.org/guacamole/1.5.5/binary/guacamole-1.5.5.war"
            dest: /var/lib/tomcat9/webapps/guacamole.war
    
        - name: Restart Tomcat 9 and Guacd
          systemd:
            name: "{{ item }}"
            state: restarted
          loop:
            - tomcat9
            - guacd
  3. Create an Inventory File: Create an inventory file (e.g., hosts) that lists the IP addresses or hostnames of the servers where you want to install Guacamole.

    [guacamole_servers]
    your_server_ip
  4. Run the Playbook: Run the Ansible playbook using the following command:

    ansible-playbook -i hosts guacamole_install.yml

    Replace your_server_ip with the actual IP address of your server.

Advantages:

  • Automation: Automates the entire installation and configuration process.
  • Idempotence: Ansible playbooks are idempotent, meaning that they can be run multiple times without causing unintended changes.
  • Scalability: Can be used to manage multiple Guacamole instances across different servers.
  • Configuration Management: Provides a centralized way to manage Guacamole configurations.

Disadvantages:

  • Learning Curve: Requires familiarity with Ansible and YAML.
  • Complexity: Creating and maintaining Ansible playbooks can be complex, especially for large deployments.
  • Security Considerations: Requires careful consideration of security best practices when managing SSH keys and credentials.

By using Docker or Ansible, you can significantly simplify the deployment process and ensure consistent installations of Apache Guacamole on Ubuntu 24.04. The best choice for you will depend on your specific needs and technical expertise.