Skip to content

Commit 3917d42

Browse files
committed
Add MariaDB Support to Debian Installer and do some small modifications to both.
1 parent c224f0e commit 3917d42

File tree

2 files changed

+40
-49
lines changed

2 files changed

+40
-49
lines changed

install/hst-install-debian.sh

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ if [ "$release" -eq 9 ]; then
2525
php-common php-cgi php-mysql php-curl php-pgsql awstats webalizer
2626
vsftpd proftpd-basic bind9 exim4 exim4-daemon-heavy clamav-daemon
2727
spamassassin dovecot-imapd dovecot-pop3d roundcube-core net-tools
28-
roundcube-mysql roundcube-plugins mysql-server mysql-common
29-
mysql-client postgresql postgresql-contrib phppgadmin phpmyadmin mc
28+
roundcube-mysql roundcube-plugins mariadb-client mariadb-common
29+
mariadb-server postgresql postgresql-contrib phppgadmin phpmyadmin mc
3030
flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota
3131
e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
3232
bsdmainutils cron hestia hestia-nginx hestia-php expect libmail-dkim-perl
@@ -38,8 +38,8 @@ else
3838
php5-mysql php5-curl php5-pgsql awstats webalizer vsftpd net-tools
3939
proftpd-basic bind9 exim4 exim4-daemon-heavy clamav-daemon
4040
spamassassin dovecot-imapd dovecot-pop3d roundcube-core
41-
roundcube-mysql roundcube-plugins mysql-server mysql-common
42-
mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc
41+
roundcube-mysql roundcube-plugins mariadb-client mariadb-common
42+
mariadb-server postgresql postgresql-contrib phppgadmin phpMyAdmin mc
4343
flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota
4444
e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
4545
bsdmainutils cron hestia hestia-nginx hestia-php expect libmail-dkim-perl
@@ -56,7 +56,7 @@ help() {
5656
-v, --vsftpd Install Vsftpd [yes|no] default: yes
5757
-j, --proftpd Install ProFTPD [yes|no] default: no
5858
-k, --named Install Bind [yes|no] default: yes
59-
-m, --mysql Install MySQL [yes|no] default: yes
59+
-m, --mysql Install MariaDB [yes|no] default: yes
6060
-g, --postgresql Install PostgreSQL [yes|no] default: no
6161
-x, --exim Install Exim [yes|no] default: yes
6262
-z, --dovecot Install Dovecot [yes|no] default: yes
@@ -186,7 +186,7 @@ while getopts "a:n:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:fh" Option; do
186186
v) vsftpd=$OPTARG ;; # Vsftpd
187187
j) proftpd=$OPTARG ;; # Proftpd
188188
k) named=$OPTARG ;; # Named
189-
m) mysql=$OPTARG ;; # MySQL
189+
m) mysql=$OPTARG ;; # MariaDB
190190
g) postgresql=$OPTARG ;; # PostgreSQL
191191
x) exim=$OPTARG ;; # Exim
192192
z) dovecot=$OPTARG ;; # Dovecot
@@ -380,7 +380,7 @@ fi
380380

381381
# DB stack
382382
if [ "$mysql" = 'yes' ]; then
383-
echo ' - MySQL Database Server'
383+
echo ' - MariaDB Database Server'
384384
fi
385385
if [ "$postgresql" = 'yes' ]; then
386386
echo ' - PostgreSQL Database Server'
@@ -479,6 +479,9 @@ fi
479479
apt-get -y upgrade
480480
check_result $? 'apt-get upgrade failed'
481481

482+
# Define apt conf location
483+
apt=/etc/apt/sources.list.d
484+
482485
# Installing nginx repo
483486
apt=/etc/apt/sources.list.d
484487
echo "deb http://nginx.org/packages/debian/ $codename nginx" > $apt/nginx.list
@@ -492,6 +495,10 @@ if [ "$multiphp" = 'yes' ] || [ "$phpfpm" = 'yes' ]; then
492495
apt-key add /tmp/php_signing.key
493496
fi
494497

498+
# Installing MariaDB repo
499+
echo "deb http://ams2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu $codename main" > $apt/mariadb.list
500+
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 > /dev/null 2>&1
501+
495502
# Installing hestia repo
496503
echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
497504
wget https://gpg.hestiacp.com/deb_signing.key -O /tmp/deb_signing.key
@@ -555,7 +562,7 @@ service dovecot stop > /dev/null 2>&1
555562
cp /etc/dovecot.conf $hst_backups/dovecot > /dev/null 2>&1
556563
cp -r /etc/dovecot/* $hst_backups/dovecot > /dev/null 2>&1
557564

558-
# Backing up MySQL/MariaDB configuration and data
565+
# Backup MySQL/MariaDB configuration and data
559566
service mysql stop > /dev/null 2>&1
560567
killall -9 mysqld > /dev/null 2>&1
561568
mv /var/lib/mysql $hst_backups/mysql/mysql_datadir > /dev/null 2>&1
@@ -618,9 +625,9 @@ if [ "$dovecot" = 'no' ]; then
618625
software=$(echo "$software" | sed -e "s/dovecot-pop3d//")
619626
fi
620627
if [ "$mysql" = 'no' ]; then
621-
software=$(echo "$software" | sed -e 's/mysql-server//')
622-
software=$(echo "$software" | sed -e 's/mysql-client//')
623-
software=$(echo "$software" | sed -e 's/mysql-common//')
628+
software=$(echo "$software" | sed -e 's/mariadb-server//')
629+
software=$(echo "$software" | sed -e 's/mariadb-client//')
630+
software=$(echo "$software" | sed -e 's/mariadb-common//')
624631
software=$(echo "$software" | sed -e 's/php5-mysql//')
625632
software=$(echo "$software" | sed -e 's/php-mysql//')
626633
software=$(echo "$software" | sed -e 's/phpMyAdmin//')
@@ -1054,33 +1061,25 @@ if [ "$mysql" = 'yes' ]; then
10541061
mycnf="my-large.cnf"
10551062
fi
10561063

1057-
# MySQL configuration
1064+
# Configuring MariaDB
10581065
cp -f $hestiacp/mysql/$mycnf /etc/mysql/my.cnf
1059-
mysql_install_db
1066+
mysql_install_db > /dev/null 2>&1
1067+
10601068
update-rc.d mysql defaults
10611069
service mysql start
1062-
check_result $? "mysql start failed"
1070+
check_result $? "mariadb start failed"
10631071

1064-
# Securing MySQL installation
1072+
# Securing MariaDB installation
10651073
mpass=$(gen_pass)
1066-
mysqladmin -u root password $mpass
1074+
mysqladmin -u root password $mpass > /dev/null 2>&1
10671075
echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf
10681076
chmod 600 /root/.my.cnf
1069-
if [ "$release" = '8' ]; then
1070-
mysql -e "DELETE FROM mysql.user WHERE User=''"
1071-
mysql -e "DROP DATABASE test" >/dev/null 2>&1
1072-
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
1073-
mysql -e "DELETE FROM mysql.user WHERE user='' or password='';"
1074-
mysql -e "FLUSH PRIVILEGES"
1075-
fi
1076-
if [ "$release" = '9' ]; then
1077-
mysql -e "DELETE FROM mysql.user WHERE User=''"
1078-
mysql -e "DROP DATABASE test" >/dev/null 2>&1
1079-
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
1080-
mysql -e "DELETE FROM mysql.user WHERE user='';"
1081-
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$mpass';"
1082-
mysql -e "FLUSH PRIVILEGES"
1083-
fi
1077+
1078+
# Clear MariaDB Test Users and Databases
1079+
mysql -e "DELETE FROM mysql.user WHERE User=''"
1080+
mysql -e "DROP DATABASE test" > /dev/null 2>&1
1081+
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
1082+
mysql -e "DELETE FROM mysql.user WHERE user='';"
10841083

10851084
# Configuring phpMyAdmin
10861085
if [ "$apache" = 'yes' ]; then

install/hst-install-ubuntu.sh

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,10 @@ echo "Upgrade System using apt-get..."
466466
apt-get -y upgrade > /dev/null 2>&1
467467
check_result $? 'apt-get upgrade failed'
468468

469-
# Installing nginx repo
469+
# Define apt conf location
470470
apt=/etc/apt/sources.list.d
471+
472+
# Installing nginx repo
471473
echo "deb http://nginx.org/packages/mainline/ubuntu/ $codename nginx" \
472474
> $apt/nginx.list
473475
wget --quiet http://nginx.org/keys/nginx_signing.key -O /tmp/nginx_signing.key
@@ -479,9 +481,8 @@ if [ "$multiphp" = 'yes' ] || [ "$phpfpm" = 'yes' ]; then
479481
fi
480482

481483
# Installing MariaDB repo
482-
apt=/etc/apt/sources.list.d
483484
echo "deb http://ams2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu $codename main" > $apt/mariadb.list
484-
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
485+
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 > /dev/null 2>&1
485486

486487
# Installing hestia repo
487488
echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
@@ -1057,21 +1058,12 @@ if [ "$mysql" = 'yes' ]; then
10571058
mysqladmin -u root password $mpass > /dev/null 2>&1
10581059
echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf
10591060
chmod 600 /root/.my.cnf
1060-
if [ "$release" = '14.04' ] || [ "$release" = '16.04' ]; then
1061-
mysql -e "DELETE FROM mysql.user WHERE User=''"
1062-
mysql -e "DROP DATABASE test" > /dev/null 2>&1
1063-
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
1064-
mysql -e "DELETE FROM mysql.user WHERE user='' OR password='';"
1065-
mysql -e "FLUSH PRIVILEGES"
1066-
fi
1067-
if [ "$release" = '18.04' ]; then
1068-
mysql -e "DELETE FROM mysql.user WHERE User=''"
1069-
mysql -e "DROP DATABASE test" > /dev/null 2>&1
1070-
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
1071-
mysql -e "DELETE FROM mysql.user WHERE user='';"
1072-
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$mpass';"
1073-
mysql -e "FLUSH PRIVILEGES"
1074-
fi
1061+
1062+
# Clear MariaDB Test Users and Databases
1063+
mysql -e "DELETE FROM mysql.user WHERE User=''"
1064+
mysql -e "DROP DATABASE test" > /dev/null 2>&1
1065+
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
1066+
mysql -e "DELETE FROM mysql.user WHERE user='';"
10751067

10761068
# Configuring phpMyAdmin
10771069
if [ "$apache" = 'yes' ]; then

0 commit comments

Comments
 (0)