|
@@ -47,7 +47,7 @@ software="nginx apache2 apache2-utils apache2-suexec-custom
|
|
|
php$fpm_v-opcache php$fpm_v-pspell php$fpm_v-readline php$fpm_v-xml
|
|
php$fpm_v-opcache php$fpm_v-pspell php$fpm_v-readline php$fpm_v-xml
|
|
|
awstats vsftpd proftpd-basic bind9 exim4 exim4-daemon-heavy
|
|
awstats vsftpd proftpd-basic bind9 exim4 exim4-daemon-heavy
|
|
|
clamav-daemon spamassassin dovecot-imapd dovecot-pop3d dovecot-sieve dovecot-managesieved
|
|
clamav-daemon spamassassin dovecot-imapd dovecot-pop3d dovecot-sieve dovecot-managesieved
|
|
|
- net-tools mariadb-client mariadb-common mariadb-server postgresql
|
|
|
|
|
|
|
+ net-tools mariadb-client mariadb-common mariadb-server mysql-client mysql-common mysql-server postgresql
|
|
|
postgresql-contrib phppgadmin mc flex whois git idn2 unzip zip sudo bc ftp lsof
|
|
postgresql-contrib phppgadmin mc flex whois git idn2 unzip zip sudo bc ftp lsof
|
|
|
rrdtool quota e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban
|
|
rrdtool quota e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban
|
|
|
dnsutils bsdmainutils cron hestia=${HESTIA_INSTALL_VER} hestia-nginx
|
|
dnsutils bsdmainutils cron hestia=${HESTIA_INSTALL_VER} hestia-nginx
|
|
@@ -68,6 +68,7 @@ help() {
|
|
|
-j, --proftpd Install ProFTPD [yes|no] default: no
|
|
-j, --proftpd Install ProFTPD [yes|no] default: no
|
|
|
-k, --named Install Bind [yes|no] default: yes
|
|
-k, --named Install Bind [yes|no] default: yes
|
|
|
-m, --mysql Install MariaDB [yes|no] default: yes
|
|
-m, --mysql Install MariaDB [yes|no] default: yes
|
|
|
|
|
+ -M, --mysql-classic Install MySQL [yes|no] default: no
|
|
|
-g, --postgresql Install PostgreSQL [yes|no] default: no
|
|
-g, --postgresql Install PostgreSQL [yes|no] default: no
|
|
|
-x, --exim Install Exim [yes|no] default: yes
|
|
-x, --exim Install Exim [yes|no] default: yes
|
|
|
-z, --dovecot Install Dovecot [yes|no] default: yes
|
|
-z, --dovecot Install Dovecot [yes|no] default: yes
|
|
@@ -207,6 +208,7 @@ for arg; do
|
|
|
--proftpd) args="${args}-j " ;;
|
|
--proftpd) args="${args}-j " ;;
|
|
|
--named) args="${args}-k " ;;
|
|
--named) args="${args}-k " ;;
|
|
|
--mysql) args="${args}-m " ;;
|
|
--mysql) args="${args}-m " ;;
|
|
|
|
|
+ --mysql-classic) args="${args}-M " ;;
|
|
|
--postgresql) args="${args}-g " ;;
|
|
--postgresql) args="${args}-g " ;;
|
|
|
--exim) args="${args}-x " ;;
|
|
--exim) args="${args}-x " ;;
|
|
|
--dovecot) args="${args}-z " ;;
|
|
--dovecot) args="${args}-z " ;;
|
|
@@ -234,7 +236,7 @@ done
|
|
|
eval set -- "$args"
|
|
eval set -- "$args"
|
|
|
|
|
|
|
|
# Parsing arguments
|
|
# Parsing arguments
|
|
|
-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
|
|
|
|
|
|
|
+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
|
|
|
case $Option in
|
|
case $Option in
|
|
|
a) apache=$OPTARG ;; # Apache
|
|
a) apache=$OPTARG ;; # Apache
|
|
|
w) phpfpm=$OPTARG ;; # PHP-FPM
|
|
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
|
|
|
j) proftpd=$OPTARG ;; # Proftpd
|
|
j) proftpd=$OPTARG ;; # Proftpd
|
|
|
k) named=$OPTARG ;; # Named
|
|
k) named=$OPTARG ;; # Named
|
|
|
m) mysql=$OPTARG ;; # MariaDB
|
|
m) mysql=$OPTARG ;; # MariaDB
|
|
|
|
|
+ M) mysqlclassic=$OPTARG ;; # MySQL
|
|
|
g) postgresql=$OPTARG ;; # PostgreSQL
|
|
g) postgresql=$OPTARG ;; # PostgreSQL
|
|
|
x) exim=$OPTARG ;; # Exim
|
|
x) exim=$OPTARG ;; # Exim
|
|
|
z) dovecot=$OPTARG ;; # Dovecot
|
|
z) dovecot=$OPTARG ;; # Dovecot
|
|
@@ -275,6 +278,7 @@ set_default_value 'vsftpd' 'yes'
|
|
|
set_default_value 'proftpd' 'no'
|
|
set_default_value 'proftpd' 'no'
|
|
|
set_default_value 'named' 'yes'
|
|
set_default_value 'named' 'yes'
|
|
|
set_default_value 'mysql' 'yes'
|
|
set_default_value 'mysql' 'yes'
|
|
|
|
|
+set_default_value 'mysqlclassic' 'no'
|
|
|
set_default_value 'postgresql' 'no'
|
|
set_default_value 'postgresql' 'no'
|
|
|
set_default_value 'exim' 'yes'
|
|
set_default_value 'exim' 'yes'
|
|
|
set_default_value 'dovecot' 'yes'
|
|
set_default_value 'dovecot' 'yes'
|
|
@@ -315,6 +319,9 @@ fi
|
|
|
if [ "$apache" = "no" ]; then
|
|
if [ "$apache" = "no" ]; then
|
|
|
phpfpm='yes'
|
|
phpfpm='yes'
|
|
|
fi
|
|
fi
|
|
|
|
|
+if [ "$mysql" = 'yes' ] && [ "$mysqlclassic" = 'yes' ]; then
|
|
|
|
|
+ mysql='no'
|
|
|
|
|
+fi
|
|
|
|
|
|
|
|
# Checking root permissions
|
|
# Checking root permissions
|
|
|
if [ "x$(id -u)" != 'x0' ]; then
|
|
if [ "x$(id -u)" != 'x0' ]; then
|
|
@@ -555,6 +562,9 @@ echo
|
|
|
if [ "$mysql" = 'yes' ]; then
|
|
if [ "$mysql" = 'yes' ]; then
|
|
|
echo ' - MariaDB Database Server'
|
|
echo ' - MariaDB Database Server'
|
|
|
fi
|
|
fi
|
|
|
|
|
+if [ "$mysqlclassic" = 'yes' ]; then
|
|
|
|
|
+ echo ' - MySQL Database Server'
|
|
|
|
|
+fi
|
|
|
if [ "$postgresql" = 'yes' ]; then
|
|
if [ "$postgresql" = 'yes' ]; then
|
|
|
echo ' - PostgreSQL Database Server'
|
|
echo ' - PostgreSQL Database Server'
|
|
|
fi
|
|
fi
|
|
@@ -715,6 +725,24 @@ if [ "$mysql" = 'yes' ]; then
|
|
|
curl -s https://mariadb.org/mariadb_release_signing_key.asc | gpg --dearmor | tee /usr/share/keyrings/mariadb-keyring.gpg >/dev/null 2>&1
|
|
curl -s https://mariadb.org/mariadb_release_signing_key.asc | gpg --dearmor | tee /usr/share/keyrings/mariadb-keyring.gpg >/dev/null 2>&1
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
|
|
+# Installing Mysql8 repo
|
|
|
|
|
+if [ "$mysqlclassic" = 'yes' ]; then
|
|
|
|
|
+ echo "[ * ] Mysql 8"
|
|
|
|
|
+ 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
|
|
|
|
|
+ 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
|
|
|
|
|
+ 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
|
|
|
|
|
+ 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
|
|
|
|
|
+ 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
|
|
|
|
|
+
|
|
|
|
|
+ GNUPGHOME="$(mktemp -d)"
|
|
|
|
|
+ export GNUPGHOME
|
|
|
|
|
+ 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)
|
|
|
|
|
+ do
|
|
|
|
|
+ gpg --no-default-keyring --keyring /usr/share/keyrings/mysql-keyring.gpg --keyserver "${keyserver}" --recv-keys "467B942D3A79BD29" >/dev/null 2>&1 && break
|
|
|
|
|
+ done
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
# Installing HestiaCP repo
|
|
# Installing HestiaCP repo
|
|
|
echo "[ * ] Hestia Control Panel"
|
|
echo "[ * ] Hestia Control Panel"
|
|
|
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/hestia-keyring.gpg] https://$RHOST/ $codename main" > $apt/hestia.list
|
|
echo "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
|
|
|
software=$(echo "$software" | sed -e "s/mariadb-server//")
|
|
software=$(echo "$software" | sed -e "s/mariadb-server//")
|
|
|
software=$(echo "$software" | sed -e "s/mariadb-client//")
|
|
software=$(echo "$software" | sed -e "s/mariadb-client//")
|
|
|
software=$(echo "$software" | sed -e "s/mariadb-common//")
|
|
software=$(echo "$software" | sed -e "s/mariadb-common//")
|
|
|
|
|
+fi
|
|
|
|
|
+if [ "$mysqlclassic" = 'no' ]; then
|
|
|
|
|
+ software=$(echo "$software" | sed -e "s/mysql-server//")
|
|
|
|
|
+ software=$(echo "$software" | sed -e "s/mysql-client//")
|
|
|
|
|
+ software=$(echo "$software" | sed -e "s/mysql-common//")
|
|
|
|
|
+fi
|
|
|
|
|
+if [ "$mysql" = 'no' ] && [ "$mysqlclassic" = 'no' ]; then
|
|
|
software=$(echo "$software" | sed -e "s/php$fpm_v-mysql//")
|
|
software=$(echo "$software" | sed -e "s/php$fpm_v-mysql//")
|
|
|
fi
|
|
fi
|
|
|
if [ "$postgresql" = 'no' ]; then
|
|
if [ "$postgresql" = 'no' ]; then
|
|
@@ -1113,7 +1148,7 @@ if [ "$phpfpm" = 'yes' ]; then
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
# Database stack
|
|
# Database stack
|
|
|
-if [ "$mysql" = 'yes' ]; then
|
|
|
|
|
|
|
+if [ "$mysql" = 'yes' ] || [ "$mysqlclassic" = 'yes' ]; then
|
|
|
installed_db_types='mysql'
|
|
installed_db_types='mysql'
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
@@ -1466,11 +1501,12 @@ fi
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
#----------------------------------------------------------#
|
|
|
-# Configure MariaDB #
|
|
|
|
|
|
|
+# Configure MariaDB / MySQL #
|
|
|
#----------------------------------------------------------#
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
-if [ "$mysql" = 'yes' ]; then
|
|
|
|
|
- echo "[ * ] Configuring MariaDB database server..."
|
|
|
|
|
|
|
+if [ "$mysql" = 'yes' ] || [ "$mysqlclassic" = 'yes' ]; then
|
|
|
|
|
+ [ "$mysql" = 'yes' ] && mysql_type="MariaDB" || mysql_type="MySQL"
|
|
|
|
|
+ echo "[ * ] Configuring $mysql_type database server..."
|
|
|
mycnf="my-small.cnf"
|
|
mycnf="my-small.cnf"
|
|
|
if [ $memory -gt 1200000 ]; then
|
|
if [ $memory -gt 1200000 ]; then
|
|
|
mycnf="my-medium.cnf"
|
|
mycnf="my-medium.cnf"
|
|
@@ -1479,28 +1515,43 @@ if [ "$mysql" = 'yes' ]; then
|
|
|
mycnf="my-large.cnf"
|
|
mycnf="my-large.cnf"
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
- # Run mysql_install_db
|
|
|
|
|
- mysql_install_db >> $LOG
|
|
|
|
|
|
|
+ if [ "$mysql_type" = 'MariaDB' ]; then
|
|
|
|
|
+ # Run mysql_install_db
|
|
|
|
|
+ mysql_install_db >> $LOG
|
|
|
|
|
+ fi
|
|
|
|
|
+
|
|
|
# Remove symbolic link
|
|
# Remove symbolic link
|
|
|
rm -f /etc/mysql/my.cnf
|
|
rm -f /etc/mysql/my.cnf
|
|
|
# Configuring MariaDB
|
|
# Configuring MariaDB
|
|
|
cp -f $HESTIA_INSTALL_DIR/mysql/$mycnf /etc/mysql/my.cnf
|
|
cp -f $HESTIA_INSTALL_DIR/mysql/$mycnf /etc/mysql/my.cnf
|
|
|
|
|
|
|
|
|
|
+ # Switch MariaDB inclusions to the MySQL
|
|
|
|
|
+ if [ "$mysql_type" = 'MySQL' ]; then
|
|
|
|
|
+ sed -i '/query_cache_size/d' /etc/mysql/my.cnf
|
|
|
|
|
+ sed -i 's|mariadb.conf.d|mysql.conf.d|g' /etc/mysql/my.cnf
|
|
|
|
|
+ fi
|
|
|
|
|
+
|
|
|
update-rc.d mysql defaults > /dev/null 2>&1
|
|
update-rc.d mysql defaults > /dev/null 2>&1
|
|
|
systemctl start mysql >> $LOG
|
|
systemctl start mysql >> $LOG
|
|
|
- check_result $? "mariadb start failed"
|
|
|
|
|
|
|
+ check_result $? "${mysql_type,,} start failed"
|
|
|
|
|
|
|
|
- # Securing MariaDB installation
|
|
|
|
|
|
|
+ # Securing MariaDB/MySQL installation
|
|
|
mpass=$(gen_pass)
|
|
mpass=$(gen_pass)
|
|
|
echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf
|
|
echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf
|
|
|
chmod 600 /root/.my.cnf
|
|
chmod 600 /root/.my.cnf
|
|
|
|
|
|
|
|
- # Ater root password
|
|
|
|
|
|
|
+ # Alter root password
|
|
|
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
|
|
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
|
|
|
- # Allow mysql access via socket for startup
|
|
|
|
|
- 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';"
|
|
|
|
|
- # Disable anonymous users
|
|
|
|
|
- mysql -e "DELETE FROM mysql.global_priv WHERE User='';"
|
|
|
|
|
|
|
+ if [ "$mysql_type" = 'MariaDB' ]; then
|
|
|
|
|
+ # Allow mysql access via socket for startup
|
|
|
|
|
+ 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';"
|
|
|
|
|
+ # Disable anonymous users
|
|
|
|
|
+ mysql -e "DELETE FROM mysql.global_priv WHERE User='';"
|
|
|
|
|
+ else
|
|
|
|
|
+ mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '$mpass';"
|
|
|
|
|
+ mysql -e "DELETE FROM mysql.user WHERE User='';"
|
|
|
|
|
+ mysql -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
|
|
|
|
|
+ fi
|
|
|
# Drop test database
|
|
# Drop test database
|
|
|
mysql -e "DROP DATABASE IF EXISTS test"
|
|
mysql -e "DROP DATABASE IF EXISTS test"
|
|
|
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
|
|
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
|
|
@@ -1517,7 +1568,7 @@ fi
|
|
|
# shellcheck source=/usr/local/hestia/install/upgrade/upgrade.conf
|
|
# shellcheck source=/usr/local/hestia/install/upgrade/upgrade.conf
|
|
|
source $HESTIA/install/upgrade/upgrade.conf
|
|
source $HESTIA/install/upgrade/upgrade.conf
|
|
|
|
|
|
|
|
-if [ "$mysql" = 'yes' ]; then
|
|
|
|
|
|
|
+if [ "$mysql" = 'yes' ] || [ "$mysqlclassic" = 'yes' ]; then
|
|
|
# Display upgrade information
|
|
# Display upgrade information
|
|
|
echo "[ * ] Installing phpMyAdmin version v$pma_v..."
|
|
echo "[ * ] Installing phpMyAdmin version v$pma_v..."
|
|
|
|
|
|
|
@@ -1793,11 +1844,21 @@ if [ "$fail2ban" = 'yes' ]; then
|
|
|
check_result $? "fail2ban start failed"
|
|
check_result $? "fail2ban start failed"
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
|
|
+# Configuring MariaDB/MySQL host
|
|
|
|
|
+if [ "$mysql" = 'yes' ] || [ "$mysqlclassic" = 'yes' ]; then
|
|
|
|
|
+ $HESTIA/bin/v-add-database-host mysql localhost root $mpass
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
|
|
+# Configuring PostgreSQL host
|
|
|
|
|
+if [ "$postgresql" = 'yes' ]; then
|
|
|
|
|
+ $HESTIA/bin/v-add-database-host pgsql localhost postgres $ppass
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
#----------------------------------------------------------#
|
|
#----------------------------------------------------------#
|
|
|
# Install Roundcube #
|
|
# Install Roundcube #
|
|
|
#----------------------------------------------------------#
|
|
#----------------------------------------------------------#
|
|
|
# Min requirements Dovecot + Exim + Mysql
|
|
# Min requirements Dovecot + Exim + Mysql
|
|
|
-if [ "$mysql" == 'yes' ] && [ "$dovecot" == "yes" ]; then
|
|
|
|
|
|
|
+if ([ "$mysql" == 'yes' ] || [ "$mysqlclassic" == 'yes' ]) && [ "$dovecot" == "yes" ]; then
|
|
|
echo "[ * ] Install Roundcube..."
|
|
echo "[ * ] Install Roundcube..."
|
|
|
$HESTIA/bin/v-add-sys-roundcube
|
|
$HESTIA/bin/v-add-sys-roundcube
|
|
|
write_config_value "WEBMAIL_ALIAS" "webmail"
|
|
write_config_value "WEBMAIL_ALIAS" "webmail"
|
|
@@ -1932,18 +1993,6 @@ if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
|
|
|
systemctl restart apache2
|
|
systemctl restart apache2
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-# Configuring MariaDB host
|
|
|
|
|
-if [ "$mysql" = 'yes' ]; then
|
|
|
|
|
- $HESTIA/bin/v-add-database-host mysql localhost root $mpass
|
|
|
|
|
-fi
|
|
|
|
|
-
|
|
|
|
|
-# Configuring PostgreSQL host
|
|
|
|
|
-if [ "$postgresql" = 'yes' ]; then
|
|
|
|
|
- $HESTIA/bin/v-add-database-host pgsql localhost postgres $ppass
|
|
|
|
|
-fi
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
# Adding default domain
|
|
# Adding default domain
|
|
|
$HESTIA/bin/v-add-web-domain admin $servername $ip
|
|
$HESTIA/bin/v-add-web-domain admin $servername $ip
|
|
|
check_result $? "can't create $servername domain"
|
|
check_result $? "can't create $servername domain"
|