How to Install Guacamole on Debian 12

|
Last Updated:
|
|

This guide will take you through the steps you can use to install Guacamole on Debian 12. Apache Guacamole is a client-less HTML5 web based remote desktop gateway which provides remote access to servers and desktops through a web browser. It supports standard protocols like VNC, RDP, and SSH.

Install Guacamole on Debian 12

Guacamole is made up of two parts;

  • guacamole-server, which provides the guacd proxy and all the native, server-side components required by Guacamole to connect to remote desktops.
  • guacamole-client which provides the client to be served by the servlet container which is usually Tomcat.

You need to install both of these components to setup Apache Guacamole web-based remote desktop client.

Install Guacamole Server on Debian 12

Run system Update

Ensure your system package cache is up-to-date;

apt update

Install Required Build Tools

To install guacamole-server, you need to build it from the source. This, therefore, requires that you need install the required build tools before you can start to build guacamole-server component;


apt install -y build-essential \
	libcairo2-dev \
	libjpeg62-turbo-dev \
	libpng-dev \
	libtool-bin \
	libossp-uuid-dev \
	libavutil-dev \
	libswscale-dev \
        freerdp2-dev \
	libpango1.0-dev \
	libssh2-1-dev \
	libvncserver-dev \
	libtelnet-dev \
	libwebsockets-dev \
	libssl-dev \
	libvorbis-dev \
	libwebp-dev \
	libpulse-dev \
        sudo \
        vim

A comprehensive description of these dependency tools is available on required dependencies section.

Download Guacamole Source Code Tarball

To install Guacamole on Debian 12, we will build it from the source code. Hence download the latest source archive tarball from Guacamole releases page.

Apache Guacamole 1.5.3 is the latest release version as of this writing.

You can simply run the command below to download Apache Guacamole 1.5.3.

To make this easy, just set a variable for the current stable release version on the terminal.

VER=1.5.3
wget https://downloads.apache.org/guacamole/$VER/source/guacamole-server-$VER.tar.gz

Once the download is done, extract the source tarball.

tar xzf guacamole-server-$VER.tar.gz

Install Apache Guacamole on Debian 12

Navigate to guacamole server source code directory;

cd guacamole-server-$VER

Run the configure script to check if any required dependency is missing and to adapt Guacamole server to your system.

./configure --with-systemd-dir=/etc/systemd/system/

For more configure options, run, ./configure --help.


...
------------------------------------------------
guacamole-server version 1.5.3
------------------------------------------------

   Library status:

     freerdp2 ............ yes
     pango ............... yes
     libavcodec .......... no
     libavformat.......... no
     libavutil ........... yes
     libssh2 ............. yes
     libssl .............. yes
     libswscale .......... yes
     libtelnet ........... yes
     libVNCServer ........ yes
     libvorbis ........... yes
     libpulse ............ yes
     libwebsockets ....... yes
     libwebp ............. yes
     wsock32 ............. no

   Protocol support:

      Kubernetes .... yes
      RDP ........... yes
      SSH ........... yes
      Telnet ........ yes
      VNC ........... yes

   Services / tools:

      guacd ...... yes
      guacenc .... no
      guaclog .... yes

   FreeRDP plugins: /usr/lib/x86_64-linux-gnu/freerdp2
   Init scripts: no
   Systemd units: /etc/systemd/system/

Type "make" to compile guacamole-server.

Pay attention to out of the configure script. If there is any unmet required dependency, fix before you can proceed.

Compile and install Guacamole Server on Debian 12;

make
make install

Next, run the ldconfig command to create the necessary links and cache to the most recent shared libraries found in the guacamole server directory.

ldconfig

Running Guacamole-Server on Debian 12

Reload systemd configuration files and start and enable guacd (Guacamole Daemon) to run on boot after the installation.

systemctl daemon-reload
systemctl enable --now guacd

To check the status;

systemctl status guacd

● guacd.service - Guacamole Server
     Loaded: loaded (/etc/systemd/system/guacd.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-08-15 14:28:10 EDT; 11s ago
       Docs: man:guacd(8)
   Main PID: 18903 (guacd)
      Tasks: 1 (limit: 2307)
     Memory: 10.3M
        CPU: 14ms
     CGroup: /system.slice/guacd.service
             └─18903 /usr/local/sbin/guacd -f

Aug 15 14:28:10 debian systemd[1]: Started guacd.service - Guacamole Server.
Aug 15 14:28:10 debian guacd[18903]: Guacamole proxy daemon (guacd) version 1.5.3 started
Aug 15 14:28:10 debian guacd[18903]: guacd[18903]: INFO:        Guacamole proxy daemon (guacd) version 1.5.3 started
Aug 15 14:28:10 debian guacd[18903]: Listening on host ::1, port 4822
Aug 15 14:28:10 debian guacd[18903]: guacd[18903]: INFO:        Listening on host ::1, port 4822

If you noticed, guacd is listening on IPv6 localhost address (Listening on host ::1, port 4822). This is probably because your hosts file is like;

cat /etc/hosts

127.0.0.1	localhost
127.0.1.1	debian

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

See the line above! If you proceed with this in place, you will end up not being able to connect to your remote end points with such an error;

tomcat9[28149]: 15:47:52.938 [http-nio-8080-exec-5] ERROR o.a.g.s.GuacamoleHTTPTunnelServlet - HTTP tunnel request failed: java.net.ConnectException: Connection refused

Thus, comment out the IPv6 line on hosts file;

sed -i '/^::1/s/^/#/g' /etc/hosts

Restart Guacamole server;

systemctl restart guacd

Confirm status;

systemctl status guacd

● guacd.service - Guacamole Server
     Loaded: loaded (/etc/systemd/system/guacd.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-08-15 15:54:42 EDT; 4s ago
       Docs: man:guacd(8)
   Main PID: 28272 (guacd)
      Tasks: 1 (limit: 2307)
     Memory: 10.0M
        CPU: 15ms
     CGroup: /system.slice/guacd.service
             └─28272 /usr/local/sbin/guacd -f

Aug 15 15:54:42 debian systemd[1]: Started guacd.service - Guacamole Server.
Aug 15 15:54:42 debian guacd[28272]: Guacamole proxy daemon (guacd) version 1.5.3 started
Aug 15 15:54:42 debian guacd[28272]: guacd[28272]: INFO:        Guacamole proxy daemon (guacd) version 1.5.3 started
Aug 15 15:54:42 debian guacd[28272]: Listening on host 127.0.0.1, port 4822
Aug 15 15:54:42 debian guacd[28272]: guacd[28272]: INFO:        Listening on host 127.0.0.1, port 4822
ss -altnp | grep :4822
LISTEN 0      5          127.0.0.1:4822      0.0.0.0:*    users:(("guacd",pid=28272,fd=4))

Install Tomcat Servlet

Apache Tomcat is used to serve guacamole client content to users that connects to guacamole server via the web browser. To install Tomcat 9 on Debian 12, you can build it from archive or install from the Debian 11 repos. This is because, Debian 12 ships with Tomcat 10 by default. Guacamole doesn’t support Tomcat 10 yet.

Install Tomcat 9 on Debian 12 by Building from Archive

Follow the link below to learn how to install Tomcat 9 on Debian 12 by building from Tomcat archive.

How to Install Tomcat 9 on Debian 12

Install Tomcat 9 on Debian 12 from Debian 11 repos

Install the Debian 11 repos temporarily as follows;

echo "deb http://deb.debian.org/debian/ bullseye main" > cat /etc/apt/sources.list.d/bullseye.list 

Then install Tomcat9;

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

Remove the Debian 11 repos;

sed -i 's/^/#/' /etc/apt/sources.list.d/bullseye.list 

Tomcat9 is started and enabled to run on system boot upon installation. Check the status by running the command below;

systemctl status tomcat9.service

● tomcat9.service - Apache Tomcat 9 Web Application Server
     Loaded: loaded (/lib/systemd/system/tomcat9.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-08-15 15:31:14 EDT; 3min 16s ago
       Docs: https://tomcat.apache.org/tomcat-9.0-doc/index.html
    Process: 27898 ExecStartPre=/usr/libexec/tomcat9/tomcat-update-policy.sh (code=exited, status=0/SUCCESS)
   Main PID: 27902 (java)
      Tasks: 30 (limit: 2307)
     Memory: 85.5M
        CPU: 6.003s
     CGroup: /system.slice/tomcat9.service
             └─27902 /usr/lib/jvm/default-java/bin/java -Djava.util.logging.config.file=/var/lib/tomcat9/conf/logging.properties -Djava.util.logging.manager=org.apache.jul>

Aug 15 15:31:18 debian tomcat9[27902]: Deployment of deployment descriptor [/etc/tomcat9/Catalina/localhost/manager.xml] has finished in [1,882] ms
Aug 15 15:31:18 debian tomcat9[27902]: Deploying deployment descriptor [/etc/tomcat9/Catalina/localhost/host-manager.xml]
Aug 15 15:31:18 debian tomcat9[27902]: The path attribute with value [/host-manager] in deployment descriptor [/etc/tomcat9/Catalina/localhost/host-manager.xml] has been i>
Aug 15 15:31:19 debian tomcat9[27902]: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that w>
Aug 15 15:31:19 debian tomcat9[27902]: Deployment of deployment descriptor [/etc/tomcat9/Catalina/localhost/host-manager.xml] has finished in [940] ms
Aug 15 15:31:19 debian tomcat9[27902]: Deploying web application directory [/var/lib/tomcat9/webapps/ROOT]
Aug 15 15:31:20 debian tomcat9[27902]: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that w>
Aug 15 15:31:20 debian tomcat9[27902]: Deployment of web application directory [/var/lib/tomcat9/webapps/ROOT] has finished in [967] ms
Aug 15 15:31:20 debian tomcat9[27902]: Starting ProtocolHandler ["http-nio-8080"]
Aug 15 15:31:20 debian tomcat9[27902]: Server startup in [3948] milliseconds

Apache Tomcat listens on port 8080/tcp by default;

ss -altnp | grep :8080
LISTEN 0      100                *:8080            *:*    users:(("java",pid=22439,fd=37))

To allow external access to the serverlet, open the serverlet port 8080/tcp on UFW, if at all UFW is installed and enabled.

ufw allow 8080/tcp

Install Guacamole Client on Debian 12

guacamole-client contains provides web application that will serve the HTML5 Guacamole client to users that connect to your server. The web application will then connect to guacd on behalf of connected users in order to serve them any remote desktop they are authorized to access.

Download and Install Guacamole-client Binary

Create Guacamole configuration directory;

mkdir /etc/guacamole

Guacamole client can be installed from source code or from ready binary. Binary installation is used in this demo.

Download Guacamole-client from Guacamole releases page for the respective latest version (v1.5.3 as of this writing) and store it in the configuration directory created above.

To download the current release version, v1.5.3 as of this writing, simply run the command below;

Similarly, we use the same client version variable;

VER=1.5.3
wget \
https://downloads.apache.org/guacamole/$VER/binary/guacamole-$VER.war \
-O /etc/guacamole/guacamole.war

Create a symbolic link of the guacamole client to Tomcat webapps directory as shown below;

ln -s /etc/guacamole/guacamole.war /var/lib/tomcat9/webapps/

If you build Tomcat from Tomcat archive, then;

ln -s /etc/guacamole/guacamole.war /opt/tomcat9/webapps/

Restart Tomcat and Guacamole server to deploy the new web application;

systemctl restart tomcat9 guacd

Configure Apache Guacamole on Debian 12

Guacamole has two major configuration files;

  • /etc/guacamole which is referenced by the GUACAMOLE_HOME environment variable
  • /etc/guacamole/guacamole.properties which is the main configuration file used by Guacamole and its extensions.

There are also guacamole extensions and libraries configurations. You need to create the directories for these configs;

mkdir /etc/guacamole/{extensions,lib}

Set the guacamole home directory environment variable and add it to /etc/default/tomcat9 configuration file.

echo "GUACAMOLE_HOME=/etc/guacamole" >> /etc/default/tomcat9

If you build Tomcat from Tomcat archive, then;

echo "GUACAMOLE_HOME=/etc/guacamole" >> /etc/profile.d/tomcat9.sh

Configure Guacamole Server Connections

To define how Guacamole connects to guacd, create the guacamole.properties file under /etc/guacamole directory with the following content.


cat > /etc/guacamole/guacamole.properties << EOL
guacd-hostname: 127.0.0.1
guacd-port: 4822
user-mapping:   /etc/guacamole/user-mapping.xml
auth-provider:  net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider
EOL

The configuration above is explained below;

  1. guacd-hostname: localhost: This line sets the hostname of the Guacamole daemon (guacd) to “localhost.” The Guacamole daemon is responsible for handling remote desktop connections.
  2. guacd-port: 4822: This line specifies the port number (4822) on which the Guacamole daemon (guacd) is listening for connections.
  3. user-mapping: /etc/guacamole/user-mapping.xml: This line specifies the path to the user mapping configuration file (user-mapping.xml). This file defines how users are authenticated and which remote desktop connections they can access.
  4. auth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider: This line sets the authentication provider to be used for user authentication. In this case, the BasicFileAuthenticationProvider is used, which means authentication will be based on user credentials defined in the user-mapping.xml file.

Next, link the Guacamole configurations directory to Tomcat servlet directory as shown below.

ln -s /etc/guacamole /usr/share/tomcat9/.guacamole

Similarly, if you build Tomcat from Tomcat archive, then;

ln -s /etc/guacamole /opt/tomcat9/.guacamole

Configure Guacamole Authentication Method

There are different authentication methods supported by Guacamole;

  • Reading credentials from XML file (default).
  • Database authentication
  • LDAP authentication
  • Retrieving secrets from a vault
  • Duo two-factor authentication
  • TOTP two-factor authentication
  • HTTP header authentication
  • Encrypted JSON authentication
  • CAS Authentication
  • OpenID Connect Authentication
  • SAML Authentication
  • RADIUS Authentication

Guacamole’s default authentication method reads all users and connections from a single file called user-mapping.xml. We enabled basic authentication in the configuration above.

In this file,you need to define the users allowed to access Guacamole web UI, the servers to connect to and the method of connection.

NOTE: Storing sensitive information like passwords or connection details in plain text within the user-mapping.xml file can be a security risk, especially if the file is accessible to unauthorized users. If you are using Guacamole Over Internet, I recommend that you avoid the use of user-mapping.xml file for storing credentials. Also, ensure that HTTPS is implemented. Security starts from you!

You can choose to use other authentication methods below;

For the purposes of local testing, we will be using this method, however!

To begin with, generate the MD5 hash of passwords for the user to be used for logging into Guacamole web user interface.

Replace your password, <password>, accordingly;

echo -n <password> | openssl md5

For example, where password is my password.

echo -n password | openssl md5

Output;

MD5(stdin)= 5f4dcc3b5aa765d61d8327deb882cf99

or

printf '%s' password | md5sum

Output;

5f4dcc3b5aa765d61d8327deb882cf99  -

Be sure to replace password with your strong password.

Next, create the default user authentication file, user-mapping.xml with the following contents.

vim /etc/guacamole/user-mapping.xml

<user-mapping>
        
    <!-- Per-user authentication and config information -->

    <!-- A user using md5 to hash the password
         guacadmin user and its md5 hashed password below is used to 
             login to Guacamole Web UI-->
    <authorize 
            username="guacadmin"
            password="5f4dcc3b5aa765d61d8327deb882cf99"
            encoding="md5">

        <!-- First authorized Remote connection -->
        <connection name="Ubuntu 22">
            <protocol>ssh</protocol>
            <param name="hostname">192.168.58.37</param>
            <param name="port">22</param>
        </connection>

        <!-- Second authorized remote connection -->
        <connection name="Windows 10">
            <protocol>rdp</protocol>
            <param name="hostname">192.168.56.121</param>
            <param name="port">3389</param>
            <param name="username">kifarunix</param>
            <param name="ignore-cert">true</param>
        </connection>

    </authorize>

</user-mapping>

If you don’t specify the username and password in the file, you will be prompted to provide them while attempting to login, which I consider it a bit secure.

If you need to explicitly define usernames and passwords in the configuration file, add the parameters;

<param name="username">USERNAME</param>
<param name="password">PASSWORD</param>

Save and exit the configuration file.

Restart both Tomcat and guacd to effect the changes.

systemctl restart tomcat9 guacd

Be sure to check the syslog, /var/log/syslog or /var/log/tomcat9/ log files for any issues.

Accessing Apache Guacamole from Browser

Apache Guacamole server is now setup. You can access it from web browser using the address http://server-IP:8080/guacamole.

Install Guacamole on Debian 12

Use the credentials for the user whom you generated an MD5 hash for its password above.

Upon successful login, you get to Apache Guacamole web dashboard and you should be able to see the added connections.

How to Install Guacamole on Debian 12

Click on a connection to name to initiate remote login.

For example, to ssh into Ubuntu 22 server, just click on the connection name. This will get you a login prompt;

remote server via guacamole

To login to Windows 10 via RDP, just click on Windows 10, enter the login credentials and proceed to the desktop.

Install Guacamole on Debian 12

Setup Apache Guacamole with HTTPS

Follow the guide below to learn how to configure Apache Guacamole with HTTPS;

Configure Guacamole SSL/TLS with Nginx Reverse Proxy

How to fix RDP server closed/refused connection: Security negotiation failed (wrong security type?)

If you encounter CONNECTION ERROR, and upon checking the logs;

journalctl -f -u guacd

Aug 15 16:31:53 debian guacd[28423]: Loading keymap "en-us-qwerty"
Aug 15 16:31:53 debian guacd[28423]: guacd[28423]: INFO:        Loading keymap "en-us-qwerty"
Aug 15 16:31:53 debian guacd[28423]: RDP server closed/refused connection: Security negotiation failed (wrong security type?)
Aug 15 16:31:53 debian guacd[28423]: guacd[28423]: INFO:        RDP server closed/refused connection: Security negotiation failed (wrong security type?)
Aug 15 16:31:53 debian guacd[28423]: guacd[28423]: INFO:        User "@7de1f381-34cf-4e08-8df0-66a5048c6f65" disconnected (0 users remain)
Aug 15 16:31:53 debian guacd[28423]: guacd[28423]: INFO:        Last user of connection "$c9f11e3a-cc25-40c9-b6d2-c015773f7262" disconnected
Aug 15 16:31:53 debian guacd[28423]: User "@7de1f381-34cf-4e08-8df0-66a5048c6f65" disconnected (0 users remain)
Aug 15 16:31:53 debian guacd[28423]: Last user of connection "$c9f11e3a-cc25-40c9-b6d2-c015773f7262" disconnected
Aug 15 16:31:53 debian guacd[28360]: Connection "$c9f11e3a-cc25-40c9-b6d2-c015773f7262" removed.
Aug 15 16:31:53 debian guacd[28360]: guacd[28360]: INFO:        Connection "$c9f11e3a-cc25-40c9-b6d2-c015773f7262" removed.
Aug 15 16:31:53 debian guacd[28423]: RDP server closed/refused connection: Security negotiation failed (wrong security type?)

Then fix it as follows;

Guacamole server (guacd) service runs as user daemon by default.

ps aux | grep -v grep| grep guacd
daemon     28360  0.0  0.7 247892 15548 ?        Ss   16:29   0:00 /usr/local/sbin/guacd -f

Create a guacd system user account which can be used to run guacd instead of running as daemon user.

useradd -M -d /var/lib/guacd/ -r -s /sbin/nologin -c "Guacd User" guacd
mkdir /var/lib/guacd
chown -R guacd: /var/lib/guacd

Next, update the Guacd service user;

sed -i 's/daemon/guacd/' /etc/systemd/system/guacd.service

Reload systemd daemon;

systemctl daemon-reload

Restart Guacd Service;

systemctl restart guacd

At this point, RDP should work without any issues.

You can now add more connections to your Guacamole. Check Guacamole connections page on how to configure. That marks the end of our guide on how to install Guacamole on Debian 12.

Related guides;

Install Apache Guacamole on Rocky Linux 8

Setup Apache Guacamole OpenLDAP Authentication

Configure Guacamole SSL/TLS with Nginx Reverse Proxy

How to Enable RDP/SSH File Transfer Over Guacamole

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
Kifarunix
Linux Certified Engineer, with a passion for open-source technology and a strong understanding of Linux systems. With experience in system administration, troubleshooting, and automation, I am skilled in maintaining and optimizing Linux infrastructure.

5 thoughts on “How to Install Guacamole on Debian 12”

  1. Hello, i have an error when running “make” after “configure”, see below
    video.c: In function ‘guacenc_video_alloc’:
    video.c:63:22: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    63 | container_format = container_format_context->oformat;
    | ^
    video.c:66:22: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    66 | AVCodec* codec = avcodec_find_encoder_by_name(codec_name);
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make[2]: *** [Makefile:1126 : guacenc-video.o] Erreur 1
    make[2] : on quitte le répertoire « /home/phil/guacamole-server-1.5.3/src/guacenc »
    make[1]: *** [Makefile:544 : all-recursive] Erreur 1
    make[1] : on quitte le répertoire « /home/phil/guacamole-server-1.5.3 »
    make: *** [Makefile:464 : all] Erreur 2

    make install run with error as well :
    Making install in src/libguac
    make[1] : on entre dans le répertoire « /home/phil/guacamole-server-1.5.3/src/libguac »
    Making install in .
    make[2] : on entre dans le répertoire « /home/phil/guacamole-server-1.5.3/src/libguac »
    make[3] : on entre dans le répertoire « /home/phil/guacamole-server-1.5.3/src/libguac »
    /usr/bin/mkdir -p ‘/usr/local/lib’
    /bin/bash ../../libtool –mode=install /usr/bin/install -c libguac.la ‘/usr/local/lib’
    libtool: install: /usr/bin/install -c .libs/libguac.so.21.1.0 /usr/local/lib/libguac.so.21.1.0
    /usr/bin/install: cannot create regular file ‘/usr/local/lib/libguac.so.21.1.0’: Permission denied
    make[3]: *** [Makefile:623 : install-libLTLIBRARIES] Erreur 1
    make[3] : on quitte le répertoire « /home/phil/guacamole-server-1.5.3/src/libguac »
    make[2]: *** [Makefile:1141 : install-am] Erreur 2
    make[2] : on quitte le répertoire « /home/phil/guacamole-server-1.5.3/src/libguac »
    make[1]: *** [Makefile:978 : install-recursive] Erreur 1
    make[1] : on quitte le répertoire « /home/phil/guacamole-server-1.5.3/src/libguac »
    make: *** [Makefile:544 : install-recursive] Erreur 1

    and “ldconfig” command not found !

    Can you help (i am on Debian 12) ?

    Reply

Leave a Comment