1. 程式人生 > >apache guacamole 使用mysql 連線

apache guacamole 使用mysql 連線

1.建立一個臨時資料夾,用來存放mysql-java聯結器

mkdir tempauth

2.下載相關檔案

cd tempauth
wget https://jaist.dl.sourceforge.net/project/guacamole/current/extensions/guacamole-auth-jdbc-0.9.14.tar.gz
wget https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz

點選這裡下載 要注意這個版本只適用於0.9.14的guacamole-server
3.安裝/解壓

tar -zxf mysql-connector-java-5.1.46.tar.gz
tar -zxf guacamole-auth-jdbc-0.9.14.tar.gz

4.將guacamole-auth複製到GUACAMOLE_HOME的extensions檔案下,若無則建立.GUACAMOLE_HOME一般為/etc/guacamole/

cp /etc/guacamole/tmpauth/guacamole-auth-jdbc-0.9.14/mysql/guacamole-auth-jdbc-mysql-0.9.14.jar /etc/guacamole/extensions/
cp /etc/guacamole/tmpauth/mysql-connector
-java-5.1.46/mysql-connector-java-5.1.46-bin.jar /etc/guacamole/lib/

5.建立Guacamole資料庫

$ mysql -u root -p
Enter password: password
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 233
Server version: 5.5.29-0ubuntu0.12.10.1 (Ubuntu)

Copyright (c) 2000, 2012, 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> CREATE DATABASE guacamole_db; Query OK, 1 row affected (0.00 sec) mysql> CREATE USER 'guacamole_user'@'localhost' IDENTIFIED BY 'some_password'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user'@'localhost'; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.02 sec) mysql> quit Bye

6.進入到/etc/guacamole/sqlauth/guacamole-auth-jdbc-0.9.14/mysql/schema下,執行sql指令碼

root@ubuntu:/etc/guacamole/sqlauth/guacamole-auth-jdbc-0.9.14/mysql/schema# ls
001-create-schema.sql  002-create-admin-user.sql  upgrade
root@ubuntu:/etc/guacamole/sqlauth/guacamole-auth-jdbc-0.9.14/mysql/schema# cat ./*.sql | mysql -u root -p guacamole_db
Enter password: 
root@ubuntu:/etc/guacamole/sqlauth/guacamole-auth-jdbc-0.9.14/mysql/schema# 

7.配置guacamole.properites相關資訊

# MySQL properties
mysql-hostname: localhost
mysql-port: 3306
mysql-database: guacamole_db
mysql-username: guacamole_user
mysql-password: some_password

注意,如果沒有配置資料庫資訊,使用user-mapping.xml 沒有類似歷史訪問記錄,sftp等功能

注意 guacamole-auth-jdbc 一定要和guancd 的版本號對應,否則會出現登陸失敗的情況
可以按照下面的方法檢視版本號:

root@ubuntu:/etc/guacamole# /etc/init.d/guacd restart
Stopping guacd: SUCCESS
Starting guacd: guacd[4497]: INFO:  Guacamole proxy daemon (guacd) version 0.9.13-incubating started
SUCCESS
# 

這裡顯示的版本號為 0.9.23-incubating 下載時一定要注意下載對應版本

點選: guacamole-auth-jdbc對應版本下載地址

日誌記錄在/var/log/tomcat8下面 注意為catalina.out檔案,有問題及時檢視方便解決