GUACAMOLE (0.9.9) on UBUNTU 16.10 and TOMCAT8

Stumbled across this interesting app when searching for reverse remote desktop.

#!/bin/bash

# Original December 19 2015 Guacamole with MySQL on Ubuntu RDP Fix Published by Chase
# http://chasewright.com/guacamole-with-mysql-on-ubuntu/ Thanks Chase!

# WORKING ON UBUNTU 16.10 WITH GUAC 0.9.9 AND TOMCAT8
# edited 07-10-16


apt-get update && apt-get -y dist-upgrade

#install and add java ENV
apt-get -y install openjdk-8-jre-headless
alternative=java-8-openjdk-armhf
export JAVA_HOME=/usr/lib/jvm/$alternative
echo $JAVA_HOME


#Install Stuff
apt-get -y install libjpeg-dev libcairo2-dev libossp-uuid-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev libvorbis-dev libwebp-dev mysql-server mysql-client mysql-common mysql-utilities tomcat8 freerdp ghostscript wget snmp libsnmp-dev

# Install libjpeg-turbo-dev
wget -O libjpeg-turbo-official_1.4.2_amd64.deb http://downloads.sourceforge.net/project/libjpeg-turbo/1.4.2/libjpeg-turbo-official_1.4.2_amd64.deb
dpkg -i libjpeg-turbo-official_1.4.2_amd64.deb

# Add GUACAMOLE_HOME to Tomcat8 ENV
echo "" >> /etc/default/tomcat8
echo "# GUACAMOLE EVN VARIABLE" >> /etc/default/tomcat8
echo "GUACAMOLE_HOME=/etc/guacamole" >> /etc/default/tomcat8

#Download Guacamole Files
wget -O guacamole-0.9.9.war http://downloads.sourceforge.net/project/guacamole/current/binary/guacamole-0.9.9.war
wget -O guacamole-server-0.9.9.tar.gz http://sourceforge.net/projects/guacamole/files/current/source/guacamole-server-0.9.9.tar.gz
wget -O guacamole-auth-jdbc-0.9.9.tar.gz http://sourceforge.net/projects/guacamole/files/current/extensions/guacamole-auth-jdbc-0.9.9.tar.gz
wget -O mysql-connector-java-5.1.38.tar.gz http://dev.mysql.com/get/Downloads/Connector/j/mysql-connector-java-5.1.38.tar.gz

#Extract Guac
tar -xzf guacamole-server-0.9.9.tar.gz
tar -xzf guacamole-auth-jdbc-0.9.9.tar.gz
tar -xzf mysql-connector-java-5.1.38.tar.gz

# MAKE DIRECTORIES
mkdir /etc/guacamole
mkdir /etc/guacamole/lib
mkdir /etc/guacamole/extensions

# Install GUACD
cd guacamole-server-0.9.9
./configure --with-init-dir=/etc/init.d
make
make install
ldconfig
systemctl enable guacd
cd ..

# Move files to correct locations
mv guacamole-0.9.9.war /etc/guacamole/guacamole.war
ln -s /etc/guacamole/guacamole.war /var/lib/tomcat8/webapps/
ln -s /usr/local/lib/freerdp/* /usr/lib/x86_64-linux-gnu/freerdp/.
cp mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar /etc/guacamole/lib/
cp guacamole-auth-jdbc-0.9.9/mysql/guacamole-auth-jdbc-mysql-0.9.9.jar /etc/guacamole/extensions/

# Configure guacamole.properties
echo "mysql-hostname: localhost" >> /etc/guacamole/guacamole.properties
echo "mysql-port: 3306" >> /etc/guacamole/guacamole.properties
echo "mysql-database: guacamole_db" >> /etc/guacamole/guacamole.properties
echo "mysql-username: guacamole_user" >> /etc/guacamole/guacamole.properties

# This is where you will want to change "PASSWORD"
echo "mysql-password: PASSSWORD" >> /etc/guacamole/guacamole.properties
rm -rf /usr/share/tomcat8/.guacamole
ln -s /etc/guacamole /usr/share/tomcat8/.guacamole

# Restart Tomcat Service
service tomcat8 restart

#Setup MySQL, change the MYSQLROOTPASSWORD to whatever you set it to and if you change the guacamaole_user password here be sure to go back and change it in /etc/guacamole/guacamole.properties

mysql -u root -pPASSSWORD
create database guacamole_db;
create user 'guacamole_user'@'localhost' identified by 'PASSSWORD';
GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user'@'localhost';
flush privileges;
quit

#Populate the database you just created. Again, change the MYSQLROOTPASSWORD

cat guacamole-auth-jdbc-0.9.9/mysql/schema/*.sql | mysql -u root -pPASSSWORD guacamole_db

#Now just log into your guacamole server using the default “guacadmin/guacadmin” and set it up. If you want you can remove all the downloads (cleanup)

# Cleanup Downloads
rm libjpeg-turbo-official_1.4.2_amd64.deb
rm guacamole-server-0.9.9.tar.gz
rm guacamole-auth-jdbc-0.9.9.tar.gz
rm mysql-connector-java-5.1.38.tar.gz

# Cleanup Folders
rm -rf mysql-connector-java-5.1.38/
rm -rf guacamole-auth-jdbc-0.9.9/
rm -rf guacamole-server-0.9.9/

#nano /etc/guacamole/guacamole.properties

mysql-hostname: localhost
mysql-port: 3306
mysql-database: guacamole_db
mysql-username: guacamole_user
mysql-password: PASSSWORD

guacd-hostname: localhost
guacd-port: 4822

# Location to read extra .jar's from
lib-directory: /var/lib/tomcat8/webapps/guacamole/WEB-INF/classes

# Location to read extra .jar's from
lib-directory: /var/lib/tomcat8/webapps/guacamole/WEB-INF/classes

# Authentication provider class
auth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider

# Properties used by BasicFileAuthenticationProvider
basic-user-mapping: /etc/guacamole/user-mapping.xml

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



vnc
server-ub5901PASSWORD


rdp
server-ub3389



Leave a Reply

Your email address will not be published. Required fields are marked *