This guide explains how to install MariaDB and configure it for use with Apache Guacamole
If you're installing MariaDB 10 on a freshly installed Debian 12, begin by updating and upgrading your system packages:
apt update
The easiest way to install MariaDB is via the MariaDB package repositories. The default repositories for Debian 12 provide MariaDB 10 packages.
To check the available MariaDB package, use the following command:
apt show mariadb-server
You should see details like:
Package: mariadb-server
Version: 1:10.11.3-1
...
Provides: virtual-mysql-server
...
Now, install MariaDB 10 by running:
apt install mariadb-server
Sample output:
The following additional packages will be installed: ...
0 upgraded, 32 newly installed, 0 to remove and 0 not upgraded.
Need to get 18.9 MB of archives.
After this operation, 194 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
MariaDB 10 replaces the mysql command-line tool with mariadb. You can check the installed version using:
mariadb -V
Example output:
mariadb Ver 15.1 Distrib 10.11.3-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
Upon installation, MariaDB is automatically started and enabled to run on system boot. To verify:
systemctl status mariadb
Example output:
● mariadb.service - MariaDB 10.11.3 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; preset: enabled)
Active: active (running)
...
Use the following commands to manage the MariaDB service:
systemctl start mariadbsystemctl restart mariadbsystemctl stop mariadbsystemctl disable mariadbMariaDB includes a security script to enhance the default configuration. Run the following command to launch the script:
mariadb-secure-installation
The script allows you to:
Follow the prompts to configure security.
Two secure accounts are created during installation:
root@localhostmysql@localhostThese accounts use either:
unix_socket authentication, allowing the system root or sudo user to log in without a password.mysql_native_password authentication, which requires a password.To log in as root:
If you're the system root user:
mariadb
or:
mariadb -u root
As a sudo user:
sudo mariadb
You can also log in as the mysql user with:
sudo -u mysql mariadb
For mariadb -u root -p, pressing Enter for a blank password works if unix_socket is enabled.
If you want to install Guacamole on Linux, refer to various guides for installing Apache Guacamole.
You can install MySQL or MariaDB on the same system where Guacamole is running.
Refer to guides for installing MySQL/MariaDB.
Login to your database system and create the database and user:
mysql -u root -p
Run the following commands:
create database guacd;
create user guacd_admin@localhost identified by 'ChangeME';
grant SELECT,UPDATE,INSERT,DELETE on guacd.* to guacd_admin@localhost;
flush privileges;
quit;
Download the Guacamole database authentication extension that matches your version of Guacamole:
VER=1.5.5
wget https://dlcdn.apache.org/guacamole/${VER}/binary/guacamole-auth-jdbc-${VER}.tar.gz
Extract the MySQL extension:
tar xzf guacamole-auth-jdbc-${VER}.tar.gz guacamole-auth-jdbc-${VER}/mysql
Copy the Guacamole extension .jar file to the GUACAMOLE_HOME/extensions directory:
cp guacamole-auth-jdbc-${VER}/mysql/guacamole-auth-jdbc-mysql-${VER}.jar /etc/guacamole/extensions/
Run the following commands to import the MySQL schema files:
mysql -u root -p guacd < guacamole-auth-jdbc-${VER}/mysql/schema/001-create-schema.sql
mysql -u root -p guacd < guacamole-auth-jdbc-${VER}/mysql/schema/002-create-admin-user.sql
Download and install the MySQL JDBC connector:
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.28.tar.gz
tar xzf mysql-connector-java-8.0.28.tar.gz
cp mysql-connector-java-8.0.28/mysql-connector-java-8.0.28.jar /etc/guacamole/lib/
Define the database connection in the guacamole.properties file:
cat >> /etc/guacamole/guacamole.properties << EOL
auth-provider: net.sourceforge.guacamole.net.auth.mysql.MySQLAuthenticationProvider
mysql-hostname: localhost
mysql-database: guacd
mysql-username: guacd_admin
mysql-password: ChangeME
EOL
Your guacamole.properties file may look like this:
guacd-hostname: localhost
guacd-port: 4822
user-mapping: /etc/guacamole/user-mapping.xml
auth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider
mysql-hostname: localhost
mysql-database: guacd
mysql-username: guacd_admin
mysql-password: ChangeME
For additional database account control settings, refer to the documentation.
Restart the Tomcat service to apply the changes:
systemctl restart tomcat9
guacadminguacadmin