How to Install Guacamole on Elementary OS

Guacamole is an open-source remote desktop gateway developed by Apache that allows users to connect to their desktops from anywhere using just a web-browser. In this tutorial, we will show you how to install and configure Guacamole on Elementary OS.

Prerequisites:

Before proceeding, you'll need the following:

Step 1: Update System Packages

Before installing any packages, it's always best to update the current package list available in the system.

sudo apt update
sudo apt upgrade

Step 2: Install Required Dependencies

Guacamole requires several dependencies to be installed on your system. To install them, you can run the following command:

sudo apt install -y libcairo2-dev libjpeg-turbo8-dev libpng-dev libossp-uuid-dev libavcodec-dev libavutil-dev libswscale-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev libvorbis-dev tomcat9 tomcat9-admin tomcat9-common tomcat9-user

During the installation, you'll be prompted to set a password for the Tomcat admin user. Make sure to remember this password as you'll need it later during the configuration process.

Step 3: Install Guacamole Server

Next, let's install the Guacamole server on our system. We'll need to download the Guacamole server package from the official Apache Guacamole website:

cd ~
wget https://downloads.apache.org/guacamole/1.3.0/source/guacamole-server-1.3.0.tar.gz
tar -xzf guacamole-server-1.3.0.tar.gz
cd guacamole-server-1.3.0

Next, we'll compile the source code and install the package:

./configure --with-systemd-dir=/usr/lib/systemd/system
make
sudo make install
sudo ldconfig

Step 4: Configure Guacamole Server

Now that we have installed the Guacamole server, let's configure it. We'll start by creating a symbolic link for the Guacamole library configuration:

sudo ln -s /usr/local/lib/freerdp/guacdr.so /usr/lib/x86_64-linux-gnu/freerdp/

Next, we'll create the necessary Tomcat directories:

sudo mkdir /usr/share/tomcat9/.guacamole
sudo chmod 775 /usr/share/tomcat9/.guacamole
sudo chown tomcat9:tomcat9 /usr/share/tomcat9/.guacamole

We'll then create a new file named guacamole.properties inside the /etc/guacamole/ directory:

sudo nano /etc/guacamole/guacamole.properties

And add the following configuration options:

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

Save the file and exit the editor.

Next, we'll create a new file named user-mapping.xml inside the /etc/guacamole/ directory:

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

And add the following XML configuration:

<user-mapping>
   <authorize username="[USERNAME]" password="[SECRETPASSWORD]">
      <protocol>rdp</protocol>
      <param name="hostname">localhost</param>
      <param name="port">3389</param>
   </authorize>
</user-mapping>

Here, replace [USERNAME] and [SECRETPASSWORD] with your desired username and password.

Save the file and exit the editor.

Step 5: Configure Tomcat

Next, we'll configure Tomcat to use Guacamole. We'll start by editing the GUACAMOLE_HOME environment variable:

sudo nano /etc/default/tomcat9

And add the following line at the end of the file:

GUACAMOLE_HOME=/usr/share/tomcat9/.guacamole

Save the file and exit the editor.

Next, we'll edit the guacamole.war file to add the required configuration options:

cd /var/lib/tomcat9/webapps/
sudo mkdir guacamole
sudo cp guacamole.war guacamole/
sudo cd guacamole
sudo unzip guacamole.war
sudo rm -rf guacamole.war
sudo nano guacamole/WEB-INF/classes/guacamole.properties

And add the following configuration options:

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

Save the file and exit the editor.

Step 6: Restart Services

Finally, let's restart the Apache Tomcat service to apply the changes:

sudo systemctl restart tomcat9

You can now access your Guacamole server by visiting the following URL:

http://[YOUR_SERVER_IP]/guacamole/

Use the username and password that you specified in the guacamole.properties and user-mapping.xml files.

Congratulations, you have successfully installed and configured Guacamole on your Elementary OS system!

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!