@@ -47,7 +47,7 @@ software="nginx apache2 apache2-utils apache2-suexec-custom
4747 php$fpm_v -opcache php$fpm_v -pspell php$fpm_v -readline php$fpm_v -xml
4848 awstats vsftpd proftpd-basic bind9 exim4 exim4-daemon-heavy
4949 clamav-daemon spamassassin dovecot-imapd dovecot-pop3d dovecot-sieve dovecot-managesieved
50- net-tools mariadb-client mariadb-common mariadb-server postgresql
50+ net-tools mariadb-client mariadb-common mariadb-server mysql-client mysql-common mysql-server postgresql
5151 postgresql-contrib phppgadmin mc flex whois git idn2 unzip zip sudo bc ftp lsof
5252 rrdtool quota e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban
5353 dnsutils bsdmainutils cron hestia=${HESTIA_INSTALL_VER} hestia-nginx
@@ -68,6 +68,7 @@ help() {
6868 -j, --proftpd Install ProFTPD [yes|no] default: no
6969 -k, --named Install Bind [yes|no] default: yes
7070 -m, --mysql Install MariaDB [yes|no] default: yes
71+ -M, --mysql-classic Install MySQL [yes|no] default: no
7172 -g, --postgresql Install PostgreSQL [yes|no] default: no
7273 -x, --exim Install Exim [yes|no] default: yes
7374 -z, --dovecot Install Dovecot [yes|no] default: yes
@@ -207,6 +208,7 @@ for arg; do
207208 --proftpd) args=" ${args} -j " ;;
208209 --named) args=" ${args} -k " ;;
209210 --mysql) args=" ${args} -m " ;;
211+ --mysql-classic) args=" ${args} -M " ;;
210212 --postgresql) args=" ${args} -g " ;;
211213 --exim) args=" ${args} -x " ;;
212214 --dovecot) args=" ${args} -z " ;;
234236eval set -- " $args "
235237
236238# Parsing arguments
237- while getopts " a:w:v:j:k:m:g:d:x:z:Z:c:t:i:b:r:o:q:l:y:s:e:p:D:fh" Option; do
239+ while getopts " a:w:v:j:k:m:M: g:d:x:z:Z:c:t:i:b:r:o:q:l:y:s:e:p:D:fh" Option; do
238240 case $Option in
239241 a) apache=$OPTARG ;; # Apache
240242 w) phpfpm=$OPTARG ;; # PHP-FPM
@@ -243,6 +245,7 @@ while getopts "a:w:v:j:k:m:g:d:x:z:Z:c:t:i:b:r:o:q:l:y:s:e:p:D:fh" Option; do
243245 j) proftpd=$OPTARG ;; # Proftpd
244246 k) named=$OPTARG ;; # Named
245247 m) mysql=$OPTARG ;; # MariaDB
248+ M) mysqlclassic=$OPTARG ;; # MySQL
246249 g) postgresql=$OPTARG ;; # PostgreSQL
247250 x) exim=$OPTARG ;; # Exim
248251 z) dovecot=$OPTARG ;; # Dovecot
@@ -275,6 +278,7 @@ set_default_value 'vsftpd' 'yes'
275278set_default_value ' proftpd' ' no'
276279set_default_value ' named' ' yes'
277280set_default_value ' mysql' ' yes'
281+ set_default_value ' mysqlclassic' ' no'
278282set_default_value ' postgresql' ' no'
279283set_default_value ' exim' ' yes'
280284set_default_value ' dovecot' ' yes'
315319if [ " $apache " = " no" ]; then
316320 phpfpm=' yes'
317321fi
322+ if [ " $mysql " = ' yes' ] && [ " $mysqlclassic " = ' yes' ]; then
323+ mysql=' no'
324+ fi
318325
319326# Checking root permissions
320327if [ " x$( id -u) " != ' x0' ]; then
555562if [ " $mysql " = ' yes' ]; then
556563 echo ' - MariaDB Database Server'
557564fi
565+ if [ " $mysqlclassic " = ' yes' ]; then
566+ echo ' - MySQL Database Server'
567+ fi
558568if [ " $postgresql " = ' yes' ]; then
559569 echo ' - PostgreSQL Database Server'
560570fi
@@ -715,6 +725,24 @@ if [ "$mysql" = 'yes' ]; then
715725 curl -s https://mariadb.org/mariadb_release_signing_key.asc | gpg --dearmor | tee /usr/share/keyrings/mariadb-keyring.gpg > /dev/null 2>&1
716726fi
717727
728+ # Installing Mysql8 repo
729+ if [ " $mysqlclassic " = ' yes' ]; then
730+ echo " [ * ] Mysql 8"
731+ echo " deb [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-apt-config" >> /etc/apt/sources.list.d/mysql.list
732+ echo " deb [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-8.0" >> /etc/apt/sources.list.d/mysql.list
733+ echo " deb [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-tools" >> /etc/apt/sources.list.d/mysql.list
734+ echo " #deb [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-tools-preview" >> /etc/apt/sources.list.d/mysql.list
735+ echo " deb-src [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-8.0" >> /etc/apt/sources.list.d/mysql.list
736+
737+ GNUPGHOME=" $( mktemp -d) "
738+ export GNUPGHOME
739+ for keyserver in $( shuf -e ha.pool.sks-keyservers.net hkp://p80.pool.sks-keyservers.net:80 keyserver.ubuntu.com hkp://keyserver.ubuntu.com:80)
740+ do
741+ gpg --no-default-keyring --keyring /usr/share/keyrings/mysql-keyring.gpg --keyserver " ${keyserver} " --recv-keys " 467B942D3A79BD29" > /dev/null 2>&1 && break
742+ done
743+ fi
744+
745+
718746# Installing HestiaCP repo
719747echo " [ * ] Hestia Control Panel"
720748echo " deb [arch=$ARCH signed-by=/usr/share/keyrings/hestia-keyring.gpg] https://$RHOST / $codename main" > $apt /hestia.list
@@ -886,6 +914,13 @@ if [ "$mysql" = 'no' ]; then
886914 software=$( echo " $software " | sed -e " s/mariadb-server//" )
887915 software=$( echo " $software " | sed -e " s/mariadb-client//" )
888916 software=$( echo " $software " | sed -e " s/mariadb-common//" )
917+ fi
918+ if [ " $mysqlclassic " = ' no' ]; then
919+ software=$( echo " $software " | sed -e " s/mysql-server//" )
920+ software=$( echo " $software " | sed -e " s/mysql-client//" )
921+ software=$( echo " $software " | sed -e " s/mysql-common//" )
922+ fi
923+ if [ " $mysql " = ' no' ] && [ " $mysqlclassic " = ' no' ]; then
889924 software=$( echo " $software " | sed -e " s/php$fpm_v -mysql//" )
890925fi
891926if [ " $postgresql " = ' no' ]; then
@@ -1113,7 +1148,7 @@ if [ "$phpfpm" = 'yes' ]; then
11131148fi
11141149
11151150# Database stack
1116- if [ " $mysql " = ' yes' ]; then
1151+ if [ " $mysql " = ' yes' ] || [ " $mysqlclassic " = ' yes ' ] ; then
11171152 installed_db_types=' mysql'
11181153fi
11191154
@@ -1466,11 +1501,12 @@ fi
14661501
14671502
14681503# ----------------------------------------------------------#
1469- # Configure MariaDB #
1504+ # Configure MariaDB / MySQL #
14701505# ----------------------------------------------------------#
14711506
1472- if [ " $mysql " = ' yes' ]; then
1473- echo " [ * ] Configuring MariaDB database server..."
1507+ if [ " $mysql " = ' yes' ] || [ " $mysqlclassic " = ' yes' ]; then
1508+ [ " $mysql " = ' yes' ] && mysql_type=" MariaDB" || mysql_type=" MySQL"
1509+ echo " [ * ] Configuring $mysql_type database server..."
14741510 mycnf=" my-small.cnf"
14751511 if [ $memory -gt 1200000 ]; then
14761512 mycnf=" my-medium.cnf"
@@ -1479,28 +1515,43 @@ if [ "$mysql" = 'yes' ]; then
14791515 mycnf=" my-large.cnf"
14801516 fi
14811517
1482- # Run mysql_install_db
1483- mysql_install_db >> $LOG
1518+ if [ " $mysql_type " = ' MariaDB' ]; then
1519+ # Run mysql_install_db
1520+ mysql_install_db >> $LOG
1521+ fi
1522+
14841523 # Remove symbolic link
14851524 rm -f /etc/mysql/my.cnf
14861525 # Configuring MariaDB
14871526 cp -f $HESTIA_INSTALL_DIR /mysql/$mycnf /etc/mysql/my.cnf
14881527
1528+ # Switch MariaDB inclusions to the MySQL
1529+ if [ " $mysql_type " = ' MySQL' ]; then
1530+ sed -i ' /query_cache_size/d' /etc/mysql/my.cnf
1531+ sed -i ' s|mariadb.conf.d|mysql.conf.d|g' /etc/mysql/my.cnf
1532+ fi
1533+
14891534 update-rc.d mysql defaults > /dev/null 2>&1
14901535 systemctl start mysql >> $LOG
1491- check_result $? " mariadb start failed"
1536+ check_result $? " ${mysql_type,,} start failed"
14921537
1493- # Securing MariaDB installation
1538+ # Securing MariaDB/MySQL installation
14941539 mpass=$( gen_pass)
14951540 echo -e " [client]\npassword='$mpass '\n" > /root/.my.cnf
14961541 chmod 600 /root/.my.cnf
14971542
1498- # Ater root password
1543+ # Alter root password
14991544 mysql -e " ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass '; FLUSH PRIVILEGES;"
1500- # Allow mysql access via socket for startup
1501- mysql -e " UPDATE mysql.global_priv SET priv=json_set(priv, '$.password_last_changed', UNIX_TIMESTAMP(), '$.plugin', 'mysql_native_password', '$.authentication_string', 'invalid', '$.auth_or', json_array(json_object(), json_object('plugin', 'unix_socket'))) WHERE User='root';"
1502- # Disable anonymous users
1503- mysql -e " DELETE FROM mysql.global_priv WHERE User='';"
1545+ if [ " $mysql_type " = ' MariaDB' ]; then
1546+ # Allow mysql access via socket for startup
1547+ mysql -e " UPDATE mysql.global_priv SET priv=json_set(priv, '$.password_last_changed', UNIX_TIMESTAMP(), '$.plugin', 'mysql_native_password', '$.authentication_string', 'invalid', '$.auth_or', json_array(json_object(), json_object('plugin', 'unix_socket'))) WHERE User='root';"
1548+ # Disable anonymous users
1549+ mysql -e " DELETE FROM mysql.global_priv WHERE User='';"
1550+ else
1551+ mysql -e " ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '$mpass ';"
1552+ mysql -e " DELETE FROM mysql.user WHERE User='';"
1553+ mysql -e " DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
1554+ fi
15041555 # Drop test database
15051556 mysql -e " DROP DATABASE IF EXISTS test"
15061557 mysql -e " DELETE FROM mysql.db WHERE Db='test' OR Db='test\\ _%'"
15171568# shellcheck source=/usr/local/hestia/install/upgrade/upgrade.conf
15181569source $HESTIA /install/upgrade/upgrade.conf
15191570
1520- if [ " $mysql " = ' yes' ]; then
1571+ if [ " $mysql " = ' yes' ] || [ " $mysqlclassic " = ' yes ' ] ; then
15211572 # Display upgrade information
15221573 echo " [ * ] Installing phpMyAdmin version v$pma_v ..."
15231574
@@ -1793,11 +1844,21 @@ if [ "$fail2ban" = 'yes' ]; then
17931844 check_result $? " fail2ban start failed"
17941845fi
17951846
1847+ # Configuring MariaDB/MySQL host
1848+ if [ " $mysql " = ' yes' ] || [ " $mysqlclassic " = ' yes' ]; then
1849+ $HESTIA /bin/v-add-database-host mysql localhost root $mpass
1850+ fi
1851+
1852+ # Configuring PostgreSQL host
1853+ if [ " $postgresql " = ' yes' ]; then
1854+ $HESTIA /bin/v-add-database-host pgsql localhost postgres $ppass
1855+ fi
1856+
17961857# ----------------------------------------------------------#
17971858# Install Roundcube #
17981859# ----------------------------------------------------------#
17991860# Min requirements Dovecot + Exim + Mysql
1800- if [ " $mysql " == ' yes' ] && [ " $dovecot " == " yes" ]; then
1861+ if ( [ " $mysql " == ' yes' ] || [ " $mysqlclassic " == ' yes ' ]) && [ " $dovecot " == " yes" ]; then
18011862 echo " [ * ] Install Roundcube..."
18021863 $HESTIA /bin/v-add-sys-roundcube
18031864 write_config_value " WEBMAIL_ALIAS" " webmail"
@@ -1932,18 +1993,6 @@ if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
19321993 systemctl restart apache2
19331994fi
19341995
1935- # Configuring MariaDB host
1936- if [ " $mysql " = ' yes' ]; then
1937- $HESTIA /bin/v-add-database-host mysql localhost root $mpass
1938- fi
1939-
1940- # Configuring PostgreSQL host
1941- if [ " $postgresql " = ' yes' ]; then
1942- $HESTIA /bin/v-add-database-host pgsql localhost postgres $ppass
1943- fi
1944-
1945-
1946-
19471996# Adding default domain
19481997$HESTIA /bin/v-add-web-domain admin $servername $ip
19491998check_result $? " can't create $servername domain"
0 commit comments