2016-10-21 03:26:40 +02:00
#!/bin/bash
2016-12-31 23:55:51 +01:00
# WORKING ON UBUNTU 16.04.1 LTS
2016-10-21 03:26:40 +02:00
read -s -p "Enter the password that will be used for MySQL Root: " MYSQLROOTPASSWORD
read -s -p "Enter the password that will be used for the Guacamole database: " GUACDBUSERPASSWORD
#Install Stuff
2017-01-02 18:05:49 +01:00
apt-get install docker.io mysql-client wget jq curl
2016-10-21 03:26:40 +02:00
# Download the guacamole auth files for MySQL
2016-12-31 23:55:51 +01:00
SERVER = $( curl -s 'https://www.apache.org/dyn/closer.cgi?as_json=1' | jq --raw-output '.preferred' )
wget $SERVER /incubator/guacamole/0.9.10-incubating/binary/guacamole-auth-jdbc-0.9.10-incubating.tar.gz
tar -xzf guacamole-auth-jdbc-0.9.10-incubating.tar.gz
2016-10-21 03:26:40 +02:00
# Start MySQL
docker run --restart= always --detach --name= mysql --env= " MYSQL_ROOT_PASSWORD= $MYSQLROOTPASSWORD " --publish 3306:3306 mysql
# Create the Guacamole database and the user account
echo " create database guacamole_db; create user 'guacamole_user'@'localhost' identified by \" $GUACDBUSERPASSWORD \";GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user'@'localhost';flush privileges; " | mysql -h 127.0.0.1 -P 3306 -u root -p$MYSQLROOTPASSWORD
2016-12-31 23:55:51 +01:00
cat guacamole-auth-jdbc-0.9.10-incubating/mysql/schema/*.sql | mysql -u root -p$MYSQLROOTPASSWORD -h 127.0.0.1 -P 3306 guacamole_db
2016-10-21 03:26:40 +02:00
docker run --restart= always --name guacd -d glyptodon/guacd
docker run --restart= always --name guacamole --link mysql:mysql --link guacd:guacd -e MYSQL_HOSTNAME = 127.0.0.1 -e MYSQL_DATABASE = guacamole_db -e MYSQL_USER = guacamole_user -e MYSQL_PASSWORD = $GUACDBUSERPASSWORD --detach -p 8080:8080 glyptodon/guacamole
2016-12-31 23:55:51 +01:00
rm -rf guacamole-auth-jdbc-0.9.10-incubating*