Starting from ClusterControl 1.9.7 (September 2023), ClusterControl GUI v2 is the default frontend graphical user interface (GUI) for ClusterControl, accessible via https://{ClusterControl_host}/
. For new installations, the installer script will only install GUI v2, skipping GUI v1. If you would like to have GUI v1, follow the instructions as written in this article.
Before continuing with the installation, do mind the following important points:
- ClusterControl GUI v1 requires PHP. It only supports the outdated PHP 7. It does not support the latest version of PHP 8 at the time of this writing. If the operating system comes with PHP 8 installed by default, you have to downgrade to PHP 7 to continue using it. ClusterControl GUI v2 does not have this requirement.
- It requires a MySQL/MariaDB database called “dcps”.
- Only the Apache web server is supported due to its dependency on .htaccess and Apache configuration files.
- ClusterControl GUI v1 has reached the end of the development cycle and is considered a feature-freeze product. All new developments will be happening on ClusterControl GUI v2.
- To run ClusterControl GUI v1 on a Red Hat-based distribution, SELinux must be turned off. The installer script only configures the SELinux policy for ClusterControl GUI v2.
The following installation steps are written based on Ubuntu 22.04 LTS and Rocky Linux 9.2. It is assumed that you have already performed a ClusterControl installation using the installer script, install-cc
which by default would give you ClusterControl GUI v2. See the Getting Started section for details.
1. If you have created an admin user during the first login of ClusterControl GUI v2, proceed to step 2. Otherwise, create a ClusterControl admin user if you haven’t done so by accessing ClusterControl GUI v2.
2. Disable SELinux by configuring the following line inside /etc/selinux/config
:
SELINUX=disabled
Deactivate SELinux during runtime:
setenforce 0
3. Install ClusterControl GUI v1 package:
dnf install -y clustercontrol
4. Copy the provided Apache configuration files to the Apache configuration directory:
cp -f /var/www/html/clustercontrol/app/tools/apache2/s9s*.conf /etc/httpd/conf.d/
5. Add Listen {HTTPS port}
at the top of the s9s-ssl.conf
file (note that port 443 is already taken by GUI v2, so we have to pick another port):
vimĀ /etc/httpd/conf.d/s9s-ssl.conf
Add the following in the first line:
Listen 9443
In the same file, configure the same HTTPS port as defined above on line 3:
<VirtualHost _default_:9443>
Also in the same file, configure the SSL certificate and key with the provided cert and key (lines 55 and 56, after you have added the first line above):
SSLCertificateFile /etc/ssl/certs/s9server.crt
SSLCertificateKeyFile /etc/ssl/private/s9server.key
Restart the Apache web server to apply the changes:
systemctl restart httpd
6. Check the provided PHP module of the operating system. For Rocky Linux 9.2, the PHP module provided by the default AppStream repository is 8.1, which is not supported. We can check using the following command:
dnf module list php
7. If PHP7 is unavailable as in this case, we will configure the Remi repository:
dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
8. Verify that the PHP 7 module is listed (in this example, it is remi-7.4
):
$ dnf module list php -y
Rocky Linux 9 - AppStream
Name Stream Profiles Summary
php 8.1 common [d], devel, minimal PHP scripting language
Remi's Modular repository for Enterprise Linux 9 - x86_64
Name Stream Profiles Summary
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 common [d], devel, minimal PHP scripting language
php remi-8.2 common [d], devel, minimal PHP scripting language
php remi-8.3 common [d], devel, minimal PHP scripting language
9. Switch PHP to use remi-7.4
module:
dnf module -y switch-to php:remi-7.4
10. Install the required PHP7 packages:
dnf install -y php php-mysql php-ldap php-gd php-curl php-xml php-fpm
11. Start the php-fpm service and restart Apache web server:
systemctl start php-fpm
systemctl enable php-fpm
systemctl restart httpd
12. Create bootstrap.php
from the provided template:
cp /var/www/html/clustercontrol/bootstrap.php.default /var/www/html/clustercontrol/bootstrap.php
13. Configure /var/www/html/clustercontrol/bootstrap.php
and set the password, DBPASS
, port, DBPORT
and RPCTOKEN
accordingly:
define('DB_PASS', 'DBPASS');
define('DB_PORT', 'DBPORT');
define('RPC_TOKEN','RPCTOKEN');
Set the password and port used when installing CCv2 for the cmon MySQL user. You can also retrieve the information from /etc/cmon.cnf
(including the RPC token).
The following is an example configuration:
...
define('DB_HOST', '127.0.0.1');
define('DB_LOGIN', 'cmon');
define('DB_PASS', 'PjsL23&H7dNsN$b');
define('DB_NAME', 'dcps');
define('DB_PORT', '3306');
...
define('RPC_TOKEN','80e0a3c8894e931f8b26d6f196c52a9818e513ba');
14. Login to MySQL and create the ‘dcps’ database:
mysql -ucmon -p -e 'CREATE DATABASE dcps'
We skip configuring MySQL user privilege since the “cmon” MySQL user has a global admin privilege.
15. Import the ‘dcps’ database schema structure from the provided SQL file:
mysql -ucmon -p dcps < /var/www/html/clustercontrol/sql/dc-schema.sql
16. Finally, add the following database flag to skip the registration and admin user creation page since we have done it via ClusterControl GUI v2 when creating the first admin user:
$ mysql -ucmon -p
mysql> INSERT INTO dcps.settings (name, type) VALUES ('registration_complete', 'settings');
17. The installation is now complete. ClusterControl GUI v1 should be accessible at https://{ClusterControl_host}:9443/
. The final thing to do is to import the existing clusters (if you have any) into ClusterControl GUI v1, by executing this script:
#!/bin/bash
function import() {
for i in /etc/cmon.d/cmon_*.cnf; do
NAME=$(grep ^name= $i | cut -d "=" -f2 | tr -d "'")
TYPE=$(grep ^cluster_type= $i | cut -d "=" -f2)
TOKEN=$(grep ^rpc_key= $i | cut -d "=" -f2 | tr -d "'")
CREATED_BY=$(grep ^owner= $i | cut -d "=" -f2)
CID=$(grep ^cluster_id= $i | cut -d "=" -f2)
DBUSER=cmon
DBPASS=$(grep ^mysql_password= $i | cut -d "=" -f2 | tr -d "'")
echo "Importing cluster ID = $CID, from $i"
MYSQL_PWD="$DBPASS" mysql -u$DBUSER -f -A -Bse \
"INSERT IGNORE INTO dcps.clusters SET company_id = 1, \
id = ${CID}, \
cluster_id = ${CID}, \
name = '${NAME}', \
token = '${TOKEN}', \
cmon_db = 'cmon', \
type = '${TYPE}', \
status = 100, \
created_by = $CREATED_BY"
retval=$?
if [ $retval -eq 0 ]; then
echo 'OK'
else
echo 'ERROR. Fix the script and try again.'
exit 1
fi
done
echo 'Import complete.'
exit 0
}
echo 'Use this script to import clusters into ClusterControl GUI v1'
echo 'after GUI v1 is installed and running (v1.9.7 only).'
echo 'This script can be run multiple times if any error occurs.'
echo
read -p "Do you wish to continue? [Y/n] " yn
case $yn in
[Yy]* ) import; break;;
* ) echo 'Exiting..'; exit 1;;
esac
Copy the above code inside the ClusterControl server and save it as import_cluster_guiv1.sh
. Example output as below:
$ vim import_cluster_guiv1.sh # paste the code & save
$ chmod 755 import_cluster_guiv1.sh
$ ./import_cluster_guiv1.sh
Use this script to import clusters into ClusterControl GUI v1
after GUI v1 is installed and running (v1.9.7 only).
This script can be run multiple times if any error occurs.
Do you wish to continue? [Y/n] Y
Importing cluster ID = 2, from /etc/cmon.d/cmon_2.cnf
OK
Importing cluster ID = 3, from /etc/cmon.d/cmon_3.cnf
OK
Importing cluster ID = 4, from /etc/cmon.d/cmon_4.cnf
OK
Importing cluster ID = 7, from /etc/cmon.d/cmon_7.cnf
OK
1. If you have created an admin user during the first login of ClusterControl GUI v2, proceed to step 2. Otherwise, create a ClusterControl admin user if you haven’t done so by accessing ClusterControl GUI v2.
2. Install ClusterControl GUI v1 package:
apt update -y
apt install -y clustercontrol
3. Copy the provided Apache configuration files to the Apache configuration directory:
cp -f /var/www/html/clustercontrol/app/tools/apache2/s9s*.conf /etc/apache2/sites-enabled/
4. Add Listen {HTTPS port}
at the top of the s9s-ssl.conf
file (note that port 443 is already taken by GUI v2, so we have to pick another port):
vim /etc/apache2/sites-enabled/s9s-ssl.conf
Add the following in the first line:
Listen 9443
In the same file, configure the same HTTPS port as defined above on line 3:
<VirtualHost _default_:9443>
Also in the same file, configure the SSL certificate and key with the provided cert and key (lines 55 and 56, after you have added the first line above):
SSLCertificateFile /etc/ssl/certs/s9server.crt
SSLCertificateKeyFile /etc/ssl/private/s9server.key
Restart the Apache web server to apply the changes:
systemctl restart apache2
5. By default, the installer script configures the PHP7 repository called “ondrej”. You may verify by using the following command:
apt-cache policy | grep ondrej
6. If the repository is not listed in the above output, you may install it by using the following commands:
apt install -y software-properties-common apt-transport-https
add-apt-repository -y ppa:ondrej/php
apt update -y
7. Install the required PHP7 packages:
apt install -y php7.4-mysql php7.4-gd libapache2-mod-php7.4 php7.4-curl php7.4-ldap php7.4-xml
By default, the installer script will install the above packages. In that case, the above command will return those packages as installed.
8. Create bootstrap.php
from the provided template:
cp /var/www/html/clustercontrol/bootstrap.php.default /var/www/html/clustercontrol/bootstrap.php
9. Configure /var/www/html/clustercontrol/bootstrap.php
and set the password, DBPASS
, port, DBPORT
and RPCTOKEN
accordingly:
define('DB_PASS', 'DBPASS');
define('DB_PORT', 'DBPORT');
define('RPC_TOKEN','RPCTOKEN');
Set the password and port used when installing CCv2 for the cmon MySQL user. You can also retrieve the information from /etc/cmon.cnf
(including the RPC token).
The following is an example configuration:
...
define('DB_HOST', '127.0.0.1');
define('DB_LOGIN', 'cmon');
define('DB_PASS', 'PjsL23&H7dNsN$b');
define('DB_NAME', 'dcps');
define('DB_PORT', '3306');
...
define('RPC_TOKEN','80e0a3c8894e931f8b26d6f196c52a9818e513ba');
10. Login to MySQL and create the ‘dcps’ database:
mysql -ucmon -p -e 'CREATE DATABASE dcps'
We skip configuring MySQL user privilege since the “cmon” MySQL user has a global admin privilege.
11. Import the ‘dcps’ database schema structure from the provided SQL file:
mysql -ucmon -p dcps < /var/www/html/clustercontrol/sql/dc-schema.sql
12. Finally, add the following database flag to skip the registration and admin user creation page since we have done it via ClusterControl GUI v2 when creating the first admin user:
$ mysql -ucmon -p
mysql> INSERT INTO dcps.settings (name, type) VALUES ('registration_complete', 'settings');
13. The installation is now complete. ClusterControl GUI v1 should be accessible at https://{ClusterControl_host}:9443/
. The final thing to do is to import the existing clusters (if you have any) into ClusterControl GUI v1, by executing this script:
#!/bin/bash
function import() {
for i in /etc/cmon.d/cmon_*.cnf; do
NAME=$(grep ^name= $i | cut -d "=" -f2 | tr -d "'")
TYPE=$(grep ^cluster_type= $i | cut -d "=" -f2)
TOKEN=$(grep ^rpc_key= $i | cut -d "=" -f2 | tr -d "'")
CREATED_BY=$(grep ^owner= $i | cut -d "=" -f2)
CID=$(grep ^cluster_id= $i | cut -d "=" -f2)
DBUSER=cmon
DBPASS=$(grep ^mysql_password= $i | cut -d "=" -f2 | tr -d "'")
echo "Importing cluster ID = $CID, from $i"
MYSQL_PWD="$DBPASS" mysql -u$DBUSER -f -A -Bse \
"INSERT IGNORE INTO dcps.clusters SET company_id = 1, \
id = ${CID}, \
cluster_id = ${CID}, \
name = '${NAME}', \
token = '${TOKEN}', \
cmon_db = 'cmon', \
type = '${TYPE}', \
status = 100, \
created_by = $CREATED_BY"
retval=$?
if [ $retval -eq 0 ]; then
echo 'OK'
else
echo 'ERROR. Fix the script and try again.'
exit 1
fi
done
echo 'Import complete.'
exit 0
}
echo 'Use this script to import clusters into ClusterControl GUI v1'
echo 'after GUI v1 is installed and running (v1.9.7 only).'
echo 'This script can be run multiple times if any error occurs.'
echo
read -p "Do you wish to continue? [Y/n] " yn
case $yn in
[Yy]* ) import; break;;
* ) echo 'Exiting..'; exit 1;;
esac
Copy the above code inside the ClusterControl server and save it as import_cluster_guiv1.sh
. Example output as below:
$ vim import_cluster_guiv1.sh # paste the code & save
$ chmod 755 import_cluster_guiv1.sh
$ ./import_cluster_guiv1.sh
Use this script to import clusters into ClusterControl GUI v1
after GUI v1 is installed and running (v1.9.7 only).
This script can be run multiple times if any error occurs.
Do you wish to continue? [Y/n] Y
Importing cluster ID = 2, from /etc/cmon.d/cmon_2.cnf
OK
Importing cluster ID = 3, from /etc/cmon.d/cmon_3.cnf
OK
Importing cluster ID = 4, from /etc/cmon.d/cmon_4.cnf
OK
Importing cluster ID = 7, from /etc/cmon.d/cmon_7.cnf
OK