LinuxTutorialsUbuntu

How To Install Apache Guacamole on Ubuntu 20.04 LTS

Install Apache Guacamole on Ubuntu 20.04

In this tutorial, we will show you how to install Apache Guacamole on Ubuntu 20.04 LTS. For those of you who didn’t know, Guacamole is a free, open-source HTML5 web-based remote desktop gateway developed by the Apache software foundation. It supports standard protocols like VNC, RDP, and SSH.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Apache Guacamole on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, you can harm your system if you’re not careful when acting as the root.

Install Apache Guacamole on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade
sudo apt install make gcc g++ libcairo2-dev libjpeg-turbo8-dev libpng-dev libtool-bin libossp-uuid-dev libavcodec-dev libavutil-dev libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libvncserver-dev libtelnet-dev libssl-dev libvorbis-dev libwebp-dev

Step 2. Installing Apache Tomcat.

Apache Tomcat is used to serve guacamole client content to users that connect to the guacamole server via the web browser. To install Tomcat, run the following command:

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

Once installed Tomcat, the commands below can be used to start and enable it so that it automatically startup when you boot up the machine:

sudo systemctl start tomcat9
sudo systemctl enable tomcat9

For additional resources on installing Apache Tomcat, read the post below:

Step 3. Installing Apache Guacamole on Ubuntu 20.04.

Now we run the commands to download Guacamole from the official website:

wget https://downloads.apache.org/guacamole/1.3.0/source/guacamole-server-1.3.0.tar.gz
tar -xvzf guacamole-server-1.3.0.tar.gz

Next, change into the extracted folder and run the following commands to check that all requirements are met:

cd guacamole-server-1.3.0
sudo ./configure --with-init-dir=/etc/init.d

After that, run the commands below to begin the installation:

sudo make
sudo make install
sudo ldconfig

Once installed Guacamole, the commands below can be used to start and enable it so that it automatically startup when you boot up the machine:

sudo systemctl enable guacd
sudo systemctl start guacd

Step 4. Installing Guacamole Client.

Now we run the commands below to download the Guacamole client:

wget https://mirrors.estointernet.in/apache/guacamole/1.3.0/binary/guacamole-1.3.0.war

Next, copy it to the /etc/guacamole directory:

sudo mkdir /etc/guacamole
sudo mv guacamole-1.3.0.war /etc/guacamole/guacamole.war

Then, run the commands below to create a symbolic link of guacamole client to Tomcat web apps directory:

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

Restart Tomcat and Guacamole services:

sudo systemctl restart tomcat9
sudo systemctl restart guacd

Step 5. Configure Apache Guacamole.

After the installation of the Guacamole server daemon, you need to define how to Guacamole client will connect to the Guacamole server under the /etc/guacamole/guacamole.properties configuration file:

sudo nano /etc/guacamole/guacamole.properties

Add these lines:

guacd-hostname: localhost
guacd-port: 4822
user-mapping: /etc/guacamole/user-mapping.xml

Next, run the commands below to create two directories for libraries and extensions:

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

After that, set the Guacamole home directory environment variable in /etc/default/tomcat9 configuration file:

sudo sh -c "echo 'GUACAMOLE_HOME=/etc/guacamole' >> /etc/default/tomcat9"

You’ll need a password hash for the user-mapping configuration. To generate a password, use the commands below:

echo -n your_strong_password_here | openssl md5

That should put a password hash. Copy the hash value to use in the config below:

(stdin)= 36160e235d67eb081741004798ee37a8d

Next, run the commands below to create a new user-mapping.xml:

sudo nano /etc/guacamole/user-mapping.xml

Then, copy and paste the content below into the file and save it:

<user-mapping>
    <authorize 
            username="admin"
            password="36160e235d67eb081741004798ee37a8d"
            encoding="md5">

        <connection name="Ubuntu20.04-Server">
            <protocol>ssh</protocol>
            <param name="hostname">192.168.1.2</param>
            <param name="port">22</param>
            <param name="username">root</param>
        </connection>
        <connection name="Windows Server">
            <protocol>rdp</protocol>
            <param name="hostname">192.168.2.3</param>
            <param name="port">3389</param>
        </connection>
    </authorize>
</user-mapping>

Step 5. Accessing Apache Guacamole.

Once Guacamole is set up, you can access it from the web browser using the address http://localhost:8080/guacamole. You should then see the Apache Guacamole portal to log in:

Install Apache Guacamole on Ubuntu 20.04

Congratulations! You have successfully installed Apache Guacamole. Thanks for using this tutorial for installing the Apache Guacamole on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Apache Guacamole website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button