Setup Docker containerized apache guacamole on centos 7 host.

Lets setup apache guacamole as your web based rdp vnc ssh gateway.
This is helpfull in case of your corporate environment also where you need to access your intranet network using port 443 only.

Install docker if you dont have already

 yum install docker -y
 systemctl enable docker
 systemctl start docker

Pull required container images

 docker pull guacamole/guacamole
 docker pull guacamole/guacd
 docker pull mysql/mysql-server

 Now run containers -

 docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --mysql > initdb.sql

 docker run --name mysql -e MYSQL_RANDOM_ROOT_PASSWORD=yes -e MYSQL_ONETIME_PASSWORD=yes -d mysql/mysql-server
 docker logs mysql
 docker cp initdb.sql mysql:/guac_db.sql
 docker exec -it mysql bash

Now setup required mysql database within container.


 bash-4.2# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.7.20

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_root_password';
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE DATABASE guacamole_db;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE USER 'guacamole_user'@'%' IDENTIFIED BY 'guacamole_user_password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

 cat guac_db.sql | mysql -u root -p guacamole_db

 docker run --name guacd -d guacamole/guacd
 docker run --name guacamole --link guacd:guacd --link mysql:mysql -e MYSQL_DATABASE='guacamole_db' -e MYSQL_USER='guacamole_user' -e MYSQL_PASSWORD='guacamole_user_password' -d -p 8080:8080 guacamole/guacamole


Comments

Popular posts from this blog

Running web ssh client on port 443 /80 with nginx as reverse proxy

Running cockpit behind nginx reverse proxy with nginx ssl and cockpit non ssl

Setup VOD streaming server with nginx using RTMP on Ubuntu 18.04