2016-10-21 03:26:40 +02:00
|
|
|
#!/bin/bash
|
2017-03-12 19:36:03 +01:00
|
|
|
# WORKING ON UBUNTU 16.04 LTS
|
2016-10-21 03:26:40 +02:00
|
|
|
|
2017-08-01 15:12:56 +02:00
|
|
|
VERSION="0.9.13"
|
2017-02-11 15:47:49 +01:00
|
|
|
|
2016-10-21 03:26:40 +02:00
|
|
|
read -s -p "Enter the password that will be used for MySQL Root: " MYSQLROOTPASSWORD
|
2017-08-03 13:31:57 +02:00
|
|
|
echo
|
2016-10-21 03:26:40 +02:00
|
|
|
read -s -p "Enter the password that will be used for the Guacamole database: " GUACDBUSERPASSWORD
|
2017-08-03 13:31:57 +02:00
|
|
|
echo
|
2016-10-21 03:26:40 +02:00
|
|
|
|
|
|
|
#Install Stuff
|
2017-08-22 04:49:49 +02:00
|
|
|
apt update
|
|
|
|
apt -y install docker.io mysql-client wget jq curl
|
2016-10-21 03:26:40 +02:00
|
|
|
|
2017-07-24 03:42:16 +02:00
|
|
|
# Get perfered download server
|
|
|
|
SERVER=$(curl -s 'https://www.apache.org/dyn/closer.cgi?as_json=1' | jq --raw-output '.preferred|rtrimstr("/")')
|
|
|
|
|
2017-08-22 04:49:49 +02:00
|
|
|
# Download the Guacamole auth files for MySQL
|
2017-03-12 19:35:19 +01:00
|
|
|
wget ${SERVER}/incubator/guacamole/${VERSION}-incubating/binary/guacamole-auth-jdbc-${VERSION}-incubating.tar.gz
|
2017-03-04 05:38:48 +01:00
|
|
|
tar -xzf guacamole-auth-jdbc-${VERSION}-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
|
|
|
|
|
2017-10-13 17:52:34 +02:00
|
|
|
# Sleep to let MySQL load (there's probably a better way to do this)
|
|
|
|
echo "Waiting 30 seconds for MySQL to load"
|
|
|
|
sleep 30
|
2016-10-21 03:26:40 +02:00
|
|
|
|
2017-10-13 17:52:34 +02:00
|
|
|
# Create the Guacamole database and the user account
|
2017-02-11 15:47:49 +01:00
|
|
|
# SQL Code
|
|
|
|
SQLCODE="
|
2017-10-13 17:52:34 +02:00
|
|
|
create database guacamole_db;
|
|
|
|
create user 'guacamole_user'@'%' identified by '$guacdbuserpassword';
|
|
|
|
GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user'@'%';
|
2017-02-11 15:47:49 +01:00
|
|
|
flush privileges;"
|
|
|
|
|
|
|
|
# Execute SQL Code
|
|
|
|
echo $SQLCODE | mysql -h 127.0.0.1 -P 3306 -u root -p$MYSQLROOTPASSWORD
|
|
|
|
|
2017-03-04 05:38:48 +01:00
|
|
|
cat guacamole-auth-jdbc-${VERSION}-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
|
|
|
|
2017-07-24 03:38:35 +02:00
|
|
|
docker run --restart=always --name guacd -d guacamole/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 guacamole/guacamole
|
2017-02-11 15:47:49 +01:00
|
|
|
|
2017-03-04 05:38:48 +01:00
|
|
|
rm -rf guacamole-auth-jdbc-${VERSION}-incubating*
|