Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # WORKING ON UBUNTU 17.10
- VERSION="0.9.14"
- SERVER=$(curl -s 'https://www.apache.org/dyn/closer.cgi?as_json=1' | jq --raw-output '.preferred|rtrimstr("/")')
- 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
- read -s -p "Enter the path where you store Guacamole custom configuration in host (/my/data/dir): " GUACPATH
- # Download the guacamole auth files for MySQL
- wget http://xenia.sote.hu/ftp/mirrors/www.apache.org/guacamole/0.9.14/binary/guacamole-auth-jdbc-0.9.14.tar.gz
- tar -xzf guacamole-auth-jdbc-0.9.14.tar.gz
- # Start MySQL
- docker run --restart=always --detach --name=mysql --env="MYSQL_ROOT_PASSWORD=$MYSQLROOTPASSWORD" --publish 3306:3306 mysql
- sleep 40
- # Create the Guacamole database and the user account
- # SQL Code
- SQLCODE="
- create database guacamole_db;
- create user 'guacamole_user'@'%' identified by '$GUACDBUSERPASSWORD';
- GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user'@'%';
- flush privileges;"
- # Execute SQL Code
- echo $SQLCODE | mysql -h 127.0.0.1 -P 3306 -u root -p$MYSQLROOTPASSWORD
- cat guacamole-auth-jdbc-${VERSION}/mysql/schema/*.sql | mysql -u root -p$MYSQLROOTPASSWORD -h 127.0.0.1 -P 3306 guacamole_db
- docker run --restart=always --name guacd -d guacamole/guacd
- docker run --restart=always --name guacamole --link mysql:mysql --link guacd:guacd -v $GUACPATH:/config -e GUACAMOLE_HOME=/config -e MYSQL_HOSTNAME$
- rm -rf guacamole-auth-jdbc-0.9.14*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement