Apache Guacamole 1.1.0 Install Guide

Updated: Apr 4



The Apache Software Foundation released Guacamole v1.1.0 on 29 January 2020. In this guide we will be building a Guacamole instance on CentOS 7. We have also posted a video on Youtube that follows this guide.




 

Prerequisites:

CentOS 7 (we are using a “minimal install” but any installation should work)

 

This guide is written assuming that you are logged in as root. You can do this from a non root account with sudo privileges, but sudo will need to be placed before each command.


1. Once we have a installed CentOS 7, we are going to set the hostname, update the OS and other packages, and enable the Enterprise Linux Repositories (EPEL):


hostnamectl set-hostname guac
yum install -y  epel-release
yum update -y

2. Guacamole requires ffmpeg-devel, and that package is not included with the base CentOS or EPEL repositories so we will need to enable/install a repository that includes ffmpeg-devel and its dependencies. For this tutorial we will be using RPM Fusion but other 3rd party repositories that have the necessary packages will work as well. Use this command to install RPM Fusion:

yum -y localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm

3. Next we need to download and install several dependencies:

yum install -y cairo-devel libjpeg-turbo-devel libwebsockets-devel libpng-devel uuid-devel ffmpeg-devel freerdp-devel pango-devel libssh2-devel libvncserver-devel pulseaudio-libs-devel openssl-devel libvorbis-devel libwebp-devel libtool libtelnet-devel freerdp mariadb-server wget tomcat

4. Now download and extract the Guacamole server source code (.tar.gz) and download the Guacamole Web Application (.war)

wget https://downloads.apache.org/guacamole/1.1.0/source/guacamole-server-1.1.0.tar.gz
tar -xzf guacamole-server-1.1.0.tar.gz
wget https://downloads.apache.org/guacamole/1.1.0/binary/guacamole-1.1.0.war

5. Once the source code is downloaded and extracted, we need to prep it for compiling and installation.

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

If the required dependencies from the previous steps were installed correctly, all of the libraries, protocols, and services/tools should say yes except for wsock32. If you see any “no” items, go back to step 3 and verify all of the packages installed correctly.


6. We can now run make/install.

make install
ldconfig && cd ~

7. We need to enable tomcat, mariadb, and guacd to start each time our system starts or reboots.

systemctl enable tomcat && systemctl enable mariadb && systemctl enable guacd

8. The guacamole web application that we downloaded in step 4 needs to be copied to the correct directory

cp ~/guacamole-1.1.0.war /var/lib/tomcat/webapps/guacamole.war

9. The firewall needs to be opened to allow tomcat/guacamole to connect via port 8080.

firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload

10. To configure Guacamole to support multiple users and connections, we need to download and configure MySQL.

mkdir -p /usr/share/tomcat/.guacamole/{extensions,lib}
wget https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-8.0.28.tar.gz
tar -xzf mysql-connector-java-8.0.28.tar.gz
cp mysql-connector-java-8.0.28/mysql-connector-java-8.0.28.jar /usr/share/tomcat/.guacamole/lib/
wget https://downloads.apache.org/guacamole/1.1.0/binary/guacamole-auth-jdbc-1.1.0.tar.gz
tar -xzf guacamole-auth-jdbc-1.1.0.tar.gz
cp guacamole-auth-jdbc-1.1.0/mysql/guacamole-auth-jdbc-mysql-1.1.0.jar /usr/share/tomcat/.guacamole/extensions/

11. Let’s now start mariadb and tomcat.

systemctl start mariadb  && systemctl start tomcat

12. Next we need to better secure our mysql/mariadb installation

mysql_secure_installation

13. Press enter when asked “Enter current password for root (enter for none):”


14. Enter “Y” to set your own root password. This should be different from your normal root user password. Make sure you save this password for future use. For this demo, we are going to use GuacDemo as our password.


15. Enter “Y” to remove anonymous users, and then “Y” again to disallow remote root login.


16. Enter “Y” to remove the test database, and finally “Y” again to reload the privilege tables.


17. Now we need to configure the tables and database scheme so that Guacamole can store connection and user information in the database. Log into mysql, you will be promoted to enter the password you created in step 14.

mysql -u root -p

18. Enter the following lines of SQL once you’ve been greeted with the MariaDB prompt.

CREATE DATABASE IF NOT EXISTS guacdb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT SELECT,INSERT,UPDATE,DELETE ON guacdb.* TO 'guacuser'@'localhost' IDENTIFIED BY 'guacpass' WITH GRANT OPTION;
flush privileges;
quit

19. We now need to download and extract the guacamole client, and cat the .sql files to mysql from inside the jbdc folder.

wget https://downloads.apache.org/guacamole/1.1.0/source/guacamole-client-1.1.0.tar.gz
tar -xzf guacamole-client-1.1.0.tar.gz
cat guacamole-client-1.1.0/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema/*.sql | mysql -u root -p guacdb

Note: You will be prompted for a password after this step. Use the MySQL password you created back in step 14.


20. Now we need to create the Guacamole configuration file.

mkdir -p /etc/guacamole/ && vi /etc/guacamole/guacamole.properties

Now paste the following into the file:

#----------------------------------Inset Into VI---------------------------------------
# MySQL properties
mysql-hostname: localhost
mysql-port: 3306
mysql-database: guacdb
mysql-username: guacuser
mysql-password: guacpass
#Additional settings
mysql-default-max-connections-per-user: 0
mysql-default-max-group-connections-per-user: 0
#----------------------------------End Inset Into VI---------------
--------------------

Note: To exit vi and save the file, press esc, then the colon symbol ":", type wq, and press enter.


21. Now we fix some file permissions and create a symbolic link.

chmod 0400 /etc/guacamole/guacamole.properties
chown tomcat:tomcat /etc/guacamole/guacamole.properties
ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat/.guacamole/
chown tomcat:tomcat /var/lib/tomcat/webapps/guacamole.war

22. In order for MySQL/MariaDB to communicate correctly with Guacamole, we have to specify our timezone in /etc/my.cnf Add the following to the [mysqld] block of the configuration file. I use -4:00 for EDT. You will need to lookup the correct timezone value based on your location.

default-time-zone='-4:00'

23. Finally, we need to fix a permission issue with SELinux that will prevent Guacamole from working correctly.

setsebool -P tomcat_can_network_connect_db on
restorecon -R -v /usr/share/tomcat/.guacamole/lib/mysql-connector-java-8.0.26.jar

24. That should be it! Just reboot your machine, and with any luck you will be greeted with the guacamole login screen when you navigate to:

[yourip]:8080/guacamole

The default username is: guacadmin and the default password: guacadmin.

If you get a blank white screen, try step 23 again and reboot your computer. If you are still met with a blank white screen, try disabling SELinux.





2,734 views3 comments

Recent Posts

See All