How to install Apache Guacamole on Ubuntu and Debian Cloud Servers

2023-02-20 By Nathan 47146 Views linux apache guacamole
14 reviews

Apache Guacamole is an open-source web application that enables users to access their remote desktops or applications from anywhere with an internet connection. It provides this access through a web browser without requiring any special software or plugins.


The project is maintained by the Apache Software Foundation and is released under the Apache License 2.0. Guacamole supports a variety of remote desktop protocols, including VNC, RDP, SSH, and Telnet, allowing users to connect to a wide range of remote machines, including Windows, Linux, and macOS.


In addition to its core functionality, Guacamole also supports plugins, which can be used to add new features and extend its capabilities. There are many third-party plugins available for Guacamole, including ones that provide support for additional protocols, advanced authentication options, and integration with other systems.


Overall, Apache Guacamole is a powerful and flexible tool for providing remote access to desktops and applications, with a strong focus on security and ease of use.


Here are the steps to install Apache guacamole on Ubuntu 20.04.


Step 1: Update server and Install dependencies and repositories


  1. Add the following repository to the Linux server.

    # add-apt-repository ppa:remmina-ppa-team/remmina-next-daily  
    

    apacheguacamole1

  2. Update the Linux server.

    # apt update && apt upgrade -y
    

    apacheguacamole2

  3. Install dependencies for the server.

    # apt install -y gcc vim curl wget g++ libcairo2-dev libjpeg-turbo8-dev libpng-dev libtool-bin libossp-uuid-dev libavcodec-dev  libavformat-dev libavutil-dev libswscale-dev build-essential libpango1.0-dev libssh2-1-dev libvncserver-dev libtelnet-dev libpulse-dev libssl-dev libvorbis-dev libwebp-dev libwebsockets-dev ubuntu-desktop-minimal freerdp2-dev freerdp2-x11 xrdp -y
    

    apacheguacamole3


Step 2: Install Apache Tomcat and Dependencies


  1. Install Java.

    # apt install openjdk-11-jdk
    

    apacheguacamole4

  2. Check the Java version.

    # java --version
    

    apacheguacamole5

  3. Create a new Tomcat system user.

    # useradd -m -U -d /opt/tomcat -s /bin/false tomcat
    

    apacheguacamole6

  4. Download Apache Tomcat.

    # wget https://downloads.apache.org/tomcat/tomcat-9/v9.0.71/bin/apache-tomcat-9.0.71.tar.gz
    

    apacheguacamole7

  5. Extract the tomcat application into the /opt/tomcat/ directory.

    # tar -xzf apache-tomcat-*.tar.gz -C /opt/tomcat/
    

    apacheguacamole8

  6. Rename the directory /opt/tomcat/apache-tomcat- to the directory /opt/tomcat/tomcatapp.

    # mv /opt/tomcat/apache-tomcat-*/ /opt/tomcat/tomcatapp
    

    apacheguacamole9

  7. Change the ownership of the /opt/tomcat directory and all of its contents recursively to the user tomcat and the group tomcat.

    # chown -R tomcat: /opt/tomcat
    

    apacheguacamole10

  8. Find all files with the .sh extension in the /opt/tomcat/tomcatapp/bin/ directory (and its subdirectories), and set their permissions to be executable.

    # find /opt/tomcat/tomcatapp/bin/ -type f -iname "*.sh" -exec chmod +x {} \;
    

    apacheguacamole11

  9. Add the Tomcat systemd file.

    # vim /etc/systemd/system/tomcat.service
    

    apacheguacamole12


    Add the below script to the tomcat.service file:

    [Unit]
    Description=Tomcat 9 servlet container
    After=network.target
    
    [Service]
    Type=forking
    
    User=tomcat
    Group=tomcat
    
    Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
    Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom -Djava.awt.headless=true"
    
    Environment="CATALINA_BASE=/opt/tomcat/tomcatapp"
    Environment="CATALINA_HOME=/opt/tomcat/tomcatapp"
    Environment="CATALINA_PID=/opt/tomcat/tomcatapp/temp/tomcat.pid"
    Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
    
    ExecStart=/opt/tomcat/tomcatapp/bin/startup.sh
    ExecStop=/opt/tomcat/tomcatapp/bin/shutdown.sh
    
    [Install]
    WantedBy=multi-user.target
    

    apacheguacamole13

  10. Reload the daemon.

    # systemctl daemon-reload
    

    apacheguacamole14

  11. Start and enable the Apache Tomcat service.

    # systemctl enable --now tomcat
    

    apacheguacamole15

  12. Check the tomcat.service status.

    # systemctl status tomcat
    

    apacheguacamole16


Step 3 : Installing Apache Guacamole server


  1. Download the Guacamole server.

    # wget https://apache.org/dyn/closer.lua/guacamole/1.4.0/source/guacamole-server-1.4.0.tar.gz
    

    apacheguacamole17

  2. Extract the compressed file.

    # tar -xzf guacamole-server-1.4.0.tar.gz
    

    apacheguacamole50

  3. Change the directory to guacamole-server-1.4.0/.

    # cd guacamole-server-1.4.0/
    

    apacheguacamole19

  4. Execute the ./configure script along with the --with-init-dir=/etc/init.d option, and instruct the configure script to utilize the /etc/init.d directory as the designated location for the system initialization scripts generated during the installation process.

    ./configure --with-init-dir=/etc/init.d
    

    apacheguacamole20

  5. Run the make and make install commands.

    # make && make install
    

    apacheguacamole21

  6. To ensure that the latest shared libraries in the Guacamole server directory are used, execute the ldconfig command, which creates the necessary links and cache.

    # ldconfig
    

    apacheguacamole22

  7. Create a directory in /etc/ for the Apache Guacamole configuration file.

    # mkdir /etc/guacamole
    

    apacheguacamole23

  8. Create a guacd.conf configuration file.

    # vim /etc/guacamole/guacd.conf
    

    apacheguacamole24

  9. Add the below script to the file.

    [daemon]
    pid_file = /var/run/guacd.pid
    #log_level = debug
    
    [server]
    #bind_host = localhost
    bind_host = 127.0.0.1
    bind_port = 4822
    
    #[ssl]
    #server_certificate = /etc/ssl/certs/guacd.crt
    #server_key = /etc/ssl/private/guacd.key
    

    apacheguacamole25

  10. Reload the daemon.

    # systemctl daemon-reload
    

    apacheguacamole26

  11. Start and enable the Apache Guacamole service.

    # systemctl start guacd
    
    # systemctl enable guacd
    

    apacheguacamole27

  12. Check the status of the Guacamole server.

    # systemctl status guacd
    

    apacheguacamole28


Step 4: Installing the Guacamole Web Application


  1. Download the Guacamole web application.

    # wget https://archive.apache.org/dist/guacamole/1.4.0/binary/guacamole-1.4.0.war
    

    apacheguacamole29

  2. Move guacamole-1.5.0.war to a directory named /etc/guacamole/, and rename it to guacamole.war.

    # mv ~/guacamole-1.4.0.war /etc/guacamole/guacamole.war
    

    apacheguacamole30

  3. Create a symbolic link in the /opt/tomcat/tomcatapp/webapps directory called guacamole.war that points to the file /etc/guacamole/guacamole.war.

    # ln -s /etc/guacamole/guacamole.war /opt/tomcat/tomcatapp/webapps
    

    apacheguacamole31

  4. Add a new line to the end of the /etc/default/tomcat file, which sets the environment variable GUACAMOLE_HOME to the directory /etc/guacamole.

    # echo "GUACAMOLE_HOME=/etc/guacamole" | sudo tee -a /etc/default/tomcat
    

    apacheguacamole32

  5. Add a new line to the end of the /etc/profile file, which sets the environment variable GUACAMOLE_HOME to the directory /etc/guacamole.

    # echo "export GUACAMOLE_HOME=/etc/guacamole" | sudo tee -a /etc/profile
    

    apacheguacamole33

  6. Create a /etc/guacamole/guacamole.properties config file.

    # vim /etc/guacamole/guacamole.properties
    

    apacheguacamole34

  7. Add the following to the guacamole.properties config file.

    guacd-hostname: localhost
    guacd-port:  4822
    user-mapping:  /etc/guacamole/user-mapping.xml
    auth-provider:  net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider
    

    apacheguacamole35

  8. Create a symbolic link in the /opt/tomcat/tomcatapp directory called guacamole that points to the directory /etc/guacamole.

    # ln -s /etc/guacamole /opt/tomcat/tomcatapp/.guacamole
    

    apacheguacamole36

  9. Change the ownership of the /opt/tomcat directory and its contents to the user tomcat and the default group of tomcat.

    # chown -R tomcat: /opt/tomcat
    

    apacheguacamole37

  10. Set up Guacamole Authentication using OpenSSL to generate an MD5 hash of the string.


    For example: Here the password we use is layerstackpassword.

    # echo -n layerstackpassword | openssl md5
    

    apacheguacamole38


    Copy the output.

  11. Create the user-mapping.xml file.

    # vim /etc/guacamole/user-mapping.xml
    

    apacheguacamole39 apacheguacamole40


    Add your custom username and copied encrypted password on the marked field.

  12. Restart the Apache Tomcat and Guacamole server.

    # systemctl restart tomcat guacd
    

    apacheguacamole41

  13. Make sure all Tomcat and Guacamole services are running.

    # systemctl status tomcat guacd
    

    apacheguacamole42


Step 5 : Accessing Apache Guacamole through browser


  1. Access webpage http://<server__ip_ address="" or="" domain="" name:8080="" guacamole="" #=""="" through="" web="" browser.="" ![apacheguacamole43](https:="" www.layerstack.com="" img="" docs="" resources="" apacheguacamole43.png)="" 2.="" select="" ubuntu="" rdp.="" ![apacheguacamole44](https:="" apacheguacamole44.png)="" 3.="" use="" the="" server="" root="" password="" to="" log="" in.="" ![apacheguacamole45](https:="" apacheguacamole45.png)="" <br="">

    Desktop Screen:

    apacheguacamole46

  2. Likewise use Ubuntu SSH to log in to the server through SSH.

    apacheguacamole47


    Use root password to proceed:

    apacheguacamole48


    SSH Terminal:

    apacheguacamole49


What do you think about this article?

Rate this article
LayerStack Promotion
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.