Tag Archives: Guacamole

Installing Guacamole 0.9.13 from source on Debian Stretch and Tomcat 8

Install build tools:

# apt install build-essential maven checkinstall

Install JDK, database and application server:

# apt install openjdk-8-jdk mariadb-server \
mariadb-client mariadb-common tomcat8

Secure your mysql/mariadb installation:

# mysql_secure_installation

Take note of the mysql root password you just created.

Install Guacamole build dependencies:

# apt install libcairo2-dev libjpeg62-turbo-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 libwebp-dev ghostscript freerdp

Untar the sources:

$ tar -xvzf guacamole-client-0.9.13-incubating.tar.gz
$ tar -xvzf guacamole-server-0.9.13-incubating.tar.gz

Untar the database related parts:

$ tar -xvzf guacamole-auth-jdbc-0.9.13-incubating.tar.gz
$ tar -xvzf mysql-connector-java-5.1.45.tar.gz

Build Guacamole Server

$ cd guacamole-server-0.9.13-incubating
$ ./configure --with-init-dir=/etc/init.d
$ make -j2
$ sudo make install

– or –

$ sudo checkinstall --pkgname=guacamole-guacd -D make install

If using checkinstall should get an output similar to this:

####################################################

*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values:

0 – Maintainer: [ root@vm ]
1 – Summary: [ Guacamole Guacd ]
2 – Name: [ guacamole-guacd ]
3 – Version: [ incubating ]
4 – Release: [ 1 ]
5 – License: [ GPL ]
6 – Group: [ checkinstall ]
7 – Architecture: [ amd64 ]
8 – Source location: [ guacamole-server-0.9.13-incubating ]
9 – Alternate source location: [ ]
10 – Requires: [ ]
11 – Provides: [ guacamole-guacd ]
12 – Conflicts: [ ]
13 – Replaces: [ ]

Enter a number to change any of them or press ENTER to continue:

####################################################

Enter the number [3] to change the Version from “incubating” to 0.9.13

You should end up with something like this:

####################################################

This package will be built according to these values:

0 – Maintainer: [ root@vm ]
1 – Summary: [ Guacamole Guacd ]
2 – Name: [ guacamole-guacd ]
3 – Version: [ 0.9.13 ]
4 – Release: [ 1 ]
5 – License: [ GPL ]
6 – Group: [ checkinstall ]
7 – Architecture: [ amd64 ]
8 – Source location: [ guacamole-server-0.9.13-incubating ]
9 – Alternate source location: [ ]
10 – Requires: [ ]
11 – Provides: [ guacamole-guacd ]
12 – Conflicts: [ ]
13 – Replaces: [ ]

Enter a number to change any of them or press ENTER to continue:

####################################################

Press [Enter] to continue and wait for checkinstall to install and build a package

If you ever need to remove the guacamole and you used checkinstall you can do it with:

# dpkg -r guacamole-guacd

Link all the freerdp libraries to the system freerdp library location:

$ sudo ln -s /usr/local/lib/freerdp/* /usr/lib/x86_64-linux-gnu/freerdp/.

Run ldconfig:

# ldconfig -v

Build Guacamole Client:

$ cd ..
$ cd guacamole-client-0.9.13-incubating
$ mvn package

Create the directories to hold extensions and libraries:

# mkdir /etc/guacamole
# mkdir /etc/guacamole/lib
# mkdir /etc/guacamole/extensions
# mkdir /var/lib/guacamole

Deploying the Guacamole:

$ sudo cp guacamole/target/guacamole-0.9.13-incubating.war /var/lib/guacamole/
$ sudo ln -s /var/lib/guacamole/guacamole-0.9.13-incubating.war /var/lib/tomcat8/webapps/guacamole.war

Creating the properties file:

In /etc/guacamole create a file called guacamole.properties with the following content:

####################################################
# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port: 4822

guacamole.home: /etc/guacamole

#MySQL Properties
mysql-hostname: localhost
mysql-port: 3306
mysql-database: guacamole_db
mysql-username: [Guacamole_DB_USERNAME]
mysql-password: [Guacamole_DB PASSWORD]
####################################################

Make sure you take note of the [Guacamole_DB_USERNAME] and [Guacamole_DB PASSWORD] you decide to put in this file. They will be used later on to set up the database.

Link /etc/guacamole to tomcat home directory:

$ sudo ln -s /etc/guacamole /var/lib/tomcat8/.guacamole

Deploy database authentication:

$ cd ..
$ cd guacamole-auth-jdbc-0.9.13-incubating
$ sudo cp mysql/guacamole-auth-jdbc-mysql-0.9.13-incubating.jar /etc/guacamole/extensions/
$ cd ..
$ cd mysql-connector-java-5.1.45
$ sudo cp mysql-connector-java-5.1.45-bin.jar /etc/guacamole/lib/

Create the database:

# mysql -u root -p[MYSQL_ROOT_PASSWORD]
create database guacamole_db;
create user '[Guacamole_DB_USERNAME]'@'localhost' identified by '[Guacamole_DB PASSWORD]';
GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO '[Guacamole_DB_USERNAME]'@'localhost';
flush privileges;
quit

Populate the database:

# cat guacamole-auth-jdbc-0.9.13-incubating/mysql/schema/*.sql | mysql -u root -p[MYSQL_ROOT_PASSWORD] guacamole_db

Ensure that guacd is enabled:

# systemctl enable guacd

and finally reboot…

If you ever need to backup the database:

# mysqldump -u root -p --add-drop-table guacamole_db > guacamole_db.sql

To restore the backup:

# mysql -u root -p guacamole_db < guacamole_db.sql

To further lockdown the installation

Fix permisions of guacamole.properties so only tomcat can read it by issuing the following:

# cd /etc/guacamole
# chown root:tomcat8
# chmod 640 guacamole.properties