Merge pull request #25 from riegercloud/wip

MariaDB 10.3.8
This commit is contained in:
rieger::CLOUD
2018-07-26 12:15:31 +02:00
committed by GitHub
2 changed files with 101 additions and 26 deletions

View File

@@ -36,7 +36,7 @@ clear
echo "" echo ""
echo "*********************************************************" echo "*********************************************************"
echo "You will be asked to set the MariaDB root password twice." echo "You will be asked to set the MariaDB root password twice."
echo " " echo ""
echo "Please just confirm the dialogue (ENTER)." echo "Please just confirm the dialogue (ENTER)."
echo "You will be asked again to set the root pwd" echo "You will be asked again to set the root pwd"
echo "while harden your MariaDB Server!" echo "while harden your MariaDB Server!"

View File

@@ -30,6 +30,23 @@ sudo -u www-data php /var/www/nextcloud/occ files:scan-app-data
fail2ban-client status nextcloud fail2ban-client status nextcloud
ufw status verbose ufw status verbose
} }
###global function to show information regarding the upcoming MariaDB dialogue
function mariadbinfo() {
clear
echo ""
echo "*********************************************************"
echo "You will be asked to set the MariaDB root password twice."
echo ""
echo "Please just confirm the dialogue (ENTER)."
echo "You will be asked again to set the root pwd"
echo "while harden your MariaDB Server!"
echo "*********************************************************"
echo ""
echo "Press ENTER to install MariaDB"
read
clear
}
### START ###
cd /usr/local/src cd /usr/local/src
update_and_clean update_and_clean
###prepare the server environment ###prepare the server environment
@@ -189,44 +206,102 @@ mount -a
service php7.2-fpm restart service php7.2-fpm restart
service nginx restart service nginx restart
###install MariaDB ###install MariaDB
apt install mariadb-server -y apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
if [ ! -f /etc/apt/sources.list.d/mariadb.list ]; then
cat <<EOF > /etc/apt/sources.list.d/mariadb.list
deb [arch=arm64] http://ftp.hosteurope.de/mirror/mariadb.org/repo/10.3/ubuntu bionic main
deb-src http://ftp.hosteurope.de/mirror/mariadb.org/repo/10.3/ubuntu bionic main
EOF
fi
mariadbinfo
apt update && apt install mariadb-server -y
/usr/sbin/service mysql stop
###configure MariaDB ###configure MariaDB
mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak
touch /etc/mysql/my.cnf
cat <<EOF >/etc/mysql/my.cnf cat <<EOF >/etc/mysql/my.cnf
[server] [client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set = utf8mb4
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking
skip-name-resolve skip-name-resolve
innodb_buffer_pool_size = 128M bind-address = 127.0.0.1
max_connections = 200
connect_timeout = 5
wait_timeout = 600
max_allowed_packet = 16M
thread_cache_size = 128
sort_buffer_size = 4M
bulk_insert_buffer_size = 16M
tmp_table_size = 64M
max_heap_table_size = 64M
myisam_recover_options = BACKUP
key_buffer_size = 128M
#open-files-limit = 2000
table_open_cache = 400
myisam_sort_buffer_size = 512M
concurrent_insert = 2
read_buffer_size = 2M
read_rnd_buffer_size = 1M
query_cache_limit = 2M
query_cache_size = 64M
query_cache_type = 1
query_cache_min_res_unit = 2k
log_warnings = 2
slow_query_log_file = /var/log/mysql/mariadb-slow.log
long_query_time = 1
log_slow_verbosity = query_plan
slow-query-log = 1
slow-query-log-file = /var/log/mysql/slow.log
log_bin = /var/log/mysql/mariadb-bin
log_bin_index = /var/log/mysql/mariadb-bin.index
expire_logs_days = 10
max_binlog_size = 100M
default_storage_engine = InnoDB
innodb_buffer_pool_size = 256M
innodb_buffer_pool_instances = 1 innodb_buffer_pool_instances = 1
innodb_flush_log_at_trx_commit = 2 innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 32M innodb_log_buffer_size = 32M
innodb_max_dirty_pages_pct = 90 innodb_max_dirty_pages_pct = 90
query_cache_type = 1 innodb_file_per_table = 1
query_cache_limit = 2M innodb_open_files = 400
query_cache_min_res_unit = 2k innodb_io_capacity = 400
query_cache_size = 64M innodb_flush_method = O_DIRECT
tmp_table_size= 64M
max_heap_table_size= 64M
slow-query-log = 1
slow-query-log-file = /var/log/mysql/slow.log
long_query_time = 1
[client-server]
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
[client]
default-character-set = utf8mb4
[mysqld]
character-set-server = utf8mb4 character-set-server = utf8mb4
collation-server = utf8mb4_general_ci collation-server = utf8mb4_general_ci
transaction_isolation = READ-COMMITTED transaction_isolation = READ-COMMITTED
binlog_format = ROW binlog_format = ROW
innodb_large_prefix=on
innodb_file_format=barracuda [mysqldump]
innodb_file_per_table=1 quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completion
[isamchk]
key_buffer = 16M
!include /etc/mysql/mariadb.cnf
!includedir /etc/mysql/conf.d/
EOF EOF
/usr/sbin/service mysql restart
clear clear
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "The Nextcloud-DB username and password - Attention: password is case-sensitive:" echo "The Nextcloud-DB username and password - Attention: password is case-sensitive:"