From aa938623a7ccc924d1bff375c987c31322f4f783 Mon Sep 17 00:00:00 2001 From: TechnologyClassroom Date: Sat, 19 Jul 2025 22:16:38 -0400 Subject: [PATCH] V 1.11.6 --- nextcloud-ins.sh | 3893 +++++++++++++++++++++++----------------------- 1 file changed, 1989 insertions(+), 1904 deletions(-) diff --git a/nextcloud-ins.sh b/nextcloud-ins.sh index 678ef24..567cefb 100644 --- a/nextcloud-ins.sh +++ b/nextcloud-ins.sh @@ -1,71 +1,118 @@ #!/bin/bash # Nextcloud Install Script -# Made for freshly installed, server Linux distributions using AMD64(x86_64) architecture: -# Debian (11,12), Enterprise Linux (9), Ubuntu Server (22), Fedora Server (39). +# Made for freshly installed, server Linux distributions using AMD64(x86_64) +# architecture: Debian (11,12), Enterprise Linux (9), Ubuntu Server (22), +# Fedora Server (39). # -# It will update OS, preconfigure everything, install neeeded packages and Nextcloud. -# There is also support for upgrading Nextcloud and OS packages - just download and run latest version of this script again. -# It will create backup of current Nextcloud (but without users files) with it's database, -# and then it will upgrade OS, software packages, and Nextcloud to the newest major version. -# -# This Nextcloud installer allows Nextcloud to work locally and thru Internet: -# - by local IP address with and without SSL (it use self signed SSL certificate for https protocol), -# - or using domain name (local and over Internet), if domain is already configured correctly (it will use free Let's Encrypt service for certificate signing). -# Software packages that are installed are Apache (web server), MariaDB (database server), PHP (programming language with interpreter), -# NTP (time synchronization service), and Redis (cache server) installed and used. -# Some other software is also installed for better preview/thumbnails generation by Nextcloud like LibreOffice, Krita, ImageMagick etc. -# Also new service for Nextcloud "cron" is generated that starts every 5 minutes so Nextcloud can do some work while users are not connected. +# It will update OS, preconfigure everything, install neeeded packages and +# Nextcloud. There is also support for upgrading Nextcloud and OS packages - +# just download and run latest version of this script again. It will create +# backup of current Nextcloud (but without users files) with it's database, and +# then it will upgrade OS, software packages, and Nextcloud to the newest major +# version. +# +# This Nextcloud installer allows Nextcloud to work locally and thru Internet: +# - by local IP address with and without SSL (it use self signed SSL +# certificate for https protocol), +# - or using domain name (local and over Internet), if domain is already +# configured correctly (it will use free Let's Encrypt service for certificate +# signing). +# Software packages that are installed are Apache (web server), MariaDB +# (database server), PHP (programming language with interpreter), NTP (time +# synchronization service), and Redis (cache server) installed and used. Some +# other software is also installed for better preview/thumbnails generation by +# Nextcloud like LibreOffice, Krita, ImageMagick etc. Also new service for +# Nextcloud "cron" is generated that starts every 5 minutes so Nextcloud can do +# some work while users are not connected. # # To use it just use this command: # sudo sh -c "wget -q https://github.com/nicrame/Linux-Scripts/raw/master/nextcloud-ins.sh && chmod +x nextcloud-ins.sh && ./nextcloud-ins.sh" -# -# You may also add specific variables (lang, mail, dns) that will be used, by adding them to command above, e.g: +# +# You may also add specific variables (lang, mail, dns) that will be used, by +# adding them to command above, e.g: # sudo sh -c "wget -q https://github.com/nicrame/Linux-Scripts/raw/master/nextcloud-ins.sh && chmod +x nextcloud-ins.sh && ./nextcloud-ins.sh -lang=pl -mail=my@email.com -dm=domain.com -nv=24 -fdir=/mnt/sdc5/nextcloud-data" -# -lang (for language) variable will install additional packages specific for choosed language and setup Nextcloud default language. -# Currently supported languages are: none (default value is none/empty that will use web browser language), Arabic (ar), Chinese (zh), French (fr), Hindi (hi), Polish (pl), Spanish (es) and Ukrainian (uk), -# -mail variable is for information about Your email address, that will be presented to let's encrypt, so you'll be informed if domain name SSL certificate couldn't be refreshed (default value is empty), -# -dm variable is used when you got (already prepared and configured) domain name, it will be configured for Nextcloud server and Let's encrypt SSL (default value is empty), -# -nv variable allows You to choose older version to install, supported version are: 24-28, empty (it will install newest, currently v28), -# -fdir variable gives possibility to specify where user files and nextcloud.log files are stored, by default this settings will leave default location that is /var/www/nextcloud/data. -# selecting different location will not change Nextcloud configuration, but will bind (using mount) default Nextcloud location, to the specified one, -# so using security mechanism like chroot/jail/SELinux etc. will work correctly without additional configuration for them, web server etc. -# For example if option -fdir=/mnt/sdc5/nextcloud-data will be used, then entering directory /var/www/nextcloud/data will actually show content of /mnt/sdc5/nextcloud-data. -# If you want to use spaces between words in directory name, then put path inside double quotes, eg. -fdir="/mnt/sdx/users data folder" -# To remember data directory settings, and mount them each OS start /etc/fstab file is modified. -# -restore argument is used for recovering older Nextcloud files/database. Since v 1.11 this script generate backup of Nextcloud files (excluding users data) and database, -# when it's started for upgrade process (which is default scenario when script is started another time after first use). -# You may use -restore=list to check the list of previously created backups, or -restore=filename.tar.bz2 to select one of those files, and use them to restore Nextcloud. -# IMPORTSNT: When -restore argument is used with any kind of parameters, then any other is ignored. It means You can't use -restore variable with others. -# - backup argument starts backup process without doing any other tasks. It will just create backup of current Nextcloud install with database, excluding users files. -# Similar to -restore, -backup argument must be used by itself (any other one used with it will be ignored). +# -lang (for language) variable will install additional packages specific for +# choosed language and setup Nextcloud default language. Currently supported +# languages are: none (default value is none/empty that will use web browser +# language), Arabic (ar), Chinese (zh), French (fr), Hindi (hi), Polish (pl), +# Spanish (es) and Ukrainian (uk), +# -mail variable is for information about Your email address, that will be +# presented to let's encrypt, so you'll be informed if domain name SSL +# certificate couldn't be refreshed (default value is empty), +# -dm variable is used when you got (already prepared and configured) domain +# name, it will be configured for Nextcloud server and Let's encrypt SSL +# (default value is empty), +# -nv variable allows You to choose older version to install, supported version +# are: 24-28, empty (it will install newest, currently v28), +# -fdir variable gives possibility to specify where user files and +# nextcloud.log files are stored, by default this settings will leave default +# location that is /var/www/nextcloud/data. selecting different location will +# not change Nextcloud configuration, but will bind (using mount) default +# Nextcloud location, to the specified one, so using security mechanism like +# chroot/jail/SELinux etc. will work correctly without additional +# configuration for them, web server etc. For example if option +# -fdir=/mnt/sdc5/nextcloud-data will be used, then entering directory +# /var/www/nextcloud/data will actually show content of +# /mnt/sdc5/nextcloud-data. If you want to use spaces between words in +# directory name, then put path inside double quotes, eg. +# -fdir="/mnt/sdx/users data folder" To remember data directory settings, and +# mount them each OS start /etc/fstab file is modified. +# -restore argument is used for recovering older Nextcloud files/database. +# Since v 1.11 this script generate backup of Nextcloud files (excluding users +# data) and database, when it's started for upgrade process (which is default +# scenario when script is started another time after first use). You may use +# -restore=list to check the list of previously created backups, or +# -restore=filename.tar.bz2 to select one of those files, and use them to +# restore Nextcloud. IMPORTANT: When -restore argument is used with any kind +# of parameters, then any other is ignored. It means You can't use -restore +# variable with others. +# - backup argument starts backup process without doing any other tasks. It +# will just create backup of current Nextcloud install with database, +# excluding users files. Similar to -restore, -backup argument must be used +# by itself (any other one used with it will be ignored). # -# After install You may use Your web browser to access Nextcloud using local IP address, -# or domain name, if You have configured it before (DNS settings and router configuration should be done earlier by You). -# Both HTTP and HTTPS protocols are enabled by default. Localhost, self signed certificate is generated by default. -# For additional domain name certificate is made with Let's encrypt service (if You use -dns command variable). +# After install You may use Your web browser to access Nextcloud using local IP +# address, or domain name, if You have configured it before (DNS settings and +# router configuration should be done earlier by You). Both HTTP and HTTPS +# protocols are enabled by default. Localhost, self signed certificate is +# generated by default. For additional domain name certificate is made with +# Let's encrypt service (if You use -dns command variable). # # It was tested with many Nextcloud versions since v24. -# +# # Updates of Nextcloud after using this script: -# By default this script disable "updatenotification" app that allow You to update Nextcloud using its own administration panel. -# The main reason is that such updates sometimes leave files that shouldn't stay, which brakes their update system at some points (i had many such problems in the past). -# So, to update Your Nextcloud there are two options: -# 1. You may start the script again, so it will upgrade OS with software packages and Nextcloud to the newest version (it will update between major releases too), -# so for example if You have version 28.0.3, it will update it to 29.0.5(that was newest version when this text was edited). -# But if You selected version to install with "-nv" argument (eg. -nv=28) when script was used for the first time, then starting script again will not update anything, -# and leave You with selected version, without updating minor release. -# So if You got 28.0.3 it will not update to 28.0.9 (because when this script is released, i do not know how many minor releases will be in the future). -# 2. You may also enable updatenotification app using Nextcloud GUI - go to Apps -> Disabled apps -> click on Enable button near "Update notification" app. -# Then go to "Administration settings" -> Overview, where will be information about new version available for updating. -# -# In case of problems, LOG output is generated at /var/log/nextcloud-installer.log. -# Attach it if You want to report errors with installation process. -# -# If You want to report errors that You think may be made by the script, please add logs of Apache web server, PHP and Nextcloud. -# This script was never tested, and not reccommended to be used on containerization environment (like Docker, LXC etc.), -# but it was working well on virtual machines under KVM and Virtualbox. -# +# By default this script disable "updatenotification" app that allow You to +# update Nextcloud using its own administration panel. The main reason is that +# such updates sometimes leave files that shouldn't stay, which brakes their +# update system at some points (i had many such problems in the past). So, to +# update Your Nextcloud there are two options: +# +# 1. You may start the script again, so it will upgrade OS with software +# packages and Nextcloud to the newest version (it will update between major +# releases too), so for example if You have version 28.0.3, it will update it +# to 29.0.5(that was newest version when this text was edited). But if You +# selected version to install with "-nv" argument (eg. -nv=28) when script was +# used for the first time, then starting script again will not update +# anything, and leave You with selected version, without updating minor +# release. So if You got 28.0.3 it will not update to 28.0.9 (because when +# this script is released, i do not know how many minor releases will be in +# the future). +# 2. You may also enable updatenotification app using Nextcloud GUI - go to +# Apps -> Disabled apps -> click on Enable button near "Update notification" +# app. Then go to "Administration settings" -> Overview, where will be +# information about new version available for updating. +# +# In case of problems, LOG output is generated at +# /var/log/nextcloud-installer.log. Attach it if You want to report errors with +# installation process. +# +# If You want to report errors that You think may be made by the script, please +# add logs of Apache web server, PHP and Nextcloud. This script was never +# tested, and not recommended to be used on containerization environment (like +# Docker, LXC etc.), but it was working well on virtual machines under KVM and +# Virtualbox. +# # More info: # [PL/ENG] https://www.marcinwilk.eu/pl/projects/linux-scripts/nextcloud-debian-install/ # @@ -74,9 +121,14 @@ # Marcin Wilk # # License: -# 1. You use it at your own risk. Author is not responsible for any damage made with that script. -# 2. Any changes of scripts must be shared with author with authorization to implement them and share. +# 1. You use it at your own risk. Author is not responsible for any damage made +# with that script. +# 2. Any changes of scripts must be shared with author with authorization to +# implement them and share. # +# V 1.11.6 - 19.07.2025 +# - Small tweaks making the comments no more than 80 characters wide, fixing +# typos, and changing spacing to two spaces. # V 1.11.5 - 25.05.2025 # - another portion of small tweaks # V 1.11.4 - 24.05.2025 @@ -88,8 +140,11 @@ # - add few commands to be sure that PHP 8.3 is used as default version # - small tweaks and fixes # V 1.11.2 - 16.05.2024 -# - new arguments: -backup (create backup) and -restore (that can be used with "list" argument to show previously created backups, or with filename to be used to restore from it) -# - modify backup file names to show more data (date, time and Nextcloud version that is backed up) +# - new arguments: -backup (create backup) and -restore (that can be used with +# "list" argument to show previously created backups, or with filename to be +# used to restore from it) +# - modify backup file names to show more data (date, time and Nextcloud +# version that is backed up) # V 1.11 - 16.05.2024 # - update documentation inside script # - first attempt to backup/restore feature @@ -98,17 +153,24 @@ # - PHP 8.3 is used as default PHP version # - Fixed error that didn't allow installing older versions of NC (and PHP 7.4) # V 1.9.2 - 13.03.2024 -# - checking if "fdir" parameter is configured for already existing directory and inform if not -# - fix spaces in directory names saved in fstab, configured with -fdir argument (fstab do not support spaces in directory names) +# - checking if "fdir" parameter is configured for already existing directory +# and inform if not +# - fix spaces in directory names saved in fstab, configured with -fdir +# argument (fstab do not support spaces in directory names) # V 1.9.1 - 12.03.2024 -# - some description update, and few code changes that do not affect the way script is working +# - some description update, and few code changes that do not affect the way +# script is working # - add PHP 8.3 install code (currently disabled) for future NC versions # V 1.9 - 04.03.2024 -# - new argument that allow to configure location of "data" directory, where user files are stored (it use mount/fstab for security mechanisms compatibility) +# - new argument that allow to configure location of "data" directory, where +# user files are stored (it use mount/fstab for security mechanisms +# compatibility) # V 1.8.1 - 07.02.2024 -# - first release with Fedora Server 39, and Ubuntu Server LTS (22) distributions support +# - first release with Fedora Server 39, and Ubuntu Server LTS (22) +# distributions support # V 1.8 - 04.02.2024 -# - first release with Rocky Linux (9), and other Enterprise Linux distributions support +# - first release with Rocky Linux (9), and other Enterprise Linux +# distributions support # - a little more code optimizations # V 1.7.1 - 01.02.2024 # - code cleanup @@ -119,19 +181,24 @@ # - add HTTP2 protocol support # - small security fix # - description improvements -# - packages installer will now wait for background jobs (started by OS) to finish +# - packages installer will now wait for background jobs (started by OS) to +# finish # V 1.6.4 - 04.01.2024 # - add bz2 module for PHP (for Nextcloud Hub 7) # - Happy New Year! # V 1.6.3 - 04.11.2023 # - more tests and fixes # V 1.6.2 - 04.08.2023 -# - few more languages are now supported with -lang= parameter (Arabic (ar), Chinese (zh), French (fr), Hindi (hi), Polish (pl), Spanish (es) and Ukrainian (uk)) +# - few more languages are now supported with -lang= parameter (Arabic (ar), +# Chinese (zh), French (fr), Hindi (hi), Polish (pl), Spanish (es) and +# Ukrainian (uk)) # V 1.6.1 - 03.08.2023 # - small tweaks # V 1.6 - 03.08.2023 -# - new variable that allows installing older version of Nextcloud (users reported problems with NC27) -# - the script rename itself after finished work (so installer command always refer to newest version) +# - new variable that allows installing older version of Nextcloud (users +# reported problems with NC27) +# - the script rename itself after finished work (so installer command always +# refer to newest version) # - script is prepared now for few future updates (up to Nextcloud v28) # V 1.5.5 - 12.07.2023 # - better description of variables use on error @@ -140,10 +207,14 @@ # - add support for Debian 12 # - add support for Nextcloud Hub 5 (v27) # V 1.5.3 - 15.04.2023 -# - using older PHP (8.1) version for upgrade process before removing it (Nextcloud do not finish upgrade process on never PHP version) -# - check for currently installed Nextcloud version and update it so many times it needs (till version 26) - when upgrading from script version 1.4 or older +# - using older PHP (8.1) version for upgrade process before removing it +# (Nextcloud do not finish upgrade process on never PHP version) +# - check for currently installed Nextcloud version and update it so many times +# it needs (till version 26) - when upgrading from script version 1.4 or +# older # V 1.5.2 - 05.04.2023 -# - twofactor_webauthn app installing and enabling for more security (tested with Yubikey) +# - twofactor_webauthn app installing and enabling for more security (tested +# with Yubikey) # V 1.5.1 - 05.04.2023 # - upgrading from 1.4 and lower added to the script # V 1.5 - 25.03.2023 @@ -151,33 +222,41 @@ # - enable opcache again (it looks it's working fine now) # - use PHP version 8.2 # - install ddclient (dynamic DNS client - https://ddclient.net/) -# - install miniupnpc ans start it for port 80 and 443 to open ports (it should be unncessary) +# - install miniupnpc ans start it for port 80 and 443 to open ports (it should +# be unncessary) # - added more variables to use (language, e_mail) # - installer is now creating file with it's version number for future upgrades -# - installer detects if older versions of script were used, and in the next release it will upgrade everything (nextcloud included) +# - installer detects if older versions of script were used, and in the next +# release it will upgrade everything (nextcloud included) # V 1.4.3 - 24.02.2023 -# - allow self-signed certificate config option in nextcloud (it may be needed sometimes) +# - allow self-signed certificate config option in nextcloud (it may be needed +# sometimes) # V 1.4.2 - 10.02.2023 -# - completely disable opcache because of many segfaults even when JIT is completely disabled +# - completely disable opcache because of many segfaults even when JIT is +# completely disabled # V 1.4.1 - 08.02.2023 -# - opcache jit cache in php has been disabled because of many segfaults reported +# - opcache jit cache in php has been disabled because of many segfaults +# reported # V 1.4 - 31.01.2023 -# - fixes thanks to "maybe" user from hejto.pl portal (ufw, redis, chmods etc.) Thank You! +# - fixes thanks to "maybe" user from hejto.pl portal (ufw, redis, chmods etc.) +# Thank You! # V 1.3 - 30.01.2023 # - fix PHP 8.1 installing # - more data stored to log for better error handling # V 1.2 - 23.01.2023 # - some performance fixes (better support for large files) # V 1.1 - 04.08.2022 -# - added support for adding domain name as command line variable (with let's ecnrypt support) +# - added support for adding domain name as command line variable (with let's +# encrypt support) # - added crontab job for certbot (Let's encrypt) and some more description # V 1.0 - 20.06.2022 # - initial version based on private install script (for EL) -# +# # Future plans: # - add option to delete very old backups -# - add High Performance Backend (HPB) for Nextcloud (Push Service) -# - make backup of Nextcloud script (excluding users files) and database for recovery before upgrade (done with v1.11) +# - add High Performance Backend (HPB) for Nextcloud (Push Service) +# - make backup of Nextcloud script (excluding users files) and database for +# recovery before upgrade (done with v1.11) # - add option to restore previosly created backup (done with v1.11). export LC_ALL=C @@ -189,55 +268,55 @@ debvf=/etc/debian_version ubuvf=/etc/dpkg/origins/ubuntu if [ -e $debvf ] then - if [ -e $ubuvf ] - then - ubuv=$( cat /etc/lsb-release | grep "Ubuntu 22" | awk -F '"' '{print $2}' ) - unset debv - debv=$ubuv - ubu19=$( cat /etc/lsb-release | grep "Ubuntu 19" ) - ubu20=$( cat /etc/lsb-release | grep "Ubuntu 20" ) - ubu21=$( cat /etc/lsb-release | grep "Ubuntu 21" ) - ubu22=$( cat /etc/lsb-release | grep "Ubuntu 22" ) - ubu23=$( cat /etc/lsb-release | grep "Ubuntu 23" ) - ubu24=$( cat /etc/lsb-release | grep "Ubuntu 24" ) - else - debv=$( cat $debvf ) - fi + if [ -e $ubuvf ] + then + ubuv=$( cat /etc/lsb-release | grep "Ubuntu 22" | awk -F '"' '{print $2}' ) + unset debv + debv=$ubuv + ubu19=$( cat /etc/lsb-release | grep "Ubuntu 19" ) + ubu20=$( cat /etc/lsb-release | grep "Ubuntu 20" ) + ubu21=$( cat /etc/lsb-release | grep "Ubuntu 21" ) + ubu22=$( cat /etc/lsb-release | grep "Ubuntu 22" ) + ubu23=$( cat /etc/lsb-release | grep "Ubuntu 23" ) + ubu24=$( cat /etc/lsb-release | grep "Ubuntu 24" ) + else + debv=$( cat $debvf ) + fi fi elvf=/etc/redhat-release fedvf=/etc/fedora-release if [ -e $elvf ] then - elv=$( cat $elvf ) - el6=$( cat /etc/redhat-release | grep "release 6" ) - el7=$( cat /etc/redhat-release | grep "release 7" ) - el8=$( cat /etc/redhat-release | grep "release 8" ) - el9=$( cat /etc/redhat-release | grep "release 9" ) - el10=$( cat /etc/redhat-release | grep "release 10" ) - el11=$( cat /etc/redhat-release | grep "release 11" ) - if [ -e $fedvf ] - then - fed36=$( cat /etc/redhat-release | grep "release 36" ) - fed37=$( cat /etc/redhat-release | grep "release 37" ) - fed38=$( cat /etc/redhat-release | grep "release 38" ) - fed39=$( cat /etc/redhat-release | grep "release 39" ) - fed40=$( cat /etc/redhat-release | grep "release 40" ) - fed41=$( cat /etc/redhat-release | grep "release 41" ) - fed42=$( cat /etc/redhat-release | grep "release 42" ) - fed43=$( cat /etc/redhat-release | grep "release 43" ) - fed44=$( cat /etc/redhat-release | grep "release 44" ) - fi + elv=$( cat $elvf ) + el6=$( cat /etc/redhat-release | grep "release 6" ) + el7=$( cat /etc/redhat-release | grep "release 7" ) + el8=$( cat /etc/redhat-release | grep "release 8" ) + el9=$( cat /etc/redhat-release | grep "release 9" ) + el10=$( cat /etc/redhat-release | grep "release 10" ) + el11=$( cat /etc/redhat-release | grep "release 11" ) + if [ -e $fedvf ] + then + fed36=$( cat /etc/redhat-release | grep "release 36" ) + fed37=$( cat /etc/redhat-release | grep "release 37" ) + fed38=$( cat /etc/redhat-release | grep "release 38" ) + fed39=$( cat /etc/redhat-release | grep "release 39" ) + fed40=$( cat /etc/redhat-release | grep "release 40" ) + fed41=$( cat /etc/redhat-release | grep "release 41" ) + fed42=$( cat /etc/redhat-release | grep "release 42" ) + fed43=$( cat /etc/redhat-release | grep "release 43" ) + fed44=$( cat /etc/redhat-release | grep "release 44" ) + fi fi addr=$( hostname -I ) addr1=$( hostname -I | awk '{print $1}' ) cdir=$( pwd ) if [ -e $debvf ] then - websrv_usr=www-data + websrv_usr=www-data fi if [ -e $elvf ] then - websrv_usr=apache + websrv_usr=apache fi lang="" mail="" @@ -254,870 +333,872 @@ scrpt=nextcloud-ins backup=false while [ "$#" -gt 0 ]; do - case "$1" in - -lang=*) lang="${1#*=}" ;; - -mail=*) mail="${1#*=}" ;; - -dm=*) dm="${1#*=}" ;; - -nv=*) nv="${1#*=}" ;; - -fdir=*) fdir="${1#*=}" ;; - -restore=*) restore="${1#*=}" ;; - -backup) backup=true ;; - *) - echo "Unknown parameter: $1" >&2; - echo "Remember to add one, or more variables after equals sign:"; - echo -e "Eg. \e[1;32m-\e[39;0mmail\e[1;32m=\e[39;0mmail@example.com \e[1;32m-\e[39;0mlang\e[1;32m=\e[39;0mpl \e[1;32m-\e[39;0mdm\e[1;32m=\e[39;0mdomain.com \e[1;32m-\e[39;0mnv\e[1;32m=\e[39;0m24 \e[1;32m-\e[39;0mfdir\e[1;32m=\e[39;0m/mnt/sdc5/nextcloud-data"; - echo "or in case of backup and restore argument (used individually):"; - echo -e "\e[1;32m-\e[39;0mbackup"; - echo -e "\e[1;32m-\e[39;0mrestore\e[1;32m=\e[39;0mlist"; - echo -e "\e[1;32m-\e[39;0mrestore\e[1;32m=\e[39;0mfilename-from-list.tar.bz2"; - exit 1 - ;; - esac - shift + case "$1" in + -lang=*) lang="${1#*=}" ;; + -mail=*) mail="${1#*=}" ;; + -dm=*) dm="${1#*=}" ;; + -nv=*) nv="${1#*=}" ;; + -fdir=*) fdir="${1#*=}" ;; + -restore=*) restore="${1#*=}" ;; + -backup) backup=true ;; + *) + echo "Unknown parameter: $1" >&2; + echo "Remember to add one, or more variables after equals sign:"; + echo -e "Eg. \e[1;32m-\e[39;0mmail\e[1;32m=\e[39;0mmail@example.com \e[1;32m-\e[39;0mlang\e[1;32m=\e[39;0mpl \e[1;32m-\e[39;0mdm\e[1;32m=\e[39;0mdomain.com \e[1;32m-\e[39;0mnv\e[1;32m=\e[39;0m24 \e[1;32m-\e[39;0mfdir\e[1;32m=\e[39;0m/mnt/sdc5/nextcloud-data"; + echo "or in case of backup and restore argument (used individually):"; + echo -e "\e[1;32m-\e[39;0mbackup"; + echo -e "\e[1;32m-\e[39;0mrestore\e[1;32m=\e[39;0mlist"; + echo -e "\e[1;32m-\e[39;0mrestore\e[1;32m=\e[39;0mfilename-from-list.tar.bz2"; + exit 1 + ;; + esac + shift done # More complex tasks are functions now: function restart_websrv { - if [ -e $debvf ] - then - systemctl stop apache2 >> $insl 2>&1 - fi - if [ -e $elvf ] - then - systemctl stop httpd >> $insl 2>&1 - if [ -d /etc/opt/remi/php74 ] - then - systemctl stop php74-php-fpm >> $insl 2>&1 - rm -rf /var/opt/remi/php74/lib/php/opcache/* >> $insl 2>&1 - systemctl start php74-php-fpm >> $insl 2>&1 - fi - fi - if [ -d /etc/opt/remi/php81 ] - then - systemctl stop php81-php-fpm >> $insl 2>&1 - rm -rf /var/opt/remi/php81/lib/php/opcache/* >> $insl 2>&1 - systemctl start php81-php-fpm >> $insl 2>&1 - fi - if [ -d /etc/opt/remi/php82 ] - then - systemctl stop php82-php-fpm >> $insl 2>&1 - rm -rf /var/opt/remi/php82/lib/php/opcache/* >> $insl 2>&1 - systemctl start php82-php-fpm >> $insl 2>&1 - fi - if [ -d /etc/opt/remi/php83 ] - then - systemctl stop php83-php-fpm >> $insl 2>&1 - rm -rf /var/opt/remi/php83/lib/php/opcache/* >> $insl 2>&1 - systemctl start php83-php-fpm >> $insl 2>&1 - fi - if [ -d /etc/opt/remi/php84 ] - then - systemctl stop php84-php-fpm >> $insl 2>&1 - rm -rf /var/opt/remi/php84/lib/php/opcache/* >> $insl 2>&1 - systemctl start php84-php-fpm >> $insl 2>&1 - fi - if [ -d /etc/opt/remi/php85 ] - then - systemctl stop php85-php-fpm >> $insl 2>&1 - rm -rf /var/opt/remi/php85/lib/php/opcache/* >> $insl 2>&1 - systemctl start php85-php-fpm >> $insl 2>&1 - fi - if [ -d /etc/opt/remi/php86 ] - then - systemctl stop php86-php-fpm >> $insl 2>&1 - rm -rf /var/opt/remi/php86/lib/php/opcache/* >> $insl 2>&1 - systemctl start php86-php-fpm >> $insl 2>&1 - fi - if [ -e $elvf ] - then - systemctl start httpd >> $insl 2>&1 - fi - if [ -e $debvf ] - then - systemctl start apache2 >> $insl 2>&1 - fi + if [ -e $debvf ] + then + systemctl stop apache2 >> $insl 2>&1 + fi + if [ -e $elvf ] + then + systemctl stop httpd >> $insl 2>&1 + if [ -d /etc/opt/remi/php74 ] + then + systemctl stop php74-php-fpm >> $insl 2>&1 + rm -rf /var/opt/remi/php74/lib/php/opcache/* >> $insl 2>&1 + systemctl start php74-php-fpm >> $insl 2>&1 + fi + fi + if [ -d /etc/opt/remi/php81 ] + then + systemctl stop php81-php-fpm >> $insl 2>&1 + rm -rf /var/opt/remi/php81/lib/php/opcache/* >> $insl 2>&1 + systemctl start php81-php-fpm >> $insl 2>&1 + fi + if [ -d /etc/opt/remi/php82 ] + then + systemctl stop php82-php-fpm >> $insl 2>&1 + rm -rf /var/opt/remi/php82/lib/php/opcache/* >> $insl 2>&1 + systemctl start php82-php-fpm >> $insl 2>&1 + fi + if [ -d /etc/opt/remi/php83 ] + then + systemctl stop php83-php-fpm >> $insl 2>&1 + rm -rf /var/opt/remi/php83/lib/php/opcache/* >> $insl 2>&1 + systemctl start php83-php-fpm >> $insl 2>&1 + fi + if [ -d /etc/opt/remi/php84 ] + then + systemctl stop php84-php-fpm >> $insl 2>&1 + rm -rf /var/opt/remi/php84/lib/php/opcache/* >> $insl 2>&1 + systemctl start php84-php-fpm >> $insl 2>&1 + fi + if [ -d /etc/opt/remi/php85 ] + then + systemctl stop php85-php-fpm >> $insl 2>&1 + rm -rf /var/opt/remi/php85/lib/php/opcache/* >> $insl 2>&1 + systemctl start php85-php-fpm >> $insl 2>&1 + fi + if [ -d /etc/opt/remi/php86 ] + then + systemctl stop php86-php-fpm >> $insl 2>&1 + rm -rf /var/opt/remi/php86/lib/php/opcache/* >> $insl 2>&1 + systemctl start php86-php-fpm >> $insl 2>&1 + fi + if [ -e $elvf ] + then + systemctl start httpd >> $insl 2>&1 + fi + if [ -e $debvf ] + then + systemctl start apache2 >> $insl 2>&1 + fi } function maintenance_window_setup { - if grep -q "maintenance_window_start" "/var/www/nextcloud/config/config.php" - then - echo "!!!!!!! Maintenance window time already configured." >> $insl 2>&1 - else - echo "!!!!!!! Adding maintenance window time inside NC config." >> $insl 2>&1 - sed -i "/installed' => true,/a\ \ 'maintenance_window_start' => '1'," /var/www/nextcloud/config/config.php - fi + if grep -q "maintenance_window_start" "/var/www/nextcloud/config/config.php" + then + echo "!!!!!!! Maintenance window time already configured." >> $insl 2>&1 + else + echo "!!!!!!! Adding maintenance window time inside NC config." >> $insl 2>&1 + sed -i "/installed' => true,/a\ \ 'maintenance_window_start' => '1'," /var/www/nextcloud/config/config.php + fi } -# Check if Nextcloud was updated with nv variable, and if yes, skip doing anything to not brake it. -# This is version made for newer version of script, so it report that it was running under $ver_file. +# Check if Nextcloud was updated with nv variable, and if yes, skip doing +# anything to not brake it. This is version made for newer version of script, +# so it report that it was running under $ver_file. function nv_check_upd { - echo "Older version of Nextcloud configured, skipping updates and exit." - echo "Older version of Nextcloud configured, skipping updates and exit." >> $insl 2>&1 - echo -e "pver=$ver lang=$lang mail=$mail dm=$dm nv=$nv fdir=$fdir\n$( $ver_file - echo -e "Version $ver was succesfully installed at $(date +%d-%m-%Y_%H:%M:%S)\n$( $ver_file - mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh - unset LC_ALL - exit 0 + echo "Older version of Nextcloud configured, skipping updates and exit." + echo "Older version of Nextcloud configured, skipping updates and exit." >> $insl 2>&1 + echo -e "pver=$ver lang=$lang mail=$mail dm=$dm nv=$nv fdir=$fdir\n$( $ver_file + echo -e "Version $ver was succesfully installed at $(date +%d-%m-%Y_%H:%M:%S)\n$( $ver_file + mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh + unset LC_ALL + exit 0 } function nv_check_upd_cur { - echo "Older version of Nextcloud configured, skipping updates and exit." - echo "Older version of Nextcloud configured, skipping updates and exit." >> $insl 2>&1 - mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh - unset LC_ALL - exit 0 + echo "Older version of Nextcloud configured, skipping updates and exit." + echo "Older version of Nextcloud configured, skipping updates and exit." >> $insl 2>&1 + mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh + unset LC_ALL + exit 0 } function nv_upd_simpl { - rm -rf /var/www/nextcloud/composer.lock >> $insl 2>&1 - rm -rf /var/www/nextcloud/package-lock.json >> $insl 2>&1 - rm -rf /var/www/nextcloud/package.json >> $insl 2>&1 - rm -rf /var/www/nextcloud/composer.json >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/updater/updater.phar --no-interaction >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ upgrade >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:mode --off >> $insl 2>&1 + rm -rf /var/www/nextcloud/composer.lock >> $insl 2>&1 + rm -rf /var/www/nextcloud/package-lock.json >> $insl 2>&1 + rm -rf /var/www/nextcloud/package.json >> $insl 2>&1 + rm -rf /var/www/nextcloud/composer.json >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/updater/updater.phar --no-interaction >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ upgrade >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:mode --off >> $insl 2>&1 } function update_os { - if [ -e $debvf ] - then - apt-get update -o DPkg::Lock::Timeout=-1 >> $insl 2>&1 && DEBIAN_FRONTEND=noninteractive apt-get upgrade -y --force-yes -o Dpkg::Options::="--force-confold" -o DPkg::Lock::Timeout=-1 >> $insl 2>&1 && apt-get autoremove -y >> $insl 2>&1 - fi - if [ -e $elvf ] - then - dnf update -y -q >> $insl 2>&1 - fi + if [ -e $debvf ] + then + apt-get update -o DPkg::Lock::Timeout=-1 >> $insl 2>&1 && DEBIAN_FRONTEND=noninteractive apt-get upgrade -y --force-yes -o Dpkg::Options::="--force-confold" -o DPkg::Lock::Timeout=-1 >> $insl 2>&1 && apt-get autoremove -y >> $insl 2>&1 + fi + if [ -e $elvf ] + then + dnf update -y -q >> $insl 2>&1 + fi } function install_soft { - echo "!!!!!!! Installing all needed standard packages" >> $insl 2>&1 - if [ -e $debvf ] - then - DEBIAN_FRONTEND=noninteractive apt-get install -y -o DPkg::Lock::Timeout=-1 git lbzip2 unzip zip lsb-release locales-all rsync wget curl sed screen gawk mc sudo net-tools ethtool vim nano ufw apt-transport-https ca-certificates software-properties-common miniupnpc jq libfontconfig1 libfuse2 socat tree ffmpeg imagemagick webp libreoffice ghostscript bindfs >> $insl 2>&1 - yes | sudo DEBIAN_FRONTEND=noninteractive apt-get -yqq -o DPkg::Lock::Timeout=-1 install ddclient >> $insl 2>&1 - fi - if [ -e $elvf ] - then - # Disabling SELinux for testing purposes here. By default just let it run and configure things instead. - # setenforce 0 >> $insl 2>&1 - # grubby --update-kernel ALL --args selinux=0 >> $insl 2>&1 - # sed --in-place=.bak 's/^SELINUX\=enforcing/SELINUX\=permissive/g' /etc/selinux/config - - if [ -e $fedvf ] - then - dnf install -y -q https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm >> $insl 2>&1 - dnf config-manager -y --enable fedora-cisco-openh264 >> $insl 2>&1 - else - dnf -q config-manager --set-enabled crb && dnf install -y -q epel-release >> $insl 2>&1 - dnf install -q --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm -y >> $insl 2>&1 - dnf install -q --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm -y >> $insl 2>&1 - fi - dnf install -y -q git lbzip2 unzip zip lsb-release rsync wget curl sed screen gawk mc sudo net-tools ethtool vim nano ca-certificates miniupnpc jq fontconfig-devel socat tree ffmpeg ImageMagick libwebp libreoffice ghostscript ddclient >> $insl 2>&1 - fi + echo "!!!!!!! Installing all needed standard packages" >> $insl 2>&1 + if [ -e $debvf ] + then + DEBIAN_FRONTEND=noninteractive apt-get install -y -o DPkg::Lock::Timeout=-1 git lbzip2 unzip zip lsb-release locales-all rsync wget curl sed screen gawk mc sudo net-tools ethtool vim nano ufw apt-transport-https ca-certificates software-properties-common miniupnpc jq libfontconfig1 libfuse2 socat tree ffmpeg imagemagick webp libreoffice ghostscript bindfs >> $insl 2>&1 + yes | sudo DEBIAN_FRONTEND=noninteractive apt-get -yqq -o DPkg::Lock::Timeout=-1 install ddclient >> $insl 2>&1 + fi + if [ -e $elvf ] + then + # Disabling SELinux for testing purposes here. By default just + # let it run and configure things instead. + # setenforce 0 >> $insl 2>&1 + # grubby --update-kernel ALL --args selinux=0 >> $insl 2>&1 + # sed --in-place=.bak 's/^SELINUX\=enforcing/SELINUX\=permissive/g' /etc/selinux/config + + if [ -e $fedvf ] + then + dnf install -y -q https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm >> $insl 2>&1 + dnf config-manager -y --enable fedora-cisco-openh264 >> $insl 2>&1 + else + dnf -q config-manager --set-enabled crb && dnf install -y -q epel-release >> $insl 2>&1 + dnf install -q --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm -y >> $insl 2>&1 + dnf install -q --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm -y >> $insl 2>&1 + fi + dnf install -y -q git lbzip2 unzip zip lsb-release rsync wget curl sed screen gawk mc sudo net-tools ethtool vim nano ca-certificates miniupnpc jq fontconfig-devel socat tree ffmpeg ImageMagick libwebp libreoffice ghostscript ddclient >> $insl 2>&1 + fi } function install_php81 { - if [ -e $debvf ] - then - curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg >> $insl 2>&1 - sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' >> $insl 2>&1 - apt-get update >> $insl 2>&1 - apt-get install -y -o DPkg::Lock::Timeout=-1 php8.1 libapache2-mod-php8.1 libmagickcore-6.q16-6-extra php8.1-mysql php8.1-common php8.1-redis php8.1-dom php8.1-curl php8.1-exif php8.1-fileinfo php8.1-bcmath php8.1-gmp php8.1-imagick php8.1-mbstring php8.1-xml php8.1-zip php8.1-iconv php8.1-intl php8.1-simplexml php8.1-xmlreader php8.1-ftp php8.1-ssh2 php8.1-sockets php8.1-gd php8.1-imap php8.1-soap php8.1-xmlrpc php8.1-apcu php8.1-dev php8.1-cli >> $insl 2>&1 - fi - if [ -e $elvf ] - then - if [ -e $fedvf ] - then - dnf install -y -q https://rpms.remirepo.net/fedora/remi-release-39.rpm >> $insl 2>&1 - dnf config-manager --set-enabled remi - else - dnf install -y -q https://rpms.remirepo.net/enterprise/remi-release-9.rpm >> $insl 2>&1 - fi - dnf install -y -q php81 php81-php-apcu php81-php-opcache php81-php-mysql php81-php-bcmath php81-php-common php81-php-geos php81-php-gmp php81-php-pecl-imagick-im7 php81-php-pecl-lzf php81-php-pecl-mcrypt php81-php-pecl-recode php81-php-process php81-php-zstd php81-php-redis php81-php-dom php81-php-curl php81-php-exif php81-php-fileinfo php81-php-mbstring php81-php-xml php81-php-zip php81-php-iconv php81-php-intl php81-php-simplexml php81-php-xmlreader php81-php-ftp php81-php-ssh2 php81-php-sockets php81-php-gd php81-php-imap php81-php-soap php81-php-xmlrpc php81-php-apcu php81-php-cli php81-php-ast php81-php-brotli php81-php-enchant php81-php-ffi php81-php-lz4 php81-php-phalcon5 php81-php-phpiredis php81-php-smbclient php81-php-tidy php81-php-xz >> $insl 2>&1 - dnf install -y -q php81-syspaths php81-mod_php >> $insl 2>&1 - ln -s /var/opt/remi/php81/log/php-fpm /var/log/php81-fpm - fi + if [ -e $debvf ] + then + curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg >> $insl 2>&1 + sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' >> $insl 2>&1 + apt-get update >> $insl 2>&1 + apt-get install -y -o DPkg::Lock::Timeout=-1 php8.1 libapache2-mod-php8.1 libmagickcore-6.q16-6-extra php8.1-mysql php8.1-common php8.1-redis php8.1-dom php8.1-curl php8.1-exif php8.1-fileinfo php8.1-bcmath php8.1-gmp php8.1-imagick php8.1-mbstring php8.1-xml php8.1-zip php8.1-iconv php8.1-intl php8.1-simplexml php8.1-xmlreader php8.1-ftp php8.1-ssh2 php8.1-sockets php8.1-gd php8.1-imap php8.1-soap php8.1-xmlrpc php8.1-apcu php8.1-dev php8.1-cli >> $insl 2>&1 + fi + if [ -e $elvf ] + then + if [ -e $fedvf ] + then + dnf install -y -q https://rpms.remirepo.net/fedora/remi-release-39.rpm >> $insl 2>&1 + dnf config-manager --set-enabled remi + else + dnf install -y -q https://rpms.remirepo.net/enterprise/remi-release-9.rpm >> $insl 2>&1 + fi + dnf install -y -q php81 php81-php-apcu php81-php-opcache php81-php-mysql php81-php-bcmath php81-php-common php81-php-geos php81-php-gmp php81-php-pecl-imagick-im7 php81-php-pecl-lzf php81-php-pecl-mcrypt php81-php-pecl-recode php81-php-process php81-php-zstd php81-php-redis php81-php-dom php81-php-curl php81-php-exif php81-php-fileinfo php81-php-mbstring php81-php-xml php81-php-zip php81-php-iconv php81-php-intl php81-php-simplexml php81-php-xmlreader php81-php-ftp php81-php-ssh2 php81-php-sockets php81-php-gd php81-php-imap php81-php-soap php81-php-xmlrpc php81-php-apcu php81-php-cli php81-php-ast php81-php-brotli php81-php-enchant php81-php-ffi php81-php-lz4 php81-php-phalcon5 php81-php-phpiredis php81-php-smbclient php81-php-tidy php81-php-xz >> $insl 2>&1 + dnf install -y -q php81-syspaths php81-mod_php >> $insl 2>&1 + ln -s /var/opt/remi/php81/log/php-fpm /var/log/php81-fpm + fi } function install_php82 { - if [ -e $debvf ] - then - if [ -e $ubuvf ] - then - add-apt-repository -y ppa:ondrej/php >> $insl 2>&1 - DEBIAN_FRONTEND=noninteractive - else - curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg >> $insl 2>&1 - sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' >> $insl 2>&1 - fi - apt-get update >> $insl 2>&1 - apt-get install -y -o DPkg::Lock::Timeout=-1 php8.2 libapache2-mod-php8.2 libmagickcore-6.q16-6-extra php8.2-mysql php8.2-common php8.2-bz2 php8.2-redis php8.2-dom php8.2-curl php8.2-exif php8.2-fileinfo php8.2-bcmath php8.2-gmp php8.2-imagick php8.2-mbstring php8.2-xml php8.2-zip php8.2-iconv php8.2-intl php8.2-simplexml php8.2-xmlreader php8.2-ftp php8.2-ssh2 php8.2-sockets php8.2-gd php8.2-imap php8.2-soap php8.2-xmlrpc php8.2-apcu php8.2-dev php8.2-cli >> $insl 2>&1 - fi - if [ -e $elvf ] - then - if [ -e $fedvf ] - then - dnf install -y -q https://rpms.remirepo.net/fedora/remi-release-39.rpm >> $insl 2>&1 - dnf config-manager --set-enabled remi - else - dnf install -y -q https://rpms.remirepo.net/enterprise/remi-release-9.rpm >> $insl 2>&1 - fi - dnf install -y -q php82 php82-php-apcu php82-php-opcache php82-php-mysql php82-php-bcmath php82-php-common php82-php-geos php82-php-gmp php82-php-pecl-imagick-im7 php82-php-pecl-lzf php82-php-pecl-mcrypt php82-php-pecl-recode php82-php-process php82-php-zstd php82-php-redis php82-php-dom php82-php-curl php82-php-exif php82-php-fileinfo php82-php-mbstring php82-php-xml php82-php-zip php82-php-iconv php82-php-intl php82-php-simplexml php82-php-xmlreader php82-php-ftp php82-php-ssh2 php82-php-sockets php82-php-gd php82-php-imap php82-php-soap php82-php-xmlrpc php82-php-apcu php82-php-cli php82-php-ast php82-php-brotli php82-php-enchant php82-php-ffi php82-php-lz4 php82-php-phalcon5 php82-php-phpiredis php82-php-smbclient php82-php-tidy php82-php-xz >> $insl 2>&1 - dnf install -y -q php82-syspaths php82-mod_php >> $insl 2>&1 - ln -s /var/opt/remi/php82/log/php-fpm /var/log/php82-fpm - fi + if [ -e $debvf ] + then + if [ -e $ubuvf ] + then + add-apt-repository -y ppa:ondrej/php >> $insl 2>&1 + DEBIAN_FRONTEND=noninteractive + else + curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg >> $insl 2>&1 + sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' >> $insl 2>&1 + fi + apt-get update >> $insl 2>&1 + apt-get install -y -o DPkg::Lock::Timeout=-1 php8.2 libapache2-mod-php8.2 libmagickcore-6.q16-6-extra php8.2-mysql php8.2-common php8.2-bz2 php8.2-redis php8.2-dom php8.2-curl php8.2-exif php8.2-fileinfo php8.2-bcmath php8.2-gmp php8.2-imagick php8.2-mbstring php8.2-xml php8.2-zip php8.2-iconv php8.2-intl php8.2-simplexml php8.2-xmlreader php8.2-ftp php8.2-ssh2 php8.2-sockets php8.2-gd php8.2-imap php8.2-soap php8.2-xmlrpc php8.2-apcu php8.2-dev php8.2-cli >> $insl 2>&1 + fi + if [ -e $elvf ] + then + if [ -e $fedvf ] + then + dnf install -y -q https://rpms.remirepo.net/fedora/remi-release-39.rpm >> $insl 2>&1 + dnf config-manager --set-enabled remi + else + dnf install -y -q https://rpms.remirepo.net/enterprise/remi-release-9.rpm >> $insl 2>&1 + fi + dnf install -y -q php82 php82-php-apcu php82-php-opcache php82-php-mysql php82-php-bcmath php82-php-common php82-php-geos php82-php-gmp php82-php-pecl-imagick-im7 php82-php-pecl-lzf php82-php-pecl-mcrypt php82-php-pecl-recode php82-php-process php82-php-zstd php82-php-redis php82-php-dom php82-php-curl php82-php-exif php82-php-fileinfo php82-php-mbstring php82-php-xml php82-php-zip php82-php-iconv php82-php-intl php82-php-simplexml php82-php-xmlreader php82-php-ftp php82-php-ssh2 php82-php-sockets php82-php-gd php82-php-imap php82-php-soap php82-php-xmlrpc php82-php-apcu php82-php-cli php82-php-ast php82-php-brotli php82-php-enchant php82-php-ffi php82-php-lz4 php82-php-phalcon5 php82-php-phpiredis php82-php-smbclient php82-php-tidy php82-php-xz >> $insl 2>&1 + dnf install -y -q php82-syspaths php82-mod_php >> $insl 2>&1 + ln -s /var/opt/remi/php82/log/php-fpm /var/log/php82-fpm + fi } function install_php83 { - if [ -e $debvf ] - then - if [ -e $ubuvf ] - then - add-apt-repository -y ppa:ondrej/php >> $insl 2>&1 - DEBIAN_FRONTEND=noninteractive - else - curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg >> $insl 2>&1 - sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' >> $insl 2>&1 - fi - apt-get update >> $insl 2>&1 - apt-get install -y -o DPkg::Lock::Timeout=-1 php8.3 libapache2-mod-php8.3 libmagickcore-6.q16-6-extra php8.3-mysql php8.3-common php8.3-bz2 php8.3-redis php8.3-dom php8.3-curl php8.3-exif php8.3-fileinfo php8.3-bcmath php8.3-gmp php8.3-imagick php8.3-mbstring php8.3-xml php8.3-zip php8.3-iconv php8.3-intl php8.3-simplexml php8.3-xmlreader php8.3-ftp php8.3-ssh2 php8.3-sockets php8.3-gd php8.3-imap php8.3-soap php8.3-xmlrpc php8.3-apcu php8.3-dev php8.3-cli >> $insl 2>&1 - fi - if [ -e $elvf ] - then - if [ -e $fedvf ] - then - dnf install -y -q https://rpms.remirepo.net/fedora/remi-release-39.rpm >> $insl 2>&1 - dnf config-manager --set-enabled remi - else - dnf install -y -q https://rpms.remirepo.net/enterprise/remi-release-9.rpm >> $insl 2>&1 - fi - dnf install -y -q php83 php83-php-apcu php83-php-opcache php83-php-mysql php83-php-bcmath php83-php-common php83-php-geos php83-php-gmp php83-php-pecl-imagick-im7 php83-php-pecl-lzf php83-php-pecl-mcrypt php83-php-pecl-recode php83-php-process php83-php-zstd php83-php-redis php83-php-dom php83-php-curl php83-php-exif php83-php-fileinfo php83-php-mbstring php83-php-xml php83-php-zip php83-php-iconv php83-php-intl php83-php-simplexml php83-php-xmlreader php83-php-ftp php83-php-ssh2 php83-php-sockets php83-php-gd php83-php-imap php83-php-soap php83-php-xmlrpc php83-php-apcu php83-php-cli php83-php-ast php83-php-brotli php83-php-enchant php83-php-ffi php83-php-lz4 php83-php-phalcon5 php83-php-phpiredis php83-php-smbclient php83-php-tidy php83-php-xz >> $insl 2>&1 - dnf install -y -q php83-syspaths php83-mod_php >> $insl 2>&1 - ln -s /var/opt/remi/php83/log/php-fpm /var/log/php83-fpm - fi + if [ -e $debvf ] + then + if [ -e $ubuvf ] + then + add-apt-repository -y ppa:ondrej/php >> $insl 2>&1 + DEBIAN_FRONTEND=noninteractive + else + curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg >> $insl 2>&1 + sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' >> $insl 2>&1 + fi + apt-get update >> $insl 2>&1 + apt-get install -y -o DPkg::Lock::Timeout=-1 php8.3 libapache2-mod-php8.3 libmagickcore-6.q16-6-extra php8.3-mysql php8.3-common php8.3-bz2 php8.3-redis php8.3-dom php8.3-curl php8.3-exif php8.3-fileinfo php8.3-bcmath php8.3-gmp php8.3-imagick php8.3-mbstring php8.3-xml php8.3-zip php8.3-iconv php8.3-intl php8.3-simplexml php8.3-xmlreader php8.3-ftp php8.3-ssh2 php8.3-sockets php8.3-gd php8.3-imap php8.3-soap php8.3-xmlrpc php8.3-apcu php8.3-dev php8.3-cli >> $insl 2>&1 + fi + if [ -e $elvf ] + then + if [ -e $fedvf ] + then + dnf install -y -q https://rpms.remirepo.net/fedora/remi-release-39.rpm >> $insl 2>&1 + dnf config-manager --set-enabled remi + else + dnf install -y -q https://rpms.remirepo.net/enterprise/remi-release-9.rpm >> $insl 2>&1 + fi + dnf install -y -q php83 php83-php-apcu php83-php-opcache php83-php-mysql php83-php-bcmath php83-php-common php83-php-geos php83-php-gmp php83-php-pecl-imagick-im7 php83-php-pecl-lzf php83-php-pecl-mcrypt php83-php-pecl-recode php83-php-process php83-php-zstd php83-php-redis php83-php-dom php83-php-curl php83-php-exif php83-php-fileinfo php83-php-mbstring php83-php-xml php83-php-zip php83-php-iconv php83-php-intl php83-php-simplexml php83-php-xmlreader php83-php-ftp php83-php-ssh2 php83-php-sockets php83-php-gd php83-php-imap php83-php-soap php83-php-xmlrpc php83-php-apcu php83-php-cli php83-php-ast php83-php-brotli php83-php-enchant php83-php-ffi php83-php-lz4 php83-php-phalcon5 php83-php-phpiredis php83-php-smbclient php83-php-tidy php83-php-xz >> $insl 2>&1 + dnf install -y -q php83-syspaths php83-mod_php >> $insl 2>&1 + ln -s /var/opt/remi/php83/log/php-fpm /var/log/php83-fpm + fi } function install_php84 { - if [ -e $debvf ] - then - if [ -e $ubuvf ] - then - add-apt-repository -y ppa:ondrej/php >> $insl 2>&1 - DEBIAN_FRONTEND=noninteractive - else - curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg >> $insl 2>&1 - sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' >> $insl 2>&1 - fi - apt-get update >> $insl 2>&1 - apt-get install -y -o DPkg::Lock::Timeout=-1 php8.4 libapache2-mod-php8.4 libmagickcore-6.q16-6-extra php8.4-mysql php8.4-common php8.4-bz2 php8.4-redis php8.4-dom php8.4-curl php8.4-exif php8.4-fileinfo php8.4-bcmath php8.4-gmp php8.4-imagick php8.4-mbstring php8.4-xml php8.4-zip php8.4-iconv php8.4-intl php8.4-simplexml php8.4-xmlreader php8.4-ftp php8.4-ssh2 php8.4-sockets php8.4-gd php8.4-imap php8.4-soap php8.4-xmlrpc php8.4-apcu php8.4-dev php8.4-cli >> $insl 2>&1 - fi - if [ -e $elvf ] - then - if [ -e $fedvf ] - then - dnf install -y -q https://rpms.remirepo.net/fedora/remi-release-42.rpm >> $insl 2>&1 - dnf config-manager --set-enabled remi - else - dnf install -y -q https://rpms.remirepo.net/enterprise/remi-release-9.rpm >> $insl 2>&1 - fi - dnf install -y -q php84 php84-php-apcu php84-php-opcache php84-php-mysql php84-php-bcmath php84-php-common php84-php-geos php84-php-gmp php84-php-pecl-imagick-im7 php84-php-pecl-lzf php84-php-pecl-mcrypt php84-php-pecl-recode php84-php-process php84-php-zstd php84-php-redis php84-php-dom php84-php-curl php84-php-exif php84-php-fileinfo php84-php-mbstring php84-php-xml php84-php-zip php84-php-iconv php84-php-intl php84-php-simplexml php84-php-xmlreader php84-php-ftp php84-php-ssh2 php84-php-sockets php84-php-gd php84-php-imap php84-php-soap php84-php-xmlrpc php84-php-apcu php84-php-cli php84-php-ast php84-php-brotli php84-php-enchant php84-php-ffi php84-php-lz4 php84-php-phalcon5 php84-php-phpiredis php84-php-smbclient php84-php-tidy php84-php-xz >> $insl 2>&1 - dnf install -y -q php84-syspaths php84-mod_php >> $insl 2>&1 - ln -s /var/opt/remi/php84/log/php-fpm /var/log/php84-fpm - fi + if [ -e $debvf ] + then + if [ -e $ubuvf ] + then + add-apt-repository -y ppa:ondrej/php >> $insl 2>&1 + DEBIAN_FRONTEND=noninteractive + else + curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg >> $insl 2>&1 + sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' >> $insl 2>&1 + fi + apt-get update >> $insl 2>&1 + apt-get install -y -o DPkg::Lock::Timeout=-1 php8.4 libapache2-mod-php8.4 libmagickcore-6.q16-6-extra php8.4-mysql php8.4-common php8.4-bz2 php8.4-redis php8.4-dom php8.4-curl php8.4-exif php8.4-fileinfo php8.4-bcmath php8.4-gmp php8.4-imagick php8.4-mbstring php8.4-xml php8.4-zip php8.4-iconv php8.4-intl php8.4-simplexml php8.4-xmlreader php8.4-ftp php8.4-ssh2 php8.4-sockets php8.4-gd php8.4-imap php8.4-soap php8.4-xmlrpc php8.4-apcu php8.4-dev php8.4-cli >> $insl 2>&1 + fi + if [ -e $elvf ] + then + if [ -e $fedvf ] + then + dnf install -y -q https://rpms.remirepo.net/fedora/remi-release-42.rpm >> $insl 2>&1 + dnf config-manager --set-enabled remi + else + dnf install -y -q https://rpms.remirepo.net/enterprise/remi-release-9.rpm >> $insl 2>&1 + fi + dnf install -y -q php84 php84-php-apcu php84-php-opcache php84-php-mysql php84-php-bcmath php84-php-common php84-php-geos php84-php-gmp php84-php-pecl-imagick-im7 php84-php-pecl-lzf php84-php-pecl-mcrypt php84-php-pecl-recode php84-php-process php84-php-zstd php84-php-redis php84-php-dom php84-php-curl php84-php-exif php84-php-fileinfo php84-php-mbstring php84-php-xml php84-php-zip php84-php-iconv php84-php-intl php84-php-simplexml php84-php-xmlreader php84-php-ftp php84-php-ssh2 php84-php-sockets php84-php-gd php84-php-imap php84-php-soap php84-php-xmlrpc php84-php-apcu php84-php-cli php84-php-ast php84-php-brotli php84-php-enchant php84-php-ffi php84-php-lz4 php84-php-phalcon5 php84-php-phpiredis php84-php-smbclient php84-php-tidy php84-php-xz >> $insl 2>&1 + dnf install -y -q php84-syspaths php84-mod_php >> $insl 2>&1 + ln -s /var/opt/remi/php84/log/php-fpm /var/log/php84-fpm + fi } # This is function for installing currently used latest version of PHP. function install_php { - install_php83 + install_php83 } # Check and add http2 support to Apache. function add_http2 { - if [ -e $debvf ] - then - if grep -q "Protocols" "/etc/apache2/sites-available/nextcloud.conf" - then - echo "!!!!!!! HTTP2 already inside vhost config." >> $insl 2>&1 - else - echo "!!!!!!! HTTP2 adding to vhost" >> $insl 2>&1 - sed -i "/LimitRequestBody 0/a\ \ H2WindowSize 5242880" /etc/apache2/sites-available/nextcloud.conf - sed -i "/LimitRequestBody 0/a\ \ ProtocolsHonorOrder Off" /etc/apache2/sites-available/nextcloud.conf - sed -i "/LimitRequestBody 0/a\ \ Protocols h2 h2c http/1.1" /etc/apache2/sites-available/nextcloud.conf - fi - fi + if [ -e $debvf ] + then + if grep -q "Protocols" "/etc/apache2/sites-available/nextcloud.conf" + then + echo "!!!!!!! HTTP2 already inside vhost config." >> $insl 2>&1 + else + echo "!!!!!!! HTTP2 adding to vhost" >> $insl 2>&1 + sed -i "/LimitRequestBody 0/a\ \ H2WindowSize 5242880" /etc/apache2/sites-available/nextcloud.conf + sed -i "/LimitRequestBody 0/a\ \ ProtocolsHonorOrder Off" /etc/apache2/sites-available/nextcloud.conf + sed -i "/LimitRequestBody 0/a\ \ Protocols h2 h2c http/1.1" /etc/apache2/sites-available/nextcloud.conf + fi + fi } function preview_tweaks { - echo "!!!!!!! Preview thumbnails tweaking in NC" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 0 --value="OC\\Preview\\PNG" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 1 --value="OC\\Preview\\JPEG" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 2 --value="OC\\Preview\\GIF" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 3 --value="OC\\Preview\\BMP" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 4 --value="OC\\Preview\\XBitmap" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 5 --value="OC\\Preview\\MP3" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 6 --value="OC\\Preview\\TXT" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 7 --value="OC\\Preview\\MarkDown" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 8 --value="OC\\Preview\\OpenDocument" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 9 --value="OC\\Preview\\Krita" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 10 --value="OC\\Preview\\Illustrator" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 11 --value="OC\\Preview\\HEIC" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 12 --value="OC\\Preview\\HEIF" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 13 --value="OC\\Preview\\Movie" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 14 --value="OC\\Preview\\MSOffice2003" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 15 --value="OC\\Preview\\MSOffice2007" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 16 --value="OC\\Preview\\MSOfficeDoc" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 17 --value="OC\\Preview\\PDF" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 18 --value="OC\\Preview\\Photoshop" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 19 --value="OC\\Preview\\Postscript" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 20 --value="OC\\Preview\\StarOffice" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 21 --value="OC\\Preview\\SVG" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 22 --value="OC\\Preview\\TIFF" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 23 --value="OC\\Preview\\WEBP" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 24 --value="OC\\Preview\\EMF" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 25 --value="OC\\Preview\\Font" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 26 --value="OC\\Preview\\Image" >> $insl 2>&1 - if [ -e $debvf ] - then - sed -i 's/\(^ *\)/\1read|write\3/1' /etc/ImageMagick-6/policy.xml - sed -i 's/\(^ *\)/\1read|write\3/1' /etc/ImageMagick-6/policy.xml - sed -i 's/\(^ *\)/\1read|write\3/1' /etc/ImageMagick-6/policy.xml - sed -i 's/\(^ *\)/\1read|write\3/1' /etc/ImageMagick-6/policy.xml - sed -i 's/\(^ *\)/\1read|write\3/1' /etc/ImageMagick-6/policy.xml - fi + echo "!!!!!!! Preview thumbnails tweaking in NC" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 0 --value="OC\\Preview\\PNG" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 1 --value="OC\\Preview\\JPEG" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 2 --value="OC\\Preview\\GIF" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 3 --value="OC\\Preview\\BMP" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 4 --value="OC\\Preview\\XBitmap" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 5 --value="OC\\Preview\\MP3" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 6 --value="OC\\Preview\\TXT" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 7 --value="OC\\Preview\\MarkDown" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 8 --value="OC\\Preview\\OpenDocument" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 9 --value="OC\\Preview\\Krita" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 10 --value="OC\\Preview\\Illustrator" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 11 --value="OC\\Preview\\HEIC" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 12 --value="OC\\Preview\\HEIF" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 13 --value="OC\\Preview\\Movie" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 14 --value="OC\\Preview\\MSOffice2003" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 15 --value="OC\\Preview\\MSOffice2007" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 16 --value="OC\\Preview\\MSOfficeDoc" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 17 --value="OC\\Preview\\PDF" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 18 --value="OC\\Preview\\Photoshop" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 19 --value="OC\\Preview\\Postscript" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 20 --value="OC\\Preview\\StarOffice" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 21 --value="OC\\Preview\\SVG" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 22 --value="OC\\Preview\\TIFF" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 23 --value="OC\\Preview\\WEBP" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 24 --value="OC\\Preview\\EMF" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 25 --value="OC\\Preview\\Font" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enabledPreviewProviders 26 --value="OC\\Preview\\Image" >> $insl 2>&1 + if [ -e $debvf ] + then + sed -i 's/\(^ *\)/\1read|write\3/1' /etc/ImageMagick-6/policy.xml + sed -i 's/\(^ *\)/\1read|write\3/1' /etc/ImageMagick-6/policy.xml + sed -i 's/\(^ *\)/\1read|write\3/1' /etc/ImageMagick-6/policy.xml + sed -i 's/\(^ *\)/\1read|write\3/1' /etc/ImageMagick-6/policy.xml + sed -i 's/\(^ *\)/\1read|write\3/1' /etc/ImageMagick-6/policy.xml + fi } function php74_tweaks { - echo "!!!!!!! PHP 7.4 config files modify." >> $insl 2>&1 - echo "PHP config files tweaking." - if [ -e $debvf ] - then - php74_in1=/etc/php/7.4/apache2 - php74_in2=/etc/php/7.4/apache2/conf.d - fi - if [ -e $elvf ] - then - php74_in1=/etc/opt/remi/php74 - php74_in2=/etc/opt/remi/php74/php.d - ln -s /var/opt/remi/php74/log/php-fpm /var/log/php-fpm - fi - if [ -e $debvf ] - then - echo 'apc.enable_cli=1' >> /etc/php/7.4/cli/conf.d/20-apcu.ini - fi - if [ -e $debvf ] - then - echo 'apc.enable_cli=1' >> $php74_in2/40-apcu.ini - fi - sed -i 's/\b128M\b/1024M/g' $php74_in1/php.ini - sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php74_in1/php.ini - sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php74_in1/php.ini - sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php74_in1/php.ini - sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php74_in1/php.ini - sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php74_in1/php.ini - sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php74_in1/php.ini - sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php74_in1/php.ini - sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php74_in1/php.ini - sed -i '/MySQLi]/amysqli.cache_size = 2000' $php74_in1/php.ini - if [ -e $debvf ] - then - sed -i 's/\b128M\b/1024M/g' /etc/php/7.4/cli/php.ini - sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' /etc/php/7.4/cli/php.ini - sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' /etc/php/7.4/cli/php.ini - sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' /etc/php/7.4/cli/php.ini - sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' /etc/php/7.4/cli/php.ini - sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' /etc/php/7.4/cli/php.ini - sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' /etc/php/7.4/cli/php.ini - sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' /etc/php/7.4/cli/php.ini - sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' /etc/php/7.4/cli/php.ini - sed -i '/MySQLi]/amysqli.cache_size = 2000' /etc/php/7.4/cli/php.ini - fi - echo 'opcache.enable_cli=1' >> $php74_in2/10-opcache.ini - echo 'opcache.interned_strings_buffer=64' >> $php74_in2/10-opcache.ini - echo 'opcache.max_accelerated_files=20000' >> $php74_in2/10-opcache.ini - echo 'opcache.memory_consumption=256' >> $php74_in2/10-opcache.ini - echo 'opcache.save_comments=1' >> $php74_in2/10-opcache.ini - echo 'opcache.enable=1' >> $php74_in2/10-opcache.ini - # echo 'opcache.revalidate_freq=1' >> $php74_in2/10-opcache.ini - # echo 'opcache.jit=disable' >> $php74_in2/10-opcache.ini - restart_websrv + echo "!!!!!!! PHP 7.4 config files modify." >> $insl 2>&1 + echo "PHP config files tweaking." + if [ -e $debvf ] + then + php74_in1=/etc/php/7.4/apache2 + php74_in2=/etc/php/7.4/apache2/conf.d + fi + if [ -e $elvf ] + then + php74_in1=/etc/opt/remi/php74 + php74_in2=/etc/opt/remi/php74/php.d + ln -s /var/opt/remi/php74/log/php-fpm /var/log/php-fpm + fi + if [ -e $debvf ] + then + echo 'apc.enable_cli=1' >> /etc/php/7.4/cli/conf.d/20-apcu.ini + fi + if [ -e $debvf ] + then + echo 'apc.enable_cli=1' >> $php74_in2/40-apcu.ini + fi + sed -i 's/\b128M\b/1024M/g' $php74_in1/php.ini + sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php74_in1/php.ini + sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php74_in1/php.ini + sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php74_in1/php.ini + sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php74_in1/php.ini + sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php74_in1/php.ini + sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php74_in1/php.ini + sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php74_in1/php.ini + sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php74_in1/php.ini + sed -i '/MySQLi]/amysqli.cache_size = 2000' $php74_in1/php.ini + if [ -e $debvf ] + then + sed -i 's/\b128M\b/1024M/g' /etc/php/7.4/cli/php.ini + sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' /etc/php/7.4/cli/php.ini + sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' /etc/php/7.4/cli/php.ini + sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' /etc/php/7.4/cli/php.ini + sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' /etc/php/7.4/cli/php.ini + sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' /etc/php/7.4/cli/php.ini + sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' /etc/php/7.4/cli/php.ini + sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' /etc/php/7.4/cli/php.ini + sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' /etc/php/7.4/cli/php.ini + sed -i '/MySQLi]/amysqli.cache_size = 2000' /etc/php/7.4/cli/php.ini + fi + echo 'opcache.enable_cli=1' >> $php74_in2/10-opcache.ini + echo 'opcache.interned_strings_buffer=64' >> $php74_in2/10-opcache.ini + echo 'opcache.max_accelerated_files=20000' >> $php74_in2/10-opcache.ini + echo 'opcache.memory_consumption=256' >> $php74_in2/10-opcache.ini + echo 'opcache.save_comments=1' >> $php74_in2/10-opcache.ini + echo 'opcache.enable=1' >> $php74_in2/10-opcache.ini + # echo 'opcache.revalidate_freq=1' >> $php74_in2/10-opcache.ini + # echo 'opcache.jit=disable' >> $php74_in2/10-opcache.ini + restart_websrv } function php81_tweaks { - echo "!!!!!!! PHP 8.1 config files modify." >> $insl 2>&1 - echo "PHP config files tweaking." - if [ -e $debvf ] - then - php81_in1=/etc/php/8.1/apache2 - php81_in2=/etc/php/8.1/apache2/conf.d - fi - if [ -e $elvf ] - then - php81_in1=/etc/opt/remi/php81 - php81_in2=/etc/opt/remi/php81/php.d - fi - if [ -e $debvf ] - then - echo 'apc.enable_cli=1' >> /etc/php/8.1/cli/conf.d/20-apcu.ini - fi - if [ -e $debvf ] - then - echo 'apc.enable_cli=1' >> $php81_in2/40-apcu.ini - fi - sed -i 's/\b128M\b/1024M/g' $php81_in1/php.ini - sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php81_in1/php.ini - sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php81_in1/php.ini - sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php81_in1/php.ini - sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php81_in1/php.ini - sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php81_in1/php.ini - sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php81_in1/php.ini - sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php81_in1/php.ini - sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php81_in1/php.ini - sed -i '/MySQLi]/amysqli.cache_size = 2000' $php81_in1/php.ini - if [ -e $debvf ] - then - sed -i 's/\b128M\b/1024M/g' /etc/php/8.1/cli/php.ini - sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' /etc/php/8.1/cli/php.ini - sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' /etc/php/8.1/cli/php.ini - sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' /etc/php/8.1/cli/php.ini - sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' /etc/php/8.1/cli/php.ini - sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' /etc/php/8.1/cli/php.ini - sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' /etc/php/8.1/cli/php.ini - sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' /etc/php/8.1/cli/php.ini - sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' /etc/php/8.1/cli/php.ini - sed -i '/MySQLi]/amysqli.cache_size = 2000' /etc/php/8.1/cli/php.ini - fi - echo 'opcache.enable_cli=1' >> $php81_in2/10-opcache.ini - echo 'opcache.interned_strings_buffer=64' >> $php81_in2/10-opcache.ini - echo 'opcache.max_accelerated_files=20000' >> $php81_in2/10-opcache.ini - echo 'opcache.memory_consumption=256' >> $php81_in2/10-opcache.ini - echo 'opcache.save_comments=1' >> $php81_in2/10-opcache.ini - echo 'opcache.enable=1' >> $php81_in2/10-opcache.ini - # echo 'opcache.revalidate_freq=1' >> $php81_in2/10-opcache.ini - # echo 'opcache.jit=disable' >> $php81_in2/10-opcache.ini - a2enmod php8.1 >> $insl 2>&1 - a2dismod php7.4 >> $insl 2>&1 - restart_websrv + echo "!!!!!!! PHP 8.1 config files modify." >> $insl 2>&1 + echo "PHP config files tweaking." + if [ -e $debvf ] + then + php81_in1=/etc/php/8.1/apache2 + php81_in2=/etc/php/8.1/apache2/conf.d + fi + if [ -e $elvf ] + then + php81_in1=/etc/opt/remi/php81 + php81_in2=/etc/opt/remi/php81/php.d + fi + if [ -e $debvf ] + then + echo 'apc.enable_cli=1' >> /etc/php/8.1/cli/conf.d/20-apcu.ini + fi + if [ -e $debvf ] + then + echo 'apc.enable_cli=1' >> $php81_in2/40-apcu.ini + fi + sed -i 's/\b128M\b/1024M/g' $php81_in1/php.ini + sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php81_in1/php.ini + sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php81_in1/php.ini + sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php81_in1/php.ini + sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php81_in1/php.ini + sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php81_in1/php.ini + sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php81_in1/php.ini + sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php81_in1/php.ini + sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php81_in1/php.ini + sed -i '/MySQLi]/amysqli.cache_size = 2000' $php81_in1/php.ini + if [ -e $debvf ] + then + sed -i 's/\b128M\b/1024M/g' /etc/php/8.1/cli/php.ini + sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' /etc/php/8.1/cli/php.ini + sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' /etc/php/8.1/cli/php.ini + sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' /etc/php/8.1/cli/php.ini + sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' /etc/php/8.1/cli/php.ini + sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' /etc/php/8.1/cli/php.ini + sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' /etc/php/8.1/cli/php.ini + sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' /etc/php/8.1/cli/php.ini + sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' /etc/php/8.1/cli/php.ini + sed -i '/MySQLi]/amysqli.cache_size = 2000' /etc/php/8.1/cli/php.ini + fi + echo 'opcache.enable_cli=1' >> $php81_in2/10-opcache.ini + echo 'opcache.interned_strings_buffer=64' >> $php81_in2/10-opcache.ini + echo 'opcache.max_accelerated_files=20000' >> $php81_in2/10-opcache.ini + echo 'opcache.memory_consumption=256' >> $php81_in2/10-opcache.ini + echo 'opcache.save_comments=1' >> $php81_in2/10-opcache.ini + echo 'opcache.enable=1' >> $php81_in2/10-opcache.ini + # echo 'opcache.revalidate_freq=1' >> $php81_in2/10-opcache.ini + # echo 'opcache.jit=disable' >> $php81_in2/10-opcache.ini + a2enmod php8.1 >> $insl 2>&1 + a2dismod php7.4 >> $insl 2>&1 + restart_websrv } function php82_tweaks { - echo "!!!!!!! PHP 8.2 config files modify." >> $insl 2>&1 - echo "PHP config files tweaking." - if [ -e $debvf ] - then - php82_in1=/etc/php/8.2/apache2 - php82_in2=/etc/php/8.2/apache2/conf.d - fi - if [ -e $elvf ] - then - php82_in1=/etc/opt/remi/php82 - php82_in2=/etc/opt/remi/php82/php.d - fi - if [ -e $debvf ] - then - echo 'apc.enable_cli=1' >> /etc/php/8.2/cli/conf.d/20-apcu.ini - fi - if [ -e $elvf ] - then - echo 'apc.enable_cli=1' >> $php82_in2/40-apcu.ini - fi - sed -i 's/\b128M\b/1024M/g' $php82_in1/php.ini - sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php82_in1/php.ini - sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php82_in1/php.ini - sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php82_in1/php.ini - sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php82_in1/php.ini - sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php82_in1/php.ini - sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php82_in1/php.ini - sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php82_in1/php.ini - sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php82_in1/php.ini - sed -i '/MySQLi]/amysqli.cache_size = 2000' $php82_in1/php.ini - if [ -e $debvf ] - then - sed -i 's/\b128M\b/1024M/g' /etc/php/8.2/cli/php.ini - sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' /etc/php/8.2/cli/php.ini - sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' /etc/php/8.2/cli/php.ini - sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' /etc/php/8.2/cli/php.ini - sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' /etc/php/8.2/cli/php.ini - sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' /etc/php/8.2/cli/php.ini - sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' /etc/php/8.2/cli/php.ini - sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' /etc/php/8.2/cli/php.ini - sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' /etc/php/8.2/cli/php.ini - sed -i '/MySQLi]/amysqli.cache_size = 2000' /etc/php/8.2/cli/php.ini - fi - echo 'opcache.enable_cli=1' >> $php82_in2/10-opcache.ini - echo 'opcache.interned_strings_buffer=64' >> $php82_in2/10-opcache.ini - echo 'opcache.max_accelerated_files=20000' >> $php82_in2/10-opcache.ini - echo 'opcache.memory_consumption=256' >> $php82_in2/10-opcache.ini - echo 'opcache.save_comments=1' >> $php82_in2/10-opcache.ini - echo 'opcache.enable=1' >> $php82_in2/10-opcache.ini - # echo 'opcache.revalidate_freq=1' >> $php82_in2/10-opcache.ini - # echo 'opcache.jit=disable' >> $php82_in2/10-opcache.ini - a2enmod php8.2 >> $insl 2>&1 - a2dismod php8.1 >> $insl 2>&1 - restart_websrv + echo "!!!!!!! PHP 8.2 config files modify." >> $insl 2>&1 + echo "PHP config files tweaking." + if [ -e $debvf ] + then + php82_in1=/etc/php/8.2/apache2 + php82_in2=/etc/php/8.2/apache2/conf.d + fi + if [ -e $elvf ] + then + php82_in1=/etc/opt/remi/php82 + php82_in2=/etc/opt/remi/php82/php.d + fi + if [ -e $debvf ] + then + echo 'apc.enable_cli=1' >> /etc/php/8.2/cli/conf.d/20-apcu.ini + fi + if [ -e $elvf ] + then + echo 'apc.enable_cli=1' >> $php82_in2/40-apcu.ini + fi + sed -i 's/\b128M\b/1024M/g' $php82_in1/php.ini + sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php82_in1/php.ini + sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php82_in1/php.ini + sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php82_in1/php.ini + sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php82_in1/php.ini + sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php82_in1/php.ini + sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php82_in1/php.ini + sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php82_in1/php.ini + sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php82_in1/php.ini + sed -i '/MySQLi]/amysqli.cache_size = 2000' $php82_in1/php.ini + if [ -e $debvf ] + then + sed -i 's/\b128M\b/1024M/g' /etc/php/8.2/cli/php.ini + sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' /etc/php/8.2/cli/php.ini + sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' /etc/php/8.2/cli/php.ini + sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' /etc/php/8.2/cli/php.ini + sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' /etc/php/8.2/cli/php.ini + sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' /etc/php/8.2/cli/php.ini + sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' /etc/php/8.2/cli/php.ini + sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' /etc/php/8.2/cli/php.ini + sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' /etc/php/8.2/cli/php.ini + sed -i '/MySQLi]/amysqli.cache_size = 2000' /etc/php/8.2/cli/php.ini + fi + echo 'opcache.enable_cli=1' >> $php82_in2/10-opcache.ini + echo 'opcache.interned_strings_buffer=64' >> $php82_in2/10-opcache.ini + echo 'opcache.max_accelerated_files=20000' >> $php82_in2/10-opcache.ini + echo 'opcache.memory_consumption=256' >> $php82_in2/10-opcache.ini + echo 'opcache.save_comments=1' >> $php82_in2/10-opcache.ini + echo 'opcache.enable=1' >> $php82_in2/10-opcache.ini + # echo 'opcache.revalidate_freq=1' >> $php82_in2/10-opcache.ini + # echo 'opcache.jit=disable' >> $php82_in2/10-opcache.ini + a2enmod php8.2 >> $insl 2>&1 + a2dismod php8.1 >> $insl 2>&1 + restart_websrv } function php83_tweaks { - echo "!!!!!!! PHP 8.3 config files modify." >> $insl 2>&1 - echo "PHP config files tweaking." - if [ -e $debvf ] - then - php83_in1=/etc/php/8.3/apache2 - php83_in2=/etc/php/8.3/apache2/conf.d - php83_inc=/etc/php/8.3/cli/php.ini - fi - if [ -e $elvf ] - then - php83_in1=/etc/opt/remi/php83 - php83_in2=/etc/opt/remi/php83/php.d - fi - if [ -e $debvf ] - then - echo 'apc.enable_cli=1' >> /etc/php/8.3/cli/conf.d/20-apcu.ini - fi - if [ -e $elvf ] - then - echo 'apc.enable_cli=1' >> $php83_in2/40-apcu.ini - fi - sed -i 's/\b128M\b/1024M/g' $php83_in1/php.ini - sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php83_in1/php.ini - sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php83_in1/php.ini - sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php83_in1/php.ini - sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php83_in1/php.ini - sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php83_in1/php.ini - sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php83_in1/php.ini - sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php83_in1/php.ini - sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php83_in1/php.ini - sed -i '/MySQLi]/amysqli.cache_size = 2000' $php83_in1/php.ini - if [ -e $debvf ] - then - sed -i 's/\b128M\b/1024M/g' $php83_inc - sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php83_inc - sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php83_inc - sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php83_inc - sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php83_inc - sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php83_inc - sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php83_inc - sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php83_inc - sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php83_inc - sed -i '/MySQLi]/amysqli.cache_size = 2000' $php83_inc - fi - echo 'opcache.enable_cli=1' >> $php83_in2/10-opcache.ini - echo 'opcache.interned_strings_buffer=64' >> $php83_in2/10-opcache.ini - echo 'opcache.max_accelerated_files=20000' >> $php83_in2/10-opcache.ini - echo 'opcache.memory_consumption=256' >> $php83_in2/10-opcache.ini - echo 'opcache.save_comments=1' >> $php83_in2/10-opcache.ini - echo 'opcache.enable=1' >> $php83_in2/10-opcache.ini - # echo 'opcache.revalidate_freq=1' >> $php83_in2/10-opcache.ini - # echo 'opcache.jit=disable' >> $php83_in2/10-opcache.ini - a2enmod php8.3 >> $insl 2>&1 - a2dismod php8.2 >> $insl 2>&1 - restart_websrv + echo "!!!!!!! PHP 8.3 config files modify." >> $insl 2>&1 + echo "PHP config files tweaking." + if [ -e $debvf ] + then + php83_in1=/etc/php/8.3/apache2 + php83_in2=/etc/php/8.3/apache2/conf.d + php83_inc=/etc/php/8.3/cli/php.ini + fi + if [ -e $elvf ] + then + php83_in1=/etc/opt/remi/php83 + php83_in2=/etc/opt/remi/php83/php.d + fi + if [ -e $debvf ] + then + echo 'apc.enable_cli=1' >> /etc/php/8.3/cli/conf.d/20-apcu.ini + fi + if [ -e $elvf ] + then + echo 'apc.enable_cli=1' >> $php83_in2/40-apcu.ini + fi + sed -i 's/\b128M\b/1024M/g' $php83_in1/php.ini + sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php83_in1/php.ini + sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php83_in1/php.ini + sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php83_in1/php.ini + sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php83_in1/php.ini + sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php83_in1/php.ini + sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php83_in1/php.ini + sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php83_in1/php.ini + sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php83_in1/php.ini + sed -i '/MySQLi]/amysqli.cache_size = 2000' $php83_in1/php.ini + if [ -e $debvf ] + then + sed -i 's/\b128M\b/1024M/g' $php83_inc + sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php83_inc + sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php83_inc + sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php83_inc + sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php83_inc + sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php83_inc + sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php83_inc + sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php83_inc + sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php83_inc + sed -i '/MySQLi]/amysqli.cache_size = 2000' $php83_inc + fi + echo 'opcache.enable_cli=1' >> $php83_in2/10-opcache.ini + echo 'opcache.interned_strings_buffer=64' >> $php83_in2/10-opcache.ini + echo 'opcache.max_accelerated_files=20000' >> $php83_in2/10-opcache.ini + echo 'opcache.memory_consumption=256' >> $php83_in2/10-opcache.ini + echo 'opcache.save_comments=1' >> $php83_in2/10-opcache.ini + echo 'opcache.enable=1' >> $php83_in2/10-opcache.ini + # echo 'opcache.revalidate_freq=1' >> $php83_in2/10-opcache.ini + # echo 'opcache.jit=disable' >> $php83_in2/10-opcache.ini + a2enmod php8.3 >> $insl 2>&1 + a2dismod php8.2 >> $insl 2>&1 + restart_websrv } function php84_tweaks { - echo "!!!!!!! PHP 8.4 config files modify." >> $insl 2>&1 - echo "PHP config files tweaking." - if [ -e $debvf ] - then - php84_in1=/etc/php/8.4/apache2 - php84_in2=/etc/php/8.4/apache2/conf.d - php84_inc=/etc/php/8.4/cli/php.ini - fi - if [ -e $elvf ] - then - php84_in1=/etc/opt/remi/php84 - php84_in2=/etc/opt/remi/php84/php.d - fi - if [ -e $debvf ] - then - echo 'apc.enable_cli=1' >> /etc/php/8.4/cli/conf.d/20-apcu.ini - fi - if [ -e $elvf ] - then - echo 'apc.enable_cli=1' >> $php84_in2/40-apcu.ini - fi - sed -i 's/\b128M\b/1024M/g' $php84_in1/php.ini - sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php84_in1/php.ini - sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php84_in1/php.ini - sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php84_in1/php.ini - sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php84_in1/php.ini - sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php84_in1/php.ini - sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php84_in1/php.ini - sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php84_in1/php.ini - sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php84_in1/php.ini - sed -i '/MySQLi]/amysqli.cache_size = 2000' $php84_in1/php.ini - if [ -e $debvf ] - then - sed -i 's/\b128M\b/1024M/g' $php84_inc - sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php84_inc - sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php84_inc - sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php84_inc - sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php84_inc - sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php84_inc - sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php84_inc - sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php84_inc - sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php84_inc - sed -i '/MySQLi]/amysqli.cache_size = 2000' $php84_inc - fi - echo 'opcache.enable_cli=1' >> $php84_in2/10-opcache.ini - echo 'opcache.interned_strings_buffer=64' >> $php84_in2/10-opcache.ini - echo 'opcache.max_accelerated_files=20000' >> $php84_in2/10-opcache.ini - echo 'opcache.memory_consumption=256' >> $php84_in2/10-opcache.ini - echo 'opcache.save_comments=1' >> $php84_in2/10-opcache.ini - echo 'opcache.enable=1' >> $php84_in2/10-opcache.ini - # echo 'opcache.revalidate_freq=1' >> $php84_in2/10-opcache.ini - # echo 'opcache.jit=disable' >> $php84_in2/10-opcache.ini - a2enmod php8.4 >> $insl 2>&1 - a2dismod php8.3 >> $insl 2>&1 - restart_websrv + echo "!!!!!!! PHP 8.4 config files modify." >> $insl 2>&1 + echo "PHP config files tweaking." + if [ -e $debvf ] + then + php84_in1=/etc/php/8.4/apache2 + php84_in2=/etc/php/8.4/apache2/conf.d + php84_inc=/etc/php/8.4/cli/php.ini + fi + if [ -e $elvf ] + then + php84_in1=/etc/opt/remi/php84 + php84_in2=/etc/opt/remi/php84/php.d + fi + if [ -e $debvf ] + then + echo 'apc.enable_cli=1' >> /etc/php/8.4/cli/conf.d/20-apcu.ini + fi + if [ -e $elvf ] + then + echo 'apc.enable_cli=1' >> $php84_in2/40-apcu.ini + fi + sed -i 's/\b128M\b/1024M/g' $php84_in1/php.ini + sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php84_in1/php.ini + sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php84_in1/php.ini + sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php84_in1/php.ini + sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php84_in1/php.ini + sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php84_in1/php.ini + sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php84_in1/php.ini + sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php84_in1/php.ini + sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php84_in1/php.ini + sed -i '/MySQLi]/amysqli.cache_size = 2000' $php84_in1/php.ini + if [ -e $debvf ] + then + sed -i 's/\b128M\b/1024M/g' $php84_inc + sed -i 's/\bmax_execution_time = 30\b/max_execution_time = 3600/g' $php84_inc + sed -i 's/\boutput_buffering = 4096\b/output_buffering = Off/g' $php84_inc + sed -i 's/\bmax_input_vars = 1000\b/max_input_vars = 3000/g' $php84_inc + sed -i 's/\bmax_input_time = 60\b/max_input_time = 3600/g' $php84_inc + sed -i 's/\bpost_max_size = 8M\b/post_max_size = 16G/g' $php84_inc + sed -i 's/\bupload_max_filesize = 2M\b/upload_max_filesize = 16G/g' $php84_inc + sed -i 's/\bmax_file_uploads = 20\b/max_file_uploads = 200/g' $php84_inc + sed -i 's/\bdefault_socket_timeout = 20\b/default_socket_timeout = 3600/g' $php84_inc + sed -i '/MySQLi]/amysqli.cache_size = 2000' $php84_inc + fi + echo 'opcache.enable_cli=1' >> $php84_in2/10-opcache.ini + echo 'opcache.interned_strings_buffer=64' >> $php84_in2/10-opcache.ini + echo 'opcache.max_accelerated_files=20000' >> $php84_in2/10-opcache.ini + echo 'opcache.memory_consumption=256' >> $php84_in2/10-opcache.ini + echo 'opcache.save_comments=1' >> $php84_in2/10-opcache.ini + echo 'opcache.enable=1' >> $php84_in2/10-opcache.ini + # echo 'opcache.revalidate_freq=1' >> $php84_in2/10-opcache.ini + # echo 'opcache.jit=disable' >> $php84_in2/10-opcache.ini + a2enmod php8.4 >> $insl 2>&1 + a2dismod php8.3 >> $insl 2>&1 + restart_websrv } # This are tweaks for currently latest verion used. function php_tweaks { - php83_tweaks + php83_tweaks } function save_version_info { - echo -e "pver=$ver lang=$lang mail=$mail dm=$dm nv=$nv fdir=$fdir\n$( $ver_file - echo -e "Version $ver was succesfully installed at $(date +%d-%m-%Y_%H:%M:%S)\n$( $ver_file + echo -e "pver=$ver lang=$lang mail=$mail dm=$dm nv=$nv fdir=$fdir\n$( $ver_file + echo -e "Version $ver was succesfully installed at $(date +%d-%m-%Y_%H:%M:%S)\n$( $ver_file } function save_upg_info { - echo -e "pver=$ver lang=$lang mail=$mail dm=$dm nv=$nv fdir=$fdir\n$( $ver_file - echo -e "Succesfully upgraded to $ver at $(date +%d-%m-%Y_%H:%M:%S)\n$( $ver_file + echo -e "pver=$ver lang=$lang mail=$mail dm=$dm nv=$nv fdir=$fdir\n$( $ver_file + echo -e "Succesfully upgraded to $ver at $(date +%d-%m-%Y_%H:%M:%S)\n$( $ver_file } function disable_sleep { - echo "!!!!!!! Disabling sleep states." >> $insl 2>&1 - echo "Disabling sleep states." - systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target >> $insl 2>&1 + echo "!!!!!!! Disabling sleep states." >> $insl 2>&1 + echo "Disabling sleep states." + systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target >> $insl 2>&1 } # Check if nv option was used for every version, and exit without progress. function nv_verify { - if [ "$nv" = "24" ] - then - nv_check_upd - fi - if [ "$nv" = "25" ] - then - nv_check_upd - fi - if [ "$nv" = "26" ] - then - nv_check_upd - fi - if [ "$nv" = "27" ] - then - nv_check_upd - fi - if [ "$nv" = "28" ] - then - maintenance_window_setup - nv_check_upd - fi - if [ "$nv" = "29" ] - then - nv_check_upd - fi - if [ "$nv" = "30" ] - then - nv_check_upd - fi - if [ "$nv" = "31" ] - then - nv_check_upd - fi - if [ "$nv" = "32" ] - then - nv_check_upd - fi + if [ "$nv" = "24" ] + then + nv_check_upd + fi + if [ "$nv" = "25" ] + then + nv_check_upd + fi + if [ "$nv" = "26" ] + then + nv_check_upd + fi + if [ "$nv" = "27" ] + then + nv_check_upd + fi + if [ "$nv" = "28" ] + then + maintenance_window_setup + nv_check_upd + fi + if [ "$nv" = "29" ] + then + nv_check_upd + fi + if [ "$nv" = "30" ] + then + nv_check_upd + fi + if [ "$nv" = "31" ] + then + nv_check_upd + fi + if [ "$nv" = "32" ] + then + nv_check_upd + fi } -# Unset nver variable and read fresh value +# Unset nver variable and read fresh value. function sncver { - unset ncver - ncver=$( sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:get version | awk -F '.' '{print $1}' ) + unset ncver + ncver=$( sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:get version | awk -F '.' '{print $1}' ) } function ncverf { - unset ncverf - ncverf=$( sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:get version ) + unset ncverf + ncverf=$( sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:get version ) } # Check for every version and update it one by one. function nv_update { - sncver - if [ "$ncver" = "26" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "26" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "26" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "27" ] - then - install_php82 - php82_tweaks - nv_upd_simpl - fi - sncver - if [ "$ncver" = "27" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "27" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "28" ] - then - install_php82 - php82_tweaks - nv_upd_simpl - fi - sncver - if [ "$ncver" = "28" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "28" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "29" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "29" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "29" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "30" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "30" ] - then - install_php83 - php83_tweaks - nv_upd_simpl - fi - sncver - if [ "$ncver" = "30" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "30" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "30" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "31" ] - then - install_php83 - php83_tweaks - nv_upd_simpl - fi - sncver - if [ "$ncver" = "31" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "31" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "31" ] - then - nv_upd_simpl - fi + sncver + if [ "$ncver" = "26" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "26" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "26" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "27" ] + then + install_php82 + php82_tweaks + nv_upd_simpl + fi + sncver + if [ "$ncver" = "27" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "27" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "28" ] + then + install_php82 + php82_tweaks + nv_upd_simpl + fi + sncver + if [ "$ncver" = "28" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "28" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "29" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "29" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "29" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "30" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "30" ] + then + install_php83 + php83_tweaks + nv_upd_simpl + fi + sncver + if [ "$ncver" = "30" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "30" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "30" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "31" ] + then + install_php83 + php83_tweaks + nv_upd_simpl + fi + sncver + if [ "$ncver" = "31" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "31" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "31" ] + then + nv_upd_simpl + fi } # Office Package Installing -# Currently disabled since no multiple domains support +# Currently disabled since no multiple domains support. function collab_inst { - echo "!!!!!!! Collabora Office installing." >> $insl 2>&1 - echo "Installing Collabora CODE and Nextcloud Office application." >> $insl 2>&1 - wget https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg --directory-prefix=/usr/share/keyrings/ >> $insl 2>&1 - echo "Types: deb + echo "!!!!!!! Collabora Office installing." >> $insl 2>&1 + echo "Installing Collabora CODE and Nextcloud Office application." >> $insl 2>&1 + wget https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg --directory-prefix=/usr/share/keyrings/ >> $insl 2>&1 + echo "Types: deb URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-deb Suites: ./ Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg" >> /etc/apt/sources.list.d/collaboraonline.sources - echo "deb http://deb.debian.org/debian bookworm contrib non-free" > /etc/apt/sources.list.d/contrib.list - apt-get update >> $insl 2>&1 - apt-get install -y -o DPkg::Lock::Timeout=-1 ttf-mscorefonts-installer coolwsd code-brand collaboraoffice-dict-en collaboraofficebasis-pl collaboraoffice-dict-pl >> $insl 2>&1 - - mkdir -p /opt/collaborassl/ >> $insl 2>&1 - openssl genrsa -out /opt/collaborassl/root.key.pem 2048 >> $insl 2>&1 - openssl req -x509 -new -nodes -key /opt/collaborassl/root.key.pem -days 9131 -out /opt/collaborassl/root.crt.pem -subj "/C=NX/ST=Internet/L=Unknown/O=Nextcloud/CN=Office Service" >> $insl 2>&1 - - openssl genrsa -out "/opt/collaborassl/privkey.pem" 2048 - openssl req -key "/opt/collaborassl/privkey.pem" -new -sha256 -out "/opt/collaborassl/privkey.csr.pem" -subj "/C=NX/ST=Internet/L=Unknown/O=Nextcloud/CN=Office Service" >> $insl 2>&1 - openssl x509 -req -in /opt/collaborassl/privkey.csr.pem -CA /opt/collaborassl/root.crt.pem -CAkey /opt/collaborassl/root.key.pem -CAcreateserial -out /opt/collaborassl/cert.pem -days 9131 >> $insl 2>&1 - chown cool:cool /opt/collaborassl/* >> $insl 2>&1 - mv /opt/collaborassl/privkey.pem /etc/coolwsd/key.pem >> $insl 2>&1 - mv /opt/collaborassl/cert.pem /etc/coolwsd/cert.pem >> $insl 2>&1 - mv /opt/collaborassl/root.crt.pem /etc/coolwsd/ca-chain.cert.pem >> $insl 2>&1 - - coolconfig set ssl.ssl_verififcation false >> $insl 2>&1 - coolconfig set ssl.termination true >> $insl 2>&1 - coolconfig set logging.disable_server_audit true >> $insl 2>&1 - coolconfig set admin_console.username SuperAdmin >> $insl 2>&1 - coolconfig set admin_console.password $mp2 >> $insl 2>&1 - # coolconfig set admin_console.password testingconsole - # coolconfig set ssl.enable true >> $insl 2>&1 - # coolconfig set storage.wopi.host $(hostname) >> $insl 2>&1 - coolconfig set net.post_allow.host "192\.168\.[0-9]{1,3}\.[0-9]{1,3}" >> $insl 2>&1 - coolconfig update-system-template >> $insl 2>&1 - ufw allow 9980/tcp >> $insl 2>&1 - systemctl enable coolwsd >> $insl 2>&1 - systemctl restart coolwsd >> $insl 2>&1 - echo "!!!!!!! Collabora Office checking." >> $insl 2>&1 - curl -v https://127.0.0.1:9980/hosting/discovery >> $insl 2>&1 - - # Debian (nie ma na razie wersji RH) -# a2enmod proxy -# a2enmod proxy_http -# a2enmod proxy_connect -# a2enmod proxy_wstunnel -# echo ' AllowEncodedSlashes NoDecode + echo "deb http://deb.debian.org/debian bookworm contrib non-free" > /etc/apt/sources.list.d/contrib.list + apt-get update >> $insl 2>&1 + apt-get install -y -o DPkg::Lock::Timeout=-1 ttf-mscorefonts-installer coolwsd code-brand collaboraoffice-dict-en collaboraofficebasis-pl collaboraoffice-dict-pl >> $insl 2>&1 + + mkdir -p /opt/collaborassl/ >> $insl 2>&1 + openssl genrsa -out /opt/collaborassl/root.key.pem 2048 >> $insl 2>&1 + openssl req -x509 -new -nodes -key /opt/collaborassl/root.key.pem -days 9131 -out /opt/collaborassl/root.crt.pem -subj "/C=NX/ST=Internet/L=Unknown/O=Nextcloud/CN=Office Service" >> $insl 2>&1 + + openssl genrsa -out "/opt/collaborassl/privkey.pem" 2048 + openssl req -key "/opt/collaborassl/privkey.pem" -new -sha256 -out "/opt/collaborassl/privkey.csr.pem" -subj "/C=NX/ST=Internet/L=Unknown/O=Nextcloud/CN=Office Service" >> $insl 2>&1 + openssl x509 -req -in /opt/collaborassl/privkey.csr.pem -CA /opt/collaborassl/root.crt.pem -CAkey /opt/collaborassl/root.key.pem -CAcreateserial -out /opt/collaborassl/cert.pem -days 9131 >> $insl 2>&1 + chown cool:cool /opt/collaborassl/* >> $insl 2>&1 + mv /opt/collaborassl/privkey.pem /etc/coolwsd/key.pem >> $insl 2>&1 + mv /opt/collaborassl/cert.pem /etc/coolwsd/cert.pem >> $insl 2>&1 + mv /opt/collaborassl/root.crt.pem /etc/coolwsd/ca-chain.cert.pem >> $insl 2>&1 + + coolconfig set ssl.ssl_verififcation false >> $insl 2>&1 + coolconfig set ssl.termination true >> $insl 2>&1 + coolconfig set logging.disable_server_audit true >> $insl 2>&1 + coolconfig set admin_console.username SuperAdmin >> $insl 2>&1 + coolconfig set admin_console.password $mp2 >> $insl 2>&1 + # coolconfig set admin_console.password testingconsole + # coolconfig set ssl.enable true >> $insl 2>&1 + # coolconfig set storage.wopi.host $(hostname) >> $insl 2>&1 + coolconfig set net.post_allow.host "192\.168\.[0-9]{1,3}\.[0-9]{1,3}" >> $insl 2>&1 + coolconfig update-system-template >> $insl 2>&1 + ufw allow 9980/tcp >> $insl 2>&1 + systemctl enable coolwsd >> $insl 2>&1 + systemctl restart coolwsd >> $insl 2>&1 + echo "!!!!!!! Collabora Office checking." >> $insl 2>&1 + curl -v https://127.0.0.1:9980/hosting/discovery >> $insl 2>&1 + + # Debian (nie ma na razie wersji RH) + # a2enmod proxy + # a2enmod proxy_http + # a2enmod proxy_connect + # a2enmod proxy_wstunnel + # echo ' AllowEncodedSlashes NoDecode # SSLProxyEngine On # ProxyPreserveHost On # SSLProxyVerify None # SSLProxyCheckPeerCN Off - # SSLProxyCheckPeerName Off -# + # SSLProxyCheckPeerName Off +# P# # ProxyPass /browser https://127.0.0.1:9980/browser retry=0 # ProxyPassReverse /browser https://127.0.0.1:9980/browser @@ -1135,36 +1216,36 @@ Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg" >> /etc/apt/ # ProxyPass /lool https://127.0.0.1:9980/cool # ProxyPassReverse /lool https://127.0.0.1:9980/cool' >> /etc/apache2/conf-available/coolwsd-nc-ssl.conf - # sed -i "/SSLCertificateKeyFile/a \\ Include \"conf-available/coolwsd-nc-ssl.conf\"" /etc/apache2/sites-available/nextcloud.conf - systemctl restart apache2 - sudo -u $websrv_usr php /var/www/nextcloud/occ app:install richdocuments >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:app:set --value="yes" richdocuments disable_certificate_verification >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:app:set --value="https://$addr1:9980" richdocuments wopi_url >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:app:set --value="https://$addr1:9980" richdocuments public_wopi_url >> $insl 2>&1 + # sed -i "/SSLCertificateKeyFile/a \\ Include \"conf-available/coolwsd-nc-ssl.conf\"" /etc/apache2/sites-available/nextcloud.conf + systemctl restart apache2 + sudo -u $websrv_usr php /var/www/nextcloud/occ app:install richdocuments >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:app:set --value="yes" richdocuments disable_certificate_verification >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:app:set --value="https://$addr1:9980" richdocuments wopi_url >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:app:set --value="https://$addr1:9980" richdocuments public_wopi_url >> $insl 2>&1 } function ooffice_inst { - echo "Docker installation processing." >> $insl 2>&1 - for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg >> $insl 2>&1; done - install -m 0755 -d /etc/apt/keyrings - curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc - chmod a+r /etc/apt/keyrings/docker.asc - echo \ + echo "Docker installation processing." >> $insl 2>&1 + for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg >> $insl 2>&1; done + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc + chmod a+r /etc/apt/keyrings/docker.asc + echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ - tee /etc/apt/sources.list.d/docker.list >> $insl 2>&1 - apt-get update >> $insl 2>&1 && apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin >> $insl 2>&1 - echo "Installing OO" >> $insl 2>&1 - docker pull ghcr.io/thomisus/onlyoffice-documentserver-unlimited:latest - mkdir /root/onlyoffice - touch /root/onlyoffice/.env - echo "SSL_VERIFY_CLIENT=FALSE" >> /root/onlyoffice/.env - echo "SECURE_LINK_SECRET=RandomSecretKey" >> /root/onlyoffice/.env - echo "JWT_SECRET=RandomSecretKey" >> /root/onlyoffice/.env - echo "USE_UNAUTHORIZED_STORAGE=TRUE" >> /root/onlyoffice/.env - - touch /opt/open_ssl2.conf -echo '[req] + tee /etc/apt/sources.list.d/docker.list >> $insl 2>&1 + apt-get update >> $insl 2>&1 && apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin >> $insl 2>&1 + echo "Installing OO." >> $insl 2>&1 + docker pull ghcr.io/thomisus/onlyoffice-documentserver-unlimited:latest + mkdir /root/onlyoffice + touch /root/onlyoffice/.env + echo "SSL_VERIFY_CLIENT=FALSE" >> /root/onlyoffice/.env + echo "SECURE_LINK_SECRET=RandomSecretKey" >> /root/onlyoffice/.env + echo "JWT_SECRET=RandomSecretKey" >> /root/onlyoffice/.env + echo "USE_UNAUTHORIZED_STORAGE=TRUE" >> /root/onlyoffice/.env + + touch /opt/open_ssl2.conf + echo '[req] distinguished_name = req_distinguished_name prompt = no [req_distinguished_name] @@ -1174,152 +1255,152 @@ L = Unknown O = Nextcloud OU = NAS CN = Office Service' >> /opt/open_ssl2.conf - mkdir -p /app/onlyoffice/DocumentServer/data/certs - openssl genrsa -out /app/onlyoffice/DocumentServer/data/certs/tls.key 2048 - openssl req -new -config /opt/open_ssl2.conf -key /app/onlyoffice/DocumentServer/data/certs/tls.key -out /app/onlyoffice/DocumentServer/data/certs/tls.csr - openssl x509 -req -days 4096 -in /app/onlyoffice/DocumentServer/data/certs/tls.csr -signkey /app/onlyoffice/DocumentServer/data/certs/tls.key -out /app/onlyoffice/DocumentServer/data/certs/tls.crt - openssl dhparam -out /app/onlyoffice/DocumentServer/data/certs/dhparam.pem 2048 - ufw allow 9080/tcp - ufw allow 9443/tcp - # docker run -i -t -d -p 9443:443 --env-file /root/onlyoffice/.env -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice -v /app/onlyoffice/DocumentServer/rabbitmq:/var/lib/rabbitmq -v /app/onlyoffice/DocumentServer/redis:/var/lib/redis -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice ghcr.io/thomisus/onlyoffice-documentserver-unlimited - docker run -i -t -d -p 9443:443 -p 9080:80 -e ssl_verify_client='false' -e use_unauthorized_storage='true' -e allow_private_ip_address='true' -e secure_link_secret='sekret' -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice -v /app/onlyoffice/DocumentServer/rabbitmq:/var/lib/rabbitmq -v /app/onlyoffice/DocumentServer/redis:/var/lib/redis -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice ghcr.io/thomisus/onlyoffice-documentserver-unlimited - # wget https://github.com/ONLYOFFICE/Docker-DocumentServer/blob/master/docker-compose.yml - # - sudo -u $websrv_usr php /var/www/nextcloud/occ app:install onlyoffice >> $insl 2>&1 + mkdir -p /app/onlyoffice/DocumentServer/data/certs + openssl genrsa -out /app/onlyoffice/DocumentServer/data/certs/tls.key 2048 + openssl req -new -config /opt/open_ssl2.conf -key /app/onlyoffice/DocumentServer/data/certs/tls.key -out /app/onlyoffice/DocumentServer/data/certs/tls.csr + openssl x509 -req -days 4096 -in /app/onlyoffice/DocumentServer/data/certs/tls.csr -signkey /app/onlyoffice/DocumentServer/data/certs/tls.key -out /app/onlyoffice/DocumentServer/data/certs/tls.crt + openssl dhparam -out /app/onlyoffice/DocumentServer/data/certs/dhparam.pem 2048 + ufw allow 9080/tcp + ufw allow 9443/tcp + # docker run -i -t -d -p 9443:443 --env-file /root/onlyoffice/.env -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice -v /app/onlyoffice/DocumentServer/rabbitmq:/var/lib/rabbitmq -v /app/onlyoffice/DocumentServer/redis:/var/lib/redis -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice ghcr.io/thomisus/onlyoffice-documentserver-unlimited + docker run -i -t -d -p 9443:443 -p 9080:80 -e ssl_verify_client='false' -e use_unauthorized_storage='true' -e allow_private_ip_address='true' -e secure_link_secret='sekret' -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice -v /app/onlyoffice/DocumentServer/rabbitmq:/var/lib/rabbitmq -v /app/onlyoffice/DocumentServer/redis:/var/lib/redis -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice ghcr.io/thomisus/onlyoffice-documentserver-unlimited + # wget https://github.com/ONLYOFFICE/Docker-DocumentServer/blob/master/docker-compose.yml + # + sudo -u $websrv_usr php /var/www/nextcloud/occ app:install onlyoffice >> $insl 2>&1 } # Backup function ncbackup { -echo "!!!!!!! Creating backup." >> $insl 2>&1 -echo "Creating backup - it may take some time, please wait." -echo "Check if directory for backup exist, and create it if not." >> $insl 2>&1 -mkdir $nbckd >> $insl 2>&1 -ncverf -echo "Backing up database." >> $insl 2>&1 -echo "Backing up database." -dbname=$(grep "dbname" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') -dbpassword=$(grep "dbpassword" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') -dbuser=$(grep "dbuser" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') -mysqldump -u $dbuser -p$dbpassword $dbname > /var/www/nextcloud/nextcloud.sql - -echo "Backing up Nextcloud directory - excluding files stored by users!" >> $insl 2>&1 -echo "Backing up Nextcloud directory - excluding files stored by users!" -rm -rf $nbckd/$nbckf >> $insl 2>&1 -tar -pcf $nbckd/$nbckf --exclude="/var/www/nextcloud/data" /var/www/nextcloud >> $insl 2>&1 -tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/.h* >> $insl 2>&1 -tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/.o* >> $insl 2>&1 -tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/audit.log >> $insl 2>&1 -tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/index.* >> $insl 2>&1 -tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/nextcloud.log >> $insl 2>&1 -tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/updater.log >> $insl 2>&1 -tar -rpf $nbckd/$nbckf --exclude="preview" /var/www/nextcloud/data/appdata_* >> $insl 2>&1 -tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/bridge-bot >> $insl 2>&1 -tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/files_external >> $insl 2>&1 -tar -rpf $nbckd/$nbckf --exclude="backups" /var/www/nextcloud/data/updater-* >> $insl 2>&1 - -echo "Compressing backup." >> $insl 2>&1 -echo "Compressing backup." -lbzip2 -k -z -9 $nbckd/$nbckf -rm -rf $nbckd/$nbckf -mv $nbckd/nextcloud.tar.bz2 $nbckd/$(date +%Y-%m-%d-at-%H:%M:%S)-nc-v$ncverf.tar.bz2 -rm -rf /var/www/nextcloud/nextcloud.sql >> $insl 2>&1 -echo "Backup creation finished." >> $insl 2>&1 -echo "Backup creation finished." + echo "!!!!!!! Creating backup." >> $insl 2>&1 + echo "Creating backup - it may take some time, please wait." + echo "Check if directory for backup exist, and create it if not." >> $insl 2>&1 + mkdir $nbckd >> $insl 2>&1 + ncverf + echo "Backing up database." >> $insl 2>&1 + echo "Backing up database." + dbname=$(grep "dbname" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') + dbpassword=$(grep "dbpassword" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') + dbuser=$(grep "dbuser" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') + mysqldump -u $dbuser -p$dbpassword $dbname > /var/www/nextcloud/nextcloud.sql + + echo "Backing up Nextcloud directory - excluding files stored by users!" >> $insl 2>&1 + echo "Backing up Nextcloud directory - excluding files stored by users!" + rm -rf $nbckd/$nbckf >> $insl 2>&1 + tar -pcf $nbckd/$nbckf --exclude="/var/www/nextcloud/data" /var/www/nextcloud >> $insl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/.h* >> $insl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/.o* >> $insl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/audit.log >> $insl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/index.* >> $insl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/nextcloud.log >> $insl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/updater.log >> $insl 2>&1 + tar -rpf $nbckd/$nbckf --exclude="preview" /var/www/nextcloud/data/appdata_* >> $insl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/bridge-bot >> $insl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/files_external >> $insl 2>&1 + tar -rpf $nbckd/$nbckf --exclude="backups" /var/www/nextcloud/data/updater-* >> $insl 2>&1 + + echo "Compressing backup." >> $insl 2>&1 + echo "Compressing backup." + lbzip2 -k -z -9 $nbckd/$nbckf + rm -rf $nbckd/$nbckf + mv $nbckd/nextcloud.tar.bz2 $nbckd/$(date +%Y-%m-%d-at-%H:%M:%S)-nc-v$ncverf.tar.bz2 + rm -rf /var/www/nextcloud/nextcloud.sql >> $insl 2>&1 + echo "Backup creation finished." >> $insl 2>&1 + echo "Backup creation finished." } # Restore function ncrestore { -echo "Nextcloud installer $ver (www.marcinwilk.eu) started. RESTORE MODE." >> $rstl 2>&1 -date >> $rstl 2>&1 -echo "---------------------------------------------------------------------------" >> $rstl 2>&1 -if [ "$restore" = "list" ]; then - echo "Backup files that can be used as argument to do restore (eg. nextcloud-ins.sh -restore=filename.tar.bz2):" - mkdir $nbckd >> $rstl 2>&1 - ls -1 $nbckd/ - echo "Listing files for restore process:" >> $rstl 2>&1 - ls -1 $nbckd/ >> $rstl 2>&1 -else - if [ -e "$nbckd/$restore" ]; then - echo "Printing informations for user." >> $rstl 2>&1 - echo "Trying to restore Nextcloud files and it's database from selected backup file." - echo "It will not restore users data or software upgraded inside operating system (like PHP vetrsion)." - echo "So you may need to revert some changes in operating system by yourself." - echo "" - echo "You may now cancel this script with CRTL+C," - echo "or wait 20 seconds so it will try to restore files" - echo "from backup file that you've selected as restore argument." - echo "" - sleep 21 - echo "First the backup of current Nextcloud install will be made. It will take time, be patient!" - echo "Backing up database." - echo "Backup current Nextcloud started. First database." >> $rstl 2>&1 - dbname=$(grep "dbname" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') - dbpassword=$(grep "dbpassword" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') - dbuser=$(grep "dbuser" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') - mysqldump -u $dbuser -p$dbpassword $dbname > /var/www/nextcloud/nextcloud.sql - echo "Backing up files (excluding users files)." - echo "Creating Nextcloud files backup." >> $rstl 2>&1 - rm -rf $nbckd/$nbckf >> $rstl 2>&1 - cp /var/www/nextcloud/config/config.php $nbckd/config.php >> $rstl 2>&1 - tar -pcf $nbckd/$nbckf --exclude="/var/www/nextcloud/data" /var/www/nextcloud >> $rstl 2>&1 - tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/.h* >> $rstl 2>&1 - tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/.o* >> $rstl 2>&1 - tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/audit.log >> $rstl 2>&1 - tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/index.* >> $rstl 2>&1 - tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/nextcloud.log >> $rstl 2>&1 - tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/updater.log >> $rstl 2>&1 - tar -rpf $nbckd/$nbckf --exclude="preview" /var/www/nextcloud/data/appdata_* >> $rstl 2>&1 - tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/bridge-bot >> $rstl 2>&1 - tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/files_external >> $rstl 2>&1 - tar -rpf $nbckd/$nbckf --exclude="backups" /var/www/nextcloud/data/updater-* >> $rstl 2>&1 - echo "Compressing backup." - echo "Compressing backup." >> $rstl 2>&1 - lbzip2 -k -z -9 $nbckd/$nbckf - rm -rf $nbckd/$nbckf - ncverf - mv $nbckd/nextcloud.tar.bz2 $nbckd/$(date +%Y-%m-%d-at-%H:%M:%S)-nc-v$ncverf.tar.bz2 - echo "Clearing(deleting) old NC files." >> $rstl 2>&1 - find /var/www/nextcloud/* -not -path "*/var/www/nextcloud/data*" -delete >> $rstl 2>&1 - rm -rf /var/www/nextcloud/.* >> $rstl 2>&1 - rm -rf /var/www/nextcloud/data/.* >> $rstl 2>&1 - rm -rf /var/www/nextcloud/data/*.log >> $rstl 2>&1 - rm -rf /var/www/nextcloud/data/index.* >> $rstl 2>&1 - rm -rf /var/www/nextcloud/data/bridge-bot >> $rstl 2>&1 - rm -rf /var/www/nextcloud/data/files_external >> $rstl 2>&1 - rm -rf /var/www/nextcloud/data/appdata_*/preview >> $rstl 2>&1 - rm -rf /var/www/nextcloud/data/updater-*/backups >> $rstl 2>&1 - echo "Backup finished, restoring Nextcloud." - echo "Backup finished, restoring Nextcloud." >> $rstl 2>&1 - tar -xf $nbckd/$restore --directory / - echo "Files extracting completed. Restoring database." - echo "Files extracting completed. Restoring database." >> $rstl 2>&1 - dbname=$(grep "dbname" "$nbckd/config.php" | awk -F"'" '{print $4}') - dbpassword=$(grep "dbpassword" "$nbckd/config.php" | awk -F"'" '{print $4}') - dbuser=$(grep "dbuser" "$nbckd/config.php" | awk -F"'" '{print $4}') - mysql -u$dbuser -p$dbpassword -e "drop database $dbname" >> $rstl 2>&1 - mysql -u$dbuser -p$dbpassword -e "create database $dbname" >> $rstl 2>&1 - mysql -u$dbuser -p$dbpassword $dbname < /var/www/nextcloud/nextcloud.sql >> $rstl 2>&1 - rm -rf /var/www/nextcloud/nextcloud.sql >> $rstl 2>&1 - rm -rf $nbckd/config.php >> $rstl 2>&1 - echo "Doing Nextcloud maintenance tasks." >> $rstl 2>&1 - echo "Doing Nextcloud maintenance tasks." - sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $rstl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $rstl 2>&1 - echo "Rescanning and updating users files." >> $rstl 2>&1 - echo "Rescanning and updating users files." - sudo -u $websrv_usr php /var/www/nextcloud/occ files:scan-app-data >> $rstl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ files:scan --all >> $rstl 2>&1 - echo "Nextcloud restoration process finished." >> $rstl 2>&1 - echo "Nextcloud restoration process finished." - echo "" - echo "You may try to login and check if everything is fine now." - else - echo "Wrong argument used for restore variable." >> $rstl 2>&1 - echo "An incorrect file name was entered, or an invalid value for the restore argument." - echo "Please verify entered data and start again." - echo "Use restore=list to find out available restore files." - fi -fi + echo "Nextcloud installer $ver (www.marcinwilk.eu) started. RESTORE MODE." >> $rstl 2>&1 + date >> $rstl 2>&1 + echo "---------------------------------------------------------------------------" >> $rstl 2>&1 + if [ "$restore" = "list" ]; then + echo "Backup files that can be used as argument to do restore (eg. nextcloud-ins.sh -restore=filename.tar.bz2):" + mkdir $nbckd >> $rstl 2>&1 + ls -1 $nbckd/ + echo "Listing files for restore process:" >> $rstl 2>&1 + ls -1 $nbckd/ >> $rstl 2>&1 + else + if [ -e "$nbckd/$restore" ]; then + echo "Printing informations for user." >> $rstl 2>&1 + echo "Trying to restore Nextcloud files and it's database from selected backup file." + echo "It will not restore users data or software upgraded inside operating system (like PHP vetrsion)." + echo "So you may need to revert some changes in operating system by yourself." + echo "" + echo "You may now cancel this script with CRTL+C," + echo "or wait 20 seconds so it will try to restore files" + echo "from backup file that you've selected as restore argument." + echo "" + sleep 21 + echo "First the backup of current Nextcloud install will be made. It will take time, be patient!" + echo "Backing up database." + echo "Backup current Nextcloud started. First database." >> $rstl 2>&1 + dbname=$(grep "dbname" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') + dbpassword=$(grep "dbpassword" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') + dbuser=$(grep "dbuser" "/var/www/nextcloud/config/config.php" | awk -F"'" '{print $4}') + mysqldump -u $dbuser -p$dbpassword $dbname > /var/www/nextcloud/nextcloud.sql + echo "Backing up files (excluding users files)." + echo "Creating Nextcloud files backup." >> $rstl 2>&1 + rm -rf $nbckd/$nbckf >> $rstl 2>&1 + cp /var/www/nextcloud/config/config.php $nbckd/config.php >> $rstl 2>&1 + tar -pcf $nbckd/$nbckf --exclude="/var/www/nextcloud/data" /var/www/nextcloud >> $rstl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/.h* >> $rstl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/.o* >> $rstl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/audit.log >> $rstl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/index.* >> $rstl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/nextcloud.log >> $rstl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/updater.log >> $rstl 2>&1 + tar -rpf $nbckd/$nbckf --exclude="preview" /var/www/nextcloud/data/appdata_* >> $rstl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/bridge-bot >> $rstl 2>&1 + tar -rpf $nbckd/$nbckf /var/www/nextcloud/data/files_external >> $rstl 2>&1 + tar -rpf $nbckd/$nbckf --exclude="backups" /var/www/nextcloud/data/updater-* >> $rstl 2>&1 + echo "Compressing backup." + echo "Compressing backup." >> $rstl 2>&1 + lbzip2 -k -z -9 $nbckd/$nbckf + rm -rf $nbckd/$nbckf + ncverf + mv $nbckd/nextcloud.tar.bz2 $nbckd/$(date +%Y-%m-%d-at-%H:%M:%S)-nc-v$ncverf.tar.bz2 + echo "Clearing(deleting) old NC files." >> $rstl 2>&1 + find /var/www/nextcloud/* -not -path "*/var/www/nextcloud/data*" -delete >> $rstl 2>&1 + rm -rf /var/www/nextcloud/.* >> $rstl 2>&1 + rm -rf /var/www/nextcloud/data/.* >> $rstl 2>&1 + rm -rf /var/www/nextcloud/data/*.log >> $rstl 2>&1 + rm -rf /var/www/nextcloud/data/index.* >> $rstl 2>&1 + rm -rf /var/www/nextcloud/data/bridge-bot >> $rstl 2>&1 + rm -rf /var/www/nextcloud/data/files_external >> $rstl 2>&1 + rm -rf /var/www/nextcloud/data/appdata_*/preview >> $rstl 2>&1 + rm -rf /var/www/nextcloud/data/updater-*/backups >> $rstl 2>&1 + echo "Backup finished, restoring Nextcloud." + echo "Backup finished, restoring Nextcloud." >> $rstl 2>&1 + tar -xf $nbckd/$restore --directory / + echo "Files extracting completed. Restoring database." + echo "Files extracting completed. Restoring database." >> $rstl 2>&1 + dbname=$(grep "dbname" "$nbckd/config.php" | awk -F"'" '{print $4}') + dbpassword=$(grep "dbpassword" "$nbckd/config.php" | awk -F"'" '{print $4}') + dbuser=$(grep "dbuser" "$nbckd/config.php" | awk -F"'" '{print $4}') + mysql -u$dbuser -p$dbpassword -e "drop database $dbname" >> $rstl 2>&1 + mysql -u$dbuser -p$dbpassword -e "create database $dbname" >> $rstl 2>&1 + mysql -u$dbuser -p$dbpassword $dbname < /var/www/nextcloud/nextcloud.sql >> $rstl 2>&1 + rm -rf /var/www/nextcloud/nextcloud.sql >> $rstl 2>&1 + rm -rf $nbckd/config.php >> $rstl 2>&1 + echo "Doing Nextcloud maintenance tasks." >> $rstl 2>&1 + echo "Doing Nextcloud maintenance tasks." + sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $rstl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $rstl 2>&1 + echo "Rescanning and updating users files." >> $rstl 2>&1 + echo "Rescanning and updating users files." + sudo -u $websrv_usr php /var/www/nextcloud/occ files:scan-app-data >> $rstl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ files:scan --all >> $rstl 2>&1 + echo "Nextcloud restoration process finished." >> $rstl 2>&1 + echo "Nextcloud restoration process finished." + echo "" + echo "You may try to login and check if everything is fine now." + else + echo "Wrong argument used for restore variable." >> $rstl 2>&1 + echo "An incorrect file name was entered, or an invalid value for the restore argument." + echo "Please verify entered data and start again." + echo "Use restore=list to find out available restore files." + fi + fi } echo -e "\e[38;5;214mNextcloud Install Script\e[39;0m @@ -1329,198 +1410,198 @@ echo "-------------------------------------------------------------------------- if [ $user != root ] then - echo -e "You must be \e[38;5;214mroot\e[39;0m. Mission aborted!" - echo -e "You are trying to start this script as: \e[1;31m$user\e[39;0m" - unset LC_ALL - exit 0 + echo -e "You must be \e[38;5;214mroot\e[39;0m. Mission aborted!" + echo -e "You are trying to start this script as: \e[1;31m$user\e[39;0m" + unset LC_ALL + exit 0 fi if [ -z "$restore" ] then - echo "" > /dev/null + echo "" > /dev/null else - echo -e "Restore argument was used! \e[1;32mSkipping install/upgrade process!\e[39;0m" - ncrestore - unset LC_ALL - exit 0 + echo -e "Restore argument was used! \e[1;32mSkipping install/upgrade process!\e[39;0m" + ncrestore + unset LC_ALL + exit 0 fi if $backup; then - echo -e "Backup argument was used! \e[1;32mForcing backup generation now!\e[39;0m" - ncbackup - unset LC_ALL - exit 0 + echo -e "Backup argument was used! \e[1;32mForcing backup generation now!\e[39;0m" + ncbackup + unset LC_ALL + exit 0 else - echo "" > /dev/null + echo "" > /dev/null fi if [ -e $insl ] || [ -e $ver_file ] then - echo "Nextcloud installer - $ver (www.marcinwilk.eu) started." >> $insl 2>&1 - date >> $insl 2>&1 - echo "---------------------------------------------------------------------------" >> $insl 2>&1 - echo "This script will try to upgrade Nextcloud and all needed services," - echo "based on what was done by it's previous version." - echo "" - echo "Trying to find preceding installer version." - if [ -e $ver_file ] - then - echo "Detected previous install:" - pverr1=$(sed -n '1p' $ver_file) - echo "$pverr1" - echo "With parameters:" - pverr2=$(sed -n '2p' $ver_file) - echo "$pverr2" - echo "" - pver=$(echo $pverr2 | awk -F'[ =]' '/ver/ {print $2}') - lang=$(echo $pverr2 | awk -F'[ =]' '/lang/ {print $4}') - mail=$(echo $pverr2 | awk -F'[ =]' '/mail/ {print $6}') - dm=$(echo $pverr2 | awk -F'[ =]' '/dm/ {print $8}') - nv=$(echo $pverr2 | awk -F'[ =]' '/nv/ {print $10}') - fdir=$(echo $pverr2 | awk -F'[ =]' '/fdir/ {print $12}') - if [ "$pver" = "1.5" ] - then - echo "Detected previous version installer." >> $insl 2>&1 - echo "$pverr1" >> $insl 2>&1 - echo "$pverr2" >> $insl 2>&1 - echo "Version 1.5 installer has been used previously." - echo "Doing some updates if they are available." - nv_verify - ncbackup - echo "Continue with upgrade process, please wait..." - update_os - nv_update - # Installing additional packages added with v1.7 - echo "Installing additional packages added with v1.7 upgrade" >> $insl 2>&1 - install_soft - a2enmod http2 >> $insl 2>&1 - add_http2 - preview_tweaks - sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ db:convert-filecache-bigint --no-interaction >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $rstl 2>&1 - maintenance_window_setup - rm -rf /opt/latest.zip - rm -rf /var/www/nextcloud/config/autoconfig.php - save_upg_info - disable_sleep - restart_websrv - echo "Upgrade process finished." - echo "Job done!" - mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh - unset LC_ALL - exit 0 - fi - if [ "$pver" = "1.6" ] - then - echo "Detected previous version installer." >> $insl 2>&1 - echo "$pverr1" >> $insl 2>&1 - echo "$pverr2" >> $insl 2>&1 - echo "Version 1.6 installer has been used previously." - echo "Doing some updates if they are available." - nv_verify - ncbackup - echo "Continue with upgrade process, please wait..." - update_os - nv_update - sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 - # Installing additional packages added with v1.7 - echo "Installing additional packages added with v1.7 upgrade" >> $insl 2>&1 - install_soft - a2enmod http2 >> $insl 2>&1 - preview_tweaks - add_http2 - rm -rf /opt/latest.zip - rm -rf /var/www/nextcloud/config/autoconfig.php - sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $rstl 2>&1 - maintenance_window_setup - save_upg_info - disable_sleep - restart_websrv - echo "Upgrade process finished." - echo "Job done!" - mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh - unset LC_ALL - exit 0 - fi - if [ "$pver" = "1.7" ] || [ "$pver" = "1.8" ] || [ "$pver" = "1.9" ] - then - echo "Detected similar version already used." >> $insl 2>&1 - echo "$pverr1" >> $insl 2>&1 - echo "$pverr2" >> $insl 2>&1 - echo "Similar version already used (it means not many works ahead)." - nv_verify - ncbackup - echo "Doing some updates if they are available." - update_os - nv_update - sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $rstl 2>&1 - maintenance_window_setup - restart_websrv - echo "Upgrade process finished." - echo "Job done!" - save_upg_info - mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh - unset LC_ALL - exit 0 - fi - if [ "$pver" = "1.10" ] || [ "$pver" = "1.11" ] - then - echo "Detected similar version already used." >> $insl 2>&1 - echo "$pverr1" >> $insl 2>&1 - echo "$pverr2" >> $insl 2>&1 - echo "Similar version already used (it means not many works ahead)." - nv_verify - ncbackup - echo "Doing some updates if they are available." - update_os - nv_update - sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $rstl 2>&1 - maintenance_window_setup - restart_websrv - echo "Upgrade process finished." - echo "Job done!" - save_upg_info - mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh - unset LC_ALL - exit 0 - fi - else - echo "Detected installer version 1.4 or older already used." - echo "Detected installer version 1.4 or older already used." >> $insl 2>&1 - if [ -e $elvf ] || [ -e $ubuvf ] - then - echo "In case of Fedora/EL/Ubuntu this is impossible, must be some error." - echo "Highly possible that script was canceled during work." - echo "Clearing now..." - rm -rf $insl - echo "Run script again, so it will start from beggining without error." - unset LC_ALL - exit 0 - fi - echo "Upgrading in progress..." - echo "Updating OS." - echo "!!!!!!! Updating OS." >> $insl 2>&1 - update_os - echo "Installing additional packages." - install_soft - restart_websrv - echo "Setting up firewall" - echo "Setting up firewall" >> $insl 2>&1 - ufw default allow >> $insl 2>&1 - ufw --force enable >> $insl 2>&1 - ufw allow OpenSSH >> $insl 2>&1 - ufw allow 'WWW Full' >> $insl 2>&1 - ufw allow 7867/tcp >> $insl 2>&1 - ufw default deny >> $insl 2>&1 - ufw show added >> $insl 2>&1 - ncbackup - echo "OS tweaking for Redis." - sysctl vm.overcommit_memory=1 >> $insl 2>&1 - echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf - echo "#!/bin/sh -e + echo "Nextcloud installer - $ver (www.marcinwilk.eu) started." >> $insl 2>&1 + date >> $insl 2>&1 + echo "---------------------------------------------------------------------------" >> $insl 2>&1 + echo "This script will try to upgrade Nextcloud and all needed services," + echo "based on what was done by it's previous version." + echo "" + echo "Trying to find preceding installer version." + if [ -e $ver_file ] + then + echo "Detected previous install:" + pverr1=$(sed -n '1p' $ver_file) + echo "$pverr1" + echo "With parameters:" + pverr2=$(sed -n '2p' $ver_file) + echo "$pverr2" + echo "" + pver=$(echo $pverr2 | awk -F'[ =]' '/ver/ {print $2}') + lang=$(echo $pverr2 | awk -F'[ =]' '/lang/ {print $4}') + mail=$(echo $pverr2 | awk -F'[ =]' '/mail/ {print $6}') + dm=$(echo $pverr2 | awk -F'[ =]' '/dm/ {print $8}') + nv=$(echo $pverr2 | awk -F'[ =]' '/nv/ {print $10}') + fdir=$(echo $pverr2 | awk -F'[ =]' '/fdir/ {print $12}') + if [ "$pver" = "1.5" ] + then + echo "Detected previous version installer." >> $insl 2>&1 + echo "$pverr1" >> $insl 2>&1 + echo "$pverr2" >> $insl 2>&1 + echo "Version 1.5 installer has been used previously." + echo "Doing some updates if they are available." + nv_verify + ncbackup + echo "Continue with upgrade process, please wait..." + update_os + nv_update + # Installing additional packages added with v1.7 upgrade. + echo "Installing additional packages added with v1.7 upgrade." >> $insl 2>&1 + install_soft + a2enmod http2 >> $insl 2>&1 + add_http2 + preview_tweaks + sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ db:convert-filecache-bigint --no-interaction >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $rstl 2>&1 + maintenance_window_setup + rm -rf /opt/latest.zip + rm -rf /var/www/nextcloud/config/autoconfig.php + save_upg_info + disable_sleep + restart_websrv + echo "Upgrade process finished." + echo "Job done!" + mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh + unset LC_ALL + exit 0 + fi + if [ "$pver" = "1.6" ] + then + echo "Detected previous version installer." >> $insl 2>&1 + echo "$pverr1" >> $insl 2>&1 + echo "$pverr2" >> $insl 2>&1 + echo "Version 1.6 installer has been used previously." + echo "Doing some updates if they are available." + nv_verify + ncbackup + echo "Continue with upgrade process, please wait..." + update_os + nv_update + sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 + # Installing additional packages added with v1.7 upgrade. + echo "Installing additional packages added with v1.7 upgrade." >> $insl 2>&1 + install_soft + a2enmod http2 >> $insl 2>&1 + preview_tweaks + add_http2 + rm -rf /opt/latest.zip + rm -rf /var/www/nextcloud/config/autoconfig.php + sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $rstl 2>&1 + maintenance_window_setup + save_upg_info + disable_sleep + restart_websrv + echo "Upgrade process finished." + echo "Job done!" + mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh + unset LC_ALL + exit 0 + fi + if [ "$pver" = "1.7" ] || [ "$pver" = "1.8" ] || [ "$pver" = "1.9" ] + then + echo "Detected similar version already used." >> $insl 2>&1 + echo "$pverr1" >> $insl 2>&1 + echo "$pverr2" >> $insl 2>&1 + echo "Similar version already used (it means not many works ahead)." + nv_verify + ncbackup + echo "Doing some updates if they are available." + update_os + nv_update + sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $rstl 2>&1 + maintenance_window_setup + restart_websrv + echo "Upgrade process finished." + echo "Job done!" + save_upg_info + mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh + unset LC_ALL + exit 0 + fi + if [ "$pver" = "1.10" ] || [ "$pver" = "1.11" ] + then + echo "Detected similar version already used." >> $insl 2>&1 + echo "$pverr1" >> $insl 2>&1 + echo "$pverr2" >> $insl 2>&1 + echo "Similar version already used (it means not many works ahead)." + nv_verify + ncbackup + echo "Doing some updates if they are available." + update_os + nv_update + sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $rstl 2>&1 + maintenance_window_setup + restart_websrv + echo "Upgrade process finished." + echo "Job done!" + save_upg_info + mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh + unset LC_ALL + exit 0 + fi + else + echo "Detected installer version 1.4 or older already used." + echo "Detected installer version 1.4 or older already used." >> $insl 2>&1 + if [ -e $elvf ] || [ -e $ubuvf ] + then + echo "In case of Fedora/EL/Ubuntu this is impossible, must be some error." + echo "Highly possible that script was canceled during work." + echo "Clearing now..." + rm -rf $insl + echo "Run script again, so it will start from beggining without error." + unset LC_ALL + exit 0 + fi + echo "Upgrading in progress..." + echo "Updating OS." + echo "!!!!!!! Updating OS." >> $insl 2>&1 + update_os + echo "Installing additional packages." + install_soft + restart_websrv + echo "Setting up firewall." + echo "Setting up firewall." >> $insl 2>&1 + ufw default allow >> $insl 2>&1 + ufw --force enable >> $insl 2>&1 + ufw allow OpenSSH >> $insl 2>&1 + ufw allow 'WWW Full' >> $insl 2>&1 + ufw allow 7867/tcp >> $insl 2>&1 + ufw default deny >> $insl 2>&1 + ufw show added >> $insl 2>&1 + ncbackup + echo "OS tweaking for Redis." + sysctl vm.overcommit_memory=1 >> $insl 2>&1 + echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf + echo "#!/bin/sh -e # # rc.local # @@ -1535,247 +1616,247 @@ then echo madvise > /sys/kernel/mm/transparent_hugepage/enabled exit 0" >> /etc/rc.local - chmod +x /etc/rc.local - systemctl daemon-reload - systemctl start rc-local - echo "!!!!!!! Upgrading Nextcloud." >> $insl 2>&1 - echo "Upgrading Nextcloud." - echo "Checking currently installed version." >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:get version >> $insl 2>&1 - sncver - if [ "$ncver" = "24" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "24" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "24" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "24" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "25" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "25" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "25" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "25" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "26" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "26" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "26" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "26" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "27" ] - then - echo "Installing PHP 8.2" - install_php82 - php82_tweaks - nv_upd_simpl - fi - sncver - if [ "$ncver" = "27" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "27" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "28" ] - then - echo "Installing PHP 8.2" - install_php82 - php82_tweaks - nv_upd_simpl - fi - sncver - if [ "$ncver" = "28" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "28" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "29" ] - then - echo "Installing PHP 8.3" - install_php83 - php83_tweaks - nv_upd_simpl - fi - sncver - if [ "$ncver" = "29" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "29" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "30" ] - then - echo "Installing PHP 8.3" - install_php83 - php83_tweaks - nv_upd_simpl - fi - sncver - if [ "$ncver" = "30" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "30" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "30" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "31" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "31" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "31" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "32" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "32" ] - then - nv_upd_simpl - fi - sncver - if [ "$ncver" = "32" ] - then - nv_upd_simpl - fi - sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 - echo "" - echo "" - echo "Nextcloud upgraded to version:" >> $insl 2>&1 - echo "Nextcloud upgraded to version:" - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:get version >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:get version - echo "Adding some more Nextcloud tweaks." - sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $insl 2>&1 - echo "" - sed -i "/installed' => true,/a\ \ 'htaccess.RewriteBase' => '/'," /var/www/nextcloud/config/config.php - maintenance_window_setup - sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:update:htaccess >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ db:convert-filecache-bigint --no-interaction >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set ALLOW_SELF_SIGNED --value="true" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enable_previews --value="true" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set preview_max_memory --value="512" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set preview_max_x --value="12288" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set preview_max_y --value="6912" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set auth.bruteforce.protection.enabled --value="true" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ app:install twofactor_totp >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ app:enable twofactor_totp >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ app:install twofactor_webauthn >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ app:enable twofactor_webauthn >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:app:set files max_chunk_size --value="20971520" >> $insl 2>&1 - touch $ver_file - echo "Removing PHP 8.1" - apt-get remove -y -o DPkg::Lock::Timeout=-1 php8.1 php8.1-* >> $insl 2>&1 - a2enmod http2 >> $insl 2>&1 - a2enmod php8.3 >> $insl 2>&1 - add_http2 - preview_tweaks - rm -rf /opt/latest.zip - rm -rf /var/www/nextcloud/config/autoconfig.php - systemctl restart mariadb >> $insl 2>&1 - systemctl restart redis-server >> $insl 2>&1 - restart_websrv - disable_sleep - save_upg_info - echo "Upgrade process finished." - echo "Job done!" - mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh - unset LC_ALL - exit 0 - fi + chmod +x /etc/rc.local + systemctl daemon-reload + systemctl start rc-local + echo "!!!!!!! Upgrading Nextcloud." >> $insl 2>&1 + echo "Upgrading Nextcloud." + echo "Checking currently installed version." >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:get version >> $insl 2>&1 + sncver + if [ "$ncver" = "24" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "24" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "24" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "24" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "25" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "25" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "25" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "25" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "26" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "26" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "26" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "26" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "27" ] + then + echo "Installing PHP 8.2." + install_php82 + php82_tweaks + nv_upd_simpl + fi + sncver + if [ "$ncver" = "27" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "27" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "28" ] + then + echo "Installing PHP 8.2." + install_php82 + php82_tweaks + nv_upd_simpl + fi + sncver + if [ "$ncver" = "28" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "28" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "29" ] + then + echo "Installing PHP 8.3." + install_php83 + php83_tweaks + nv_upd_simpl + fi + sncver + if [ "$ncver" = "29" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "29" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "30" ] + then + echo "Installing PHP 8.3." + install_php83 + php83_tweaks + nv_upd_simpl + fi + sncver + if [ "$ncver" = "30" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "30" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "30" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "31" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "31" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "31" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "32" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "32" ] + then + nv_upd_simpl + fi + sncver + if [ "$ncver" = "32" ] + then + nv_upd_simpl + fi + sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 + echo "" + echo "" + echo "Nextcloud upgraded to version:" >> $insl 2>&1 + echo "Nextcloud upgraded to version:" + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:get version >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:get version + echo "Adding some more Nextcloud tweaks." + sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:repair --include-expensive >> $insl 2>&1 + echo "" + sed -i "/installed' => true,/a\ \ 'htaccess.RewriteBase' => '/'," /var/www/nextcloud/config/config.php + maintenance_window_setup + sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:update:htaccess >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ db:add-missing-indices >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ db:convert-filecache-bigint --no-interaction >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set ALLOW_SELF_SIGNED --value="true" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set enable_previews --value="true" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set preview_max_memory --value="512" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set preview_max_x --value="12288" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set preview_max_y --value="6912" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set auth.bruteforce.protection.enabled --value="true" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ app:install twofactor_totp >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ app:enable twofactor_totp >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ app:install twofactor_webauthn >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ app:enable twofactor_webauthn >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:app:set files max_chunk_size --value="20971520" >> $insl 2>&1 + touch $ver_file + echo "Removing PHP 8.1" + apt-get remove -y -o DPkg::Lock::Timeout=-1 php8.1 php8.1-* >> $insl 2>&1 + a2enmod http2 >> $insl 2>&1 + a2enmod php8.3 >> $insl 2>&1 + add_http2 + preview_tweaks + rm -rf /opt/latest.zip + rm -rf /var/www/nextcloud/config/autoconfig.php + systemctl restart mariadb >> $insl 2>&1 + systemctl restart redis-server >> $insl 2>&1 + restart_websrv + disable_sleep + save_upg_info + echo "Upgrade process finished." + echo "Job done!" + mv $cdir/$scrpt.sh $scrpt-$(date +"%FT%H%M").sh + unset LC_ALL + exit 0 + fi else - echo "" + echo "" fi # Here clean install starts! if [ -e $debvf ] || [ -e $elvf ] then - if [ -n "$el5" ] || [ -n "$el6" ] || [ -n "$el7" ] || [ -n "$el8" ] || [ -n "$ubu19" ] || [ -n "$ubu20" ] || [ -n "$ubu21" ] || [ -n "$fed36" ] || [ -n "$fed37" ] || [ -n "$fed38" ] - then - echo "Too old main Linux distribution release, try newer." - unset LC_ALL - exit 0 - else - echo "" > /dev/null - fi -else - echo "Your Linux distribution isn't supported by this script." - echo "Mission aborted!" - echo "Unsupported Linux distro!" - unset LC_ALL + if [ -n "$el5" ] || [ -n "$el6" ] || [ -n "$el7" ] || [ -n "$el8" ] || [ -n "$ubu19" ] || [ -n "$ubu20" ] || [ -n "$ubu21" ] || [ -n "$fed36" ] || [ -n "$fed37" ] || [ -n "$fed38" ] + then + echo "Too old main Linux distribution release, try newer." + unset LC_ALL exit 0 + else + echo "" > /dev/null + fi +else + echo "Your Linux distribution isn't supported by this script." + echo "Mission aborted!" + echo "Unsupported Linux distro!" + unset LC_ALL + exit 0 fi echo "This script will automatically install Nextcloud service." echo "Few addditional packages will be installed:" @@ -1813,36 +1894,36 @@ sleep 51 if [ $cpu = x86_64 ] then - echo -e "Detected Kernel CPU arch. is \e[1;32mx86_64\e[39;0m!" + echo -e "Detected Kernel CPU arch. is \e[1;32mx86_64\e[39;0m!" elif [ $cpu = i386 ] then - echo -e "Detected Kernel CPU arch. is \e[1;31mi386!\e[39;0m" - echo "Sorry - only x86_64 is supported!" - echo "Mission aborted!" - unset LC_ALL - exit 0 + echo -e "Detected Kernel CPU arch. is \e[1;31mi386!\e[39;0m" + echo "Sorry - only x86_64 is supported!" + echo "Mission aborted!" + unset LC_ALL + exit 0 else - echo "No supported kernel architecture. Aborting!" - echo "I did not detected x86_64 or i386 kernel architecture." - echo "It looks like your configuration isn't supported." - echo "Mission aborted!" - unset LC_ALL - exit 0 + echo "No supported kernel architecture. Aborting!" + echo "I did not detected x86_64 or i386 kernel architecture." + echo "It looks like your configuration isn't supported." + echo "Mission aborted!" + unset LC_ALL + exit 0 fi echo "Detected Supported Linux distribution:" if [ -e $debvf ] then - if [ -e $ubuvf ] - then - echo -e "$ubuv" - else - echo -e "Debian Linux release $debv" - fi + if [ -e $ubuvf ] + then + echo -e "$ubuv" + else + echo -e "Debian Linux release $debv" + fi fi if [ -e $elvf ] then - echo $elv + echo $elv fi touch /var/log/nextcloud-installer.log @@ -1853,172 +1934,172 @@ echo "-------------------------------------------------------------------------- if [ -z "$lang" ] then - echo "No custom language variable used." >> $insl 2>&1 + echo "No custom language variable used." >> $insl 2>&1 else - echo -e "Using language variable: \e[1;32m$lang\e[39;0m" - echo "Using language variable: $lang" >> $insl 2>&1 + echo -e "Using language variable: \e[1;32m$lang\e[39;0m" + echo "Using language variable: $lang" >> $insl 2>&1 fi if [ -z "$mail" ] then - echo "No e_mail variable used." >> $insl 2>&1 + echo "No e_mail variable used." >> $insl 2>&1 else - echo -e "Using e_mail variable: \e[1;32m$mail\e[39;0m" - echo "Using e_mail variable: $mail" >> $insl 2>&1 + echo -e "Using e_mail variable: \e[1;32m$mail\e[39;0m" + echo "Using e_mail variable: $mail" >> $insl 2>&1 fi if [ -z "$dm" ] then - echo "No custom domain name variable used." >> $insl 2>&1 + echo "No custom domain name variable used." >> $insl 2>&1 else - echo -e "Using domain variable: \e[1;32m$dm\e[39;0m" - echo "Using domain variable: $dm" >> $insl 2>&1 + echo -e "Using domain variable: \e[1;32m$dm\e[39;0m" + echo "Using domain variable: $dm" >> $insl 2>&1 fi if [ -z "$nv" ] then - echo "No older version variable used." >> $insl 2>&1 + echo "No older version variable used." >> $insl 2>&1 else - echo -e "Using version variable: \e[1;32m$nv\e[39;0m" - echo "Using version variable: $nv" >> $insl 2>&1 + echo -e "Using version variable: \e[1;32m$nv\e[39;0m" + echo "Using version variable: $nv" >> $insl 2>&1 fi if [ -z "$fdir" ] then - echo "No user files directory variable used." >> $insl 2>&1 + echo "No user files directory variable used." >> $insl 2>&1 else - echo -e "Using user files directory variable: \e[1;32m$fdir\e[39;0m" - echo "Using user files directory variable: $fdir" >> $insl 2>&1 - if [ -e "$fdir" ] - then - echo "User files directory is prepared." >> $insl 2>&1 - else - echo "ERROR: Defined Nextcloud data directory do not exist!" - echo "" - echo "Please prepare directory for Nextcloud user data files." - echo "Installer will now exit, You may restart it, after directory is prepared." - echo "Mission aborted!" - rm -rf $insl - unset LC_ALL - exit 0 - fi + echo -e "Using user files directory variable: \e[1;32m$fdir\e[39;0m" + echo "Using user files directory variable: $fdir" >> $insl 2>&1 + if [ -e "$fdir" ] + then + echo "User files directory is prepared." >> $insl 2>&1 + else + echo "ERROR: Defined Nextcloud data directory do not exist!" + echo "" + echo "Please prepare directory for Nextcloud user data files." + echo "Installer will now exit, You may restart it, after directory is prepared." + echo "Mission aborted!" + rm -rf $insl + unset LC_ALL + exit 0 + fi fi # Generating passwords for database and SuperAdmin user. -echo "!!!!!!! Generating passwords for database and SuperAdmin user" >> $insl 2>&1 +echo "!!!!!!! Generating passwords for database and SuperAdmin user." >> $insl 2>&1 openssl rand -base64 30 > /root/dbpass openssl rand -base64 30 > /root/superadminpass mp=$( cat /root/dbpass ) mp2=$( cat /root/superadminpass ) echo "Updating OS." -echo "!!!!!!! Updating OS" >> $insl 2>&1 +echo "!!!!!!! Updating OS." >> $insl 2>&1 update_os if [ "$lang" = "ar" ] then - echo "!!!!!!! Installing language packages - Arabic" >> $insl 2>&1 - if [ -e $debvf ] - then - apt-get install -y -o DPkg::Lock::Timeout=-1 task-arabic >> $insl 2>&1 - locale-gen >> $insl 2>&1 - fi - if [ -e $elvf ] - then - dnf install -y -q glibc-langpack-ar >> $insl 2>&1 - fi - localectl set-locale LANG=ar_EG.UTF-8 >> $insl 2>&1 + echo "!!!!!!! Installing language package: Arabic" >> $insl 2>&1 + if [ -e $debvf ] + then + apt-get install -y -o DPkg::Lock::Timeout=-1 task-arabic >> $insl 2>&1 + locale-gen >> $insl 2>&1 + fi + if [ -e $elvf ] + then + dnf install -y -q glibc-langpack-ar >> $insl 2>&1 + fi + localectl set-locale LANG=ar_EG.UTF-8 >> $insl 2>&1 fi if [ "$lang" = "zh" ] then - echo "!!!!!!! Installing language packages - Chinese" >> $insl 2>&1 - if [ -e $debvf ] - then - apt-get install -y -o DPkg::Lock::Timeout=-1 task-chinese-s task-chinese-t >> $insl 2>&1 - locale-gen >> $insl 2>&1 - fi - if [ -e $elvf ] - then - dnf install -y -q glibc-langpack-zh >> $insl 2>&1 - fi - localectl set-locale LANG=zh_CN.UTF-8 >> $insl 2>&1 + echo "!!!!!!! Installing language package: Chinese" >> $insl 2>&1 + if [ -e $debvf ] + then + apt-get install -y -o DPkg::Lock::Timeout=-1 task-chinese-s task-chinese-t >> $insl 2>&1 + locale-gen >> $insl 2>&1 + fi + if [ -e $elvf ] + then + dnf install -y -q glibc-langpack-zh >> $insl 2>&1 + fi + localectl set-locale LANG=zh_CN.UTF-8 >> $insl 2>&1 fi if [ "$lang" = "fr" ] then - echo "!!!!!!! Installing language packages - French" >> $insl 2>&1 - if [ -e $debvf ] - then - apt-get install -y -o DPkg::Lock::Timeout=-1 task-french >> $insl 2>&1 - locale-gen >> $insl 2>&1 - fi - if [ -e $elvf ] - then - dnf install -y -q glibc-langpack-fr >> $insl 2>&1 - fi - localectl set-locale LANG=fr_FR.UTF-8 >> $insl 2>&1 + echo "!!!!!!! Installing language package: French" >> $insl 2>&1 + if [ -e $debvf ] + then + apt-get install -y -o DPkg::Lock::Timeout=-1 task-french >> $insl 2>&1 + locale-gen >> $insl 2>&1 + fi + if [ -e $elvf ] + then + dnf install -y -q glibc-langpack-fr >> $insl 2>&1 + fi + localectl set-locale LANG=fr_FR.UTF-8 >> $insl 2>&1 fi if [ "$lang" = "hi" ] then - echo "!!!!!!! Installing language packages - Hindi" >> $insl 2>&1 - if [ -e $debvf ] - then - apt-get install -y -o DPkg::Lock::Timeout=-1 task-hindi >> $insl 2>&1 - locale-gen >> $insl 2>&1 - fi - if [ -e $elvf ] - then - dnf install -y -q glibc-langpack-hi >> $insl 2>&1 - fi - localectl set-locale LANG=hi_IN >> $insl 2>&1 + echo "!!!!!!! Installing language package: Hindi" >> $insl 2>&1 + if [ -e $debvf ] + then + apt-get install -y -o DPkg::Lock::Timeout=-1 task-hindi >> $insl 2>&1 + locale-gen >> $insl 2>&1 + fi + if [ -e $elvf ] + then + dnf install -y -q glibc-langpack-hi >> $insl 2>&1 + fi + localectl set-locale LANG=hi_IN >> $insl 2>&1 fi if [ "$lang" = "pl" ] then - echo "!!!!!!! Installing language packages - Polish" >> $insl 2>&1 - if [ -e $debvf ] - then - apt-get install -y -o DPkg::Lock::Timeout=-1 task-polish >> $insl 2>&1 - locale-gen >> $insl 2>&1 - fi - if [ -e $elvf ] - then - dnf install -y -q glibc-langpack-pl >> $insl 2>&1 - fi - timedatectl set-timezone Europe/Warsaw >> $insl 2>&1 - localectl set-locale LANG=pl_PL.UTF-8 >> $insl 2>&1 + echo "!!!!!!! Installing language package: Polish" >> $insl 2>&1 + if [ -e $debvf ] + then + apt-get install -y -o DPkg::Lock::Timeout=-1 task-polish >> $insl 2>&1 + locale-gen >> $insl 2>&1 + fi + if [ -e $elvf ] + then + dnf install -y -q glibc-langpack-pl >> $insl 2>&1 + fi + timedatectl set-timezone Europe/Warsaw >> $insl 2>&1 + localectl set-locale LANG=pl_PL.UTF-8 >> $insl 2>&1 fi if [ "$lang" = "es" ] then - echo "!!!!!!! Installing language packages - Spanish" >> $insl 2>&1 - if [ -e $debvf ] - then - apt-get install -y -o DPkg::Lock::Timeout=-1 task-spanish >> $insl 2>&1 - locale-gen >> $insl 2>&1 - fi - if [ -e $elvf ] - then - dnf install -y -q glibc-langpack-es >> $insl 2>&1 - fi - localectl set-locale LANG=es_ES.UTF-8 >> $insl 2>&1 + echo "!!!!!!! Installing language package: Spanish" >> $insl 2>&1 + if [ -e $debvf ] + then + apt-get install -y -o DPkg::Lock::Timeout=-1 task-spanish >> $insl 2>&1 + locale-gen >> $insl 2>&1 + fi + if [ -e $elvf ] + then + dnf install -y -q glibc-langpack-es >> $insl 2>&1 + fi + localectl set-locale LANG=es_ES.UTF-8 >> $insl 2>&1 fi if [ "$lang" = "uk" ] then - echo "!!!!!!! Installing language packages - Ukrainian" >> $insl 2>&1 - if [ -e $debvf ] - then - apt-get install -y -o DPkg::Lock::Timeout=-1 task-ukrainian >> $insl 2>&1 - locale-gen >> $insl 2>&1 - fi - if [ -e $elvf ] - then - dnf install -y -q glibc-langpack-uk >> $insl 2>&1 - fi - localectl set-locale LANG=uk_UA.UTF-8 >> $insl 2>&1 + echo "!!!!!!! Installing language package: Ukrainian" >> $insl 2>&1 + if [ -e $debvf ] + then + apt-get install -y -o DPkg::Lock::Timeout=-1 task-ukrainian >> $insl 2>&1 + locale-gen >> $insl 2>&1 + fi + if [ -e $elvf ] + then + dnf install -y -q glibc-langpack-uk >> $insl 2>&1 + fi + localectl set-locale LANG=uk_UA.UTF-8 >> $insl 2>&1 fi echo "Installing software packages. It may take some time - be patient." @@ -2026,148 +2107,148 @@ echo "!!!!!!! Installing software." >> $insl 2>&1 install_soft if [ -e $debvf ] then - deb12=$( sudo cat /etc/debian_version | awk -F '.' '{print $1}' ) - if [ "$deb12" = "12" ] - then - apt-get install -y -o DPkg::Lock::Timeout=-1 systemd-timesyncd >> $insl 2>&1 - systemctl enable systemd-timesyncd >> $insl 2>&1 - systemctl restart systemd-timesyncd >> $insl 2>&1 - else - if [ -e $ubuvf ] - then - apt-get install -y -o DPkg::Lock::Timeout=-1 systemd-timesyncd >> $insl 2>&1 - systemctl enable systemd-timesyncd >> $insl 2>&1 - systemctl restart systemd-timesyncd >> $insl 2>&1 - else - apt-get install -y -o DPkg::Lock::Timeout=-1 ntp >> $insl 2>&1 - systemctl enable ntp >> $insl 2>&1 - systemctl restart ntp >> $insl 2>&1 - fi - fi + deb12=$( sudo cat /etc/debian_version | awk -F '.' '{print $1}' ) + if [ "$deb12" = "12" ] + then + apt-get install -y -o DPkg::Lock::Timeout=-1 systemd-timesyncd >> $insl 2>&1 + systemctl enable systemd-timesyncd >> $insl 2>&1 + systemctl restart systemd-timesyncd >> $insl 2>&1 + else + if [ -e $ubuvf ] + then + apt-get install -y -o DPkg::Lock::Timeout=-1 systemd-timesyncd >> $insl 2>&1 + systemctl enable systemd-timesyncd >> $insl 2>&1 + systemctl restart systemd-timesyncd >> $insl 2>&1 + else + apt-get install -y -o DPkg::Lock::Timeout=-1 ntp >> $insl 2>&1 + systemctl enable ntp >> $insl 2>&1 + systemctl restart ntp >> $insl 2>&1 + fi + fi fi if [ -e $elvf ] then - timedatectl set-ntp on - dnf install -y -q chrony - systemctl enable chronyd >> $insl 2>&1 - systemctl start chronyd >> $insl 2>&1 - systemctl restart systemd-timedated >> $insl 2>&1 - timedatectl set-ntp true + timedatectl set-ntp on + dnf install -y -q chrony + systemctl enable chronyd >> $insl 2>&1 + systemctl start chronyd >> $insl 2>&1 + systemctl restart systemd-timedated >> $insl 2>&1 + timedatectl set-ntp true fi disable_sleep echo "Installing web server with PHP." -echo "!!!!!!! Installing web server with PHP" >> $insl 2>&1 +echo "!!!!!!! Installing web server with PHP." >> $insl 2>&1 update_os if [ -e $debvf ] then - apt-get install -y -o DPkg::Lock::Timeout=-1 apache2 apache2-utils >> $insl 2>&1 - echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf + apt-get install -y -o DPkg::Lock::Timeout=-1 apache2 apache2-utils >> $insl 2>&1 + echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf fi if [ -e $elvf ] then - dnf install -y -q httpd httpd-tools mod_ssl >> $insl 2>&1 - echo "!!!!!!! Apply HTTPD/Apache SELinux policies." >> $insl 2>&1 - setsebool httpd_unified on >> $insl 2>&1 - setsebool -P httpd_can_network_connect_db on >> $insl 2>&1 - setsebool -P httpd_can_connect_ldap on >> $insl 2>&1 - setsebool -P httpd_can_network_connect on >> $insl 2>&1 - setsebool -P httpd_can_network_memcache on >> $insl 2>&1 - setsebool -P httpd_can_sendmail on >> $insl 2>&1 - setsebool -P httpd_use_cifs on >> $insl 2>&1 - setsebool -P httpd_use_fusefs on >> $insl 2>&1 - setsebool -P httpd_use_gpg on >> $insl 2>&1 + dnf install -y -q httpd httpd-tools mod_ssl >> $insl 2>&1 + echo "!!!!!!! Apply HTTPD/Apache SELinux policies." >> $insl 2>&1 + setsebool httpd_unified on >> $insl 2>&1 + setsebool -P httpd_can_network_connect_db on >> $insl 2>&1 + setsebool -P httpd_can_connect_ldap on >> $insl 2>&1 + setsebool -P httpd_can_network_connect on >> $insl 2>&1 + setsebool -P httpd_can_network_memcache on >> $insl 2>&1 + setsebool -P httpd_can_sendmail on >> $insl 2>&1 + setsebool -P httpd_use_cifs on >> $insl 2>&1 + setsebool -P httpd_use_fusefs on >> $insl 2>&1 + setsebool -P httpd_use_gpg on >> $insl 2>&1 fi if [ "$nv" = "24" ]; then - echo "Installing PHP version 7.x for Nextcloud v24." - echo "!!!!!!! Installing PHP version 7.x for Nextcloud v24" >> $insl 2>&1 - if [ -e $debvf ] - then - if [ -e $ubuvf ] - then - add-apt-repository -y ppa:ondrej/php >> $insl 2>&1 - else - curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg >> $insl 2>&1 - sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' >> $insl 2>&1 - fi - apt-get update >> $insl 2>&1 - apt-get install -y -o DPkg::Lock::Timeout=-1 php7.4 libapache2-mod-php7.4 libmagickcore-6.q16-6-extra php7.4-mysql php7.4-common php7.4-redis php7.4-dom php7.4-curl php7.4-exif php7.4-fileinfo php7.4-bcmath php7.4-gmp php7.4-imagick php7.4-mbstring php7.4-xml php7.4-zip php7.4-iconv php7.4-intl php7.4-simplexml php7.4-xmlreader php7.4-ftp php7.4-ssh2 php7.4-sockets php7.4-gd php7.4-imap php7.4-soap php7.4-xmlrpc php7.4-apcu php7.4-dev php7.4-cli >> $insl 2>&1 - fi - if [ -e $elvf ] - then - if [ -e $fedvf ] - then - dnf install -y -q https://rpms.remirepo.net/fedora/remi-release-39.rpm >> $insl 2>&1 - dnf config-manager --set-enabled remi - else - dnf install -y -q https://rpms.remirepo.net/enterprise/remi-release-9.rpm >> $insl 2>&1 - fi - dnf install -y -q php74 php74-php-apcu php74-php-opcache php74-php-mysql php74-php-bcmath php74-php-common php74-php-geos php74-php-gmp php74-php-pecl-imagick-im7 php74-php-pecl-lzf php74-php-pecl-mcrypt php74-php-pecl-recode php74-php-process php74-php-zstd php74-php-redis php74-php-dom php74-php-curl php74-php-exif php74-php-fileinfo php74-php-mbstring php74-php-xml php74-php-zip php74-php-iconv php74-php-intl php74-php-simplexml php74-php-xmlreader php74-php-ftp php74-php-ssh2 php74-php-sockets php74-php-gd php74-php-imap php74-php-soap php74-php-xmlrpc php74-php-apcu php74-php-cli php74-php-ast php74-php-brotli php74-php-enchant php74-php-ffi php74-php-lz4 php74-php-phalcon5 php74-php-phpiredis php74-php-smbclient php74-php-tidy php74-php-xz >> $insl 2>&1 - dnf install -y -q php74-syspaths php74-mod_php >> $insl 2>&1 - fi + echo "Installing PHP version 7.x for Nextcloud v24." + echo "!!!!!!! Installing PHP version 7.x for Nextcloud v24." >> $insl 2>&1 + if [ -e $debvf ] + then + if [ -e $ubuvf ] + then + add-apt-repository -y ppa:ondrej/php >> $insl 2>&1 + else + curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg >> $insl 2>&1 + sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' >> $insl 2>&1 + fi + apt-get update >> $insl 2>&1 + apt-get install -y -o DPkg::Lock::Timeout=-1 php7.4 libapache2-mod-php7.4 libmagickcore-6.q16-6-extra php7.4-mysql php7.4-common php7.4-redis php7.4-dom php7.4-curl php7.4-exif php7.4-fileinfo php7.4-bcmath php7.4-gmp php7.4-imagick php7.4-mbstring php7.4-xml php7.4-zip php7.4-iconv php7.4-intl php7.4-simplexml php7.4-xmlreader php7.4-ftp php7.4-ssh2 php7.4-sockets php7.4-gd php7.4-imap php7.4-soap php7.4-xmlrpc php7.4-apcu php7.4-dev php7.4-cli >> $insl 2>&1 + fi + if [ -e $elvf ] + then + if [ -e $fedvf ] + then + dnf install -y -q https://rpms.remirepo.net/fedora/remi-release-39.rpm >> $insl 2>&1 + dnf config-manager --set-enabled remi + else + dnf install -y -q https://rpms.remirepo.net/enterprise/remi-release-9.rpm >> $insl 2>&1 + fi + dnf install -y -q php74 php74-php-apcu php74-php-opcache php74-php-mysql php74-php-bcmath php74-php-common php74-php-geos php74-php-gmp php74-php-pecl-imagick-im7 php74-php-pecl-lzf php74-php-pecl-mcrypt php74-php-pecl-recode php74-php-process php74-php-zstd php74-php-redis php74-php-dom php74-php-curl php74-php-exif php74-php-fileinfo php74-php-mbstring php74-php-xml php74-php-zip php74-php-iconv php74-php-intl php74-php-simplexml php74-php-xmlreader php74-php-ftp php74-php-ssh2 php74-php-sockets php74-php-gd php74-php-imap php74-php-soap php74-php-xmlrpc php74-php-apcu php74-php-cli php74-php-ast php74-php-brotli php74-php-enchant php74-php-ffi php74-php-lz4 php74-php-phalcon5 php74-php-phpiredis php74-php-smbclient php74-php-tidy php74-php-xz >> $insl 2>&1 + dnf install -y -q php74-syspaths php74-mod_php >> $insl 2>&1 + fi elif [ "$nv" = "25" ]; then - echo "Installing PHP version 8.1 for Nextcloud v25." - echo "!!!!!!! Installing PHP version 8.1 for Nextcloud v25" >> $insl 2>&1 - install_php81 + echo "Installing PHP version 8.1 for Nextcloud v25." + echo "!!!!!!! Installing PHP version 8.1 for Nextcloud v25." >> $insl 2>&1 + install_php81 elif [ "$nv" = "26" ]; then - echo "Installing PHP version 8.1 for Nextcloud v26." - echo "!!!!!!! Installing PHP version 8.1 for Nextcloud v26" >> $insl 2>&1 - install_php81 + echo "Installing PHP version 8.1 for Nextcloud v26." + echo "!!!!!!! Installing PHP version 8.1 for Nextcloud v26." >> $insl 2>&1 + install_php81 elif [ "$nv" = "27" ]; then - echo "Installing PHP version 8.2 for Nextcloud v27." - echo "!!!!!!! Installing PHP version 8.2 for Nextcloud v27" >> $insl 2>&1 - install_php82 + echo "Installing PHP version 8.2 for Nextcloud v27." + echo "!!!!!!! Installing PHP version 8.2 for Nextcloud v27." >> $insl 2>&1 + install_php82 elif [ "$nv" = "28" ]; then - echo "Installing PHP version 8.2 for Nextcloud v28." - echo "!!!!!!! Installing PHP version 8.2 for Nextcloud v28" >> $insl 2>&1 - install_php82 + echo "Installing PHP version 8.2 for Nextcloud v28." + echo "!!!!!!! Installing PHP version 8.2 for Nextcloud v28." >> $insl 2>&1 + install_php82 elif [ "$nv" = "29" ]; then - echo "Installing PHP version 8.3 for Nextcloud v29." - echo "!!!!!!! Installing PHP version 8.3 for Nextcloud v29" >> $insl 2>&1 - install_php83 + echo "Installing PHP version 8.3 for Nextcloud v29." + echo "!!!!!!! Installing PHP version 8.3 for Nextcloud v29." >> $insl 2>&1 + install_php83 elif [ "$nv" = "30" ]; then - echo "Installing PHP version 8.3 for Nextcloud v30." - echo "!!!!!!! Installing PHP version 8.3 for Nextcloud v30" >> $insl 2>&1 - install_php83 + echo "Installing PHP version 8.3 for Nextcloud v30." + echo "!!!!!!! Installing PHP version 8.3 for Nextcloud v30." >> $insl 2>&1 + install_php83 elif [ -z "$nv" ]; then - echo "Installing newest PHP version for Nextcloud." - echo "!!!!!!! Installing newest PHP version for Nextcloud" >> $insl 2>&1 - install_php + echo "Installing newest PHP version for Nextcloud." + echo "!!!!!!! Installing newest PHP version for Nextcloud." >> $insl 2>&1 + install_php fi if [ -e $debvf ] then - a2dissite 000-default >> $insl 2>&1 - systemctl enable apache2 >> $insl 2>&1 - restart_websrv + a2dissite 000-default >> $insl 2>&1 + systemctl enable apache2 >> $insl 2>&1 + restart_websrv fi if [ -e $elvf ] then - systemctl enable httpd >> $insl 2>&1 - restart_websrv + systemctl enable httpd >> $insl 2>&1 + restart_websrv fi -echo "Setting up firewall" -echo "!!!!!!! Setting up firewall" >> $insl 2>&1 +echo "Setting up firewall." +echo "!!!!!!! Setting up firewall." >> $insl 2>&1 if [ -e $debvf ] then - ufw default allow >> $insl 2>&1 - ufw --force enable >> $insl 2>&1 - ufw allow OpenSSH >> $insl 2>&1 - ufw allow 'WWW Full' >> $insl 2>&1 - ufw allow 'Apache Full' >> $insl 2>&1 - ufw allow 7867/tcp >> $insl 2>&1 - ufw default deny >> $insl 2>&1 - ufw show added >> $insl 2>&1 + ufw default allow >> $insl 2>&1 + ufw --force enable >> $insl 2>&1 + ufw allow OpenSSH >> $insl 2>&1 + ufw allow 'WWW Full' >> $insl 2>&1 + ufw allow 'Apache Full' >> $insl 2>&1 + ufw allow 7867/tcp >> $insl 2>&1 + ufw default deny >> $insl 2>&1 + ufw show added >> $insl 2>&1 fi if [ -e $elvf ] then - firewall-cmd --permanent --add-service=http >> $insl 2>&1 - firewall-cmd --permanent --add-service=https >> $insl 2>&1 - firewall-cmd --permanent --add-service=ssh >> $insl 2>&1 - firewall-cmd --permanent --add-port=7867/tcp >> $insl 2>&1 - firewall-cmd --reload >> $insl 2>&1 + firewall-cmd --permanent --add-service=http >> $insl 2>&1 + firewall-cmd --permanent --add-service=https >> $insl 2>&1 + firewall-cmd --permanent --add-service=ssh >> $insl 2>&1 + firewall-cmd --permanent --add-port=7867/tcp >> $insl 2>&1 + firewall-cmd --reload >> $insl 2>&1 fi echo "Simple PHP testing..." @@ -2188,10 +2269,10 @@ rm -rf info.php >> $insl 2>&1 # Tweaks for redis first. if [ -e $debvf ] then - sysctl vm.overcommit_memory=1 >> $insl 2>&1 - echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf - touch /etc/rc.local - echo "#!/bin/sh -e + sysctl vm.overcommit_memory=1 >> $insl 2>&1 + echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf + touch /etc/rc.local + echo "#!/bin/sh -e # # rc.local # @@ -2207,63 +2288,63 @@ then echo madvise > /sys/kernel/mm/transparent_hugepage/enabled exit 0 " >> /etc/rc.local - chmod +x /etc/rc.local - systemctl daemon-reload - systemctl start rc-local - # REDIS cache configure, adding socket for faster communication on local host. - apt-get install -y -o DPkg::Lock::Timeout=-1 redis-server >> $insl 2>&1 - sed -i '/# unixsocketperm 700/aunixsocketperm 777' /etc/redis/redis.conf - sed -i '/# unixsocketperm 700/aunixsocket /var/run/redis/redis.sock' /etc/redis/redis.conf - usermod -a -G redis $websrv_usr - systemctl restart redis >> $insl 2>&1 + chmod +x /etc/rc.local + systemctl daemon-reload + systemctl start rc-local + # REDIS cache configure, adding socket for faster communication on local host. + apt-get install -y -o DPkg::Lock::Timeout=-1 redis-server >> $insl 2>&1 + sed -i '/# unixsocketperm 700/aunixsocketperm 777' /etc/redis/redis.conf + sed -i '/# unixsocketperm 700/aunixsocket /var/run/redis/redis.sock' /etc/redis/redis.conf + usermod -a -G redis $websrv_usr + systemctl restart redis >> $insl 2>&1 fi if [ -e $elvf ] then - sysctl vm.overcommit_memory=1 >> $insl 2>&1 - echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf - echo madvise > /sys/kernel/mm/transparent_hugepage/enabled - setsebool -P daemons_enable_cluster_mode 1 - dnf install -y -q redis >> $insl 2>&1 - mkdir /var/run/redis - chown redis:redis /var/run/redis - chmod 777 /var/run/redis - sed -i '/# unixsocketperm 700/aunixsocketperm 777' /etc/redis/redis.conf - sed -i '/# unixsocketperm 700/aunixsocket /var/run/redis/redis.sock' /etc/redis/redis.conf - sed -i '/# supervised auto/asupervised systemd' /etc/redis/redis.conf - # Setting up Redis SELinux permissions. - setsebool -P redis_enable_notify 1 >> $insl 2>&1 - setsebool -P daemons_dontaudit_scheduling 1 >> $insl 2>&1 - setsebool -P fips_mode 1 >> $insl 2>&1 - setsebool -P nscd_use_shm 1 >> $insl 2>&1 - - systemctl start redis.service >> $insl 2>&1 - echo "!!!!!!! Retrying start Redis service, for unknown reason secondary start is working under Rocky Linux 9." >> $insl 2>&1 - systemctl start redis.service >> $insl 2>&1 - systemctl start redis.service >> $insl 2>&1 - systemctl enable redis >> $insl 2>&1 -fi - -echo "!!!!!!! Configuring PHP options" >> $insl 2>&1 + sysctl vm.overcommit_memory=1 >> $insl 2>&1 + echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf + echo madvise > /sys/kernel/mm/transparent_hugepage/enabled + setsebool -P daemons_enable_cluster_mode 1 + dnf install -y -q redis >> $insl 2>&1 + mkdir /var/run/redis + chown redis:redis /var/run/redis + chmod 777 /var/run/redis + sed -i '/# unixsocketperm 700/aunixsocketperm 777' /etc/redis/redis.conf + sed -i '/# unixsocketperm 700/aunixsocket /var/run/redis/redis.sock' /etc/redis/redis.conf + sed -i '/# supervised auto/asupervised systemd' /etc/redis/redis.conf + # Setting up Redis SELinux permissions. + setsebool -P redis_enable_notify 1 >> $insl 2>&1 + setsebool -P daemons_dontaudit_scheduling 1 >> $insl 2>&1 + setsebool -P fips_mode 1 >> $insl 2>&1 + setsebool -P nscd_use_shm 1 >> $insl 2>&1 + + systemctl start redis.service >> $insl 2>&1 + echo "!!!!!!! Retrying start Redis service, for unknown reason secondary start is working under Rocky Linux 9." >> $insl 2>&1 + systemctl start redis.service >> $insl 2>&1 + systemctl start redis.service >> $insl 2>&1 + systemctl enable redis >> $insl 2>&1 +fi + +echo "!!!!!!! Configuring PHP options." >> $insl 2>&1 if [ "$nv" = "24" ]; then - php74_tweaks + php74_tweaks elif [ "$nv" = "25" ]; then - php81_tweaks + php81_tweaks elif [ "$nv" = "26" ]; then - php81_tweaks + php81_tweaks elif [ "$nv" = "27" ]; then - php82_tweaks + php82_tweaks elif [ "$nv" = "28" ]; then - php82_tweaks + php82_tweaks elif [ "$nv" = "29" ]; then - php83_tweaks + php83_tweaks elif [ "$nv" = "30" ]; then - php83_tweaks + php83_tweaks elif [ -z "$nv" ]; then - php_tweaks + php_tweaks fi -echo "!!!!!!! Creating certificates for localhost and vhost" >> $insl 2>&1 +echo "!!!!!!! Creating certificates for localhost and vhost." >> $insl 2>&1 echo "Generating keys & certificates for web access." -# Creating certificate for localhost +# Creating certificate for localhost. touch /opt/open_ssl.conf echo '[req] distinguished_name = req_distinguished_name @@ -2288,20 +2369,20 @@ openssl req -x509 -nodes -days 4096 -newkey rsa:2048 -keyout /opt/nextcloud.key mv /opt/nextcloud.crt /etc/ssl/certs/nextcloud.crt >> $insl 2>&1 if [ -e $elvf ] then - mkdir /etc/ssl/private + mkdir /etc/ssl/private fi mv /opt/nextcloud.key /etc/ssl/private/nextcloud.key >> $insl 2>&1 # Creating VHost for Apache. if [ -e $debvf ] then - echo ' + echo ' ServerAdmin webmaster@localhost # ServerName localhost DocumentRoot /var/www/nextcloud Protocols h2 h2c http/1.1 ProtocolsHonorOrder Off H2WindowSize 5242880 - + Require all granted AllowOverride All @@ -2311,13 +2392,13 @@ then Dav off - + LimitRequestBody 0 - + # ProxyPass /push/ws ws://127.0.0.1:7867/ws # ProxyPass /push/ http://127.0.0.1:7867/ # ProxyPassReverse /push/ http://127.0.0.1:7867/ - + ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined @@ -2328,7 +2409,7 @@ then Protocols h2 h2c http/1.1 ProtocolsHonorOrder Off H2WindowSize 5242880 - + Require all granted AllowOverride All @@ -2338,13 +2419,13 @@ then Dav off - + LimitRequestBody 0 - + # ProxyPass /push/ws ws://127.0.0.1:7867/ws # ProxyPass /push/ http://127.0.0.1:7867/ # ProxyPassReverse /push/ http://127.0.0.1:7867/ - + ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on @@ -2353,29 +2434,29 @@ then ' > /etc/apache2/sites-available/nextcloud.conf -a2enmod ssl >> $insl 2>&1 -a2enmod rewrite >> $insl 2>&1 -a2enmod headers >> $insl 2>&1 -a2enmod env >> $insl 2>&1 -a2enmod dir >> $insl 2>&1 -a2enmod mime >> $insl 2>&1 -a2enmod proxy >> $insl 2>&1 -a2enmod http2 >> $insl 2>&1 -# a2enmod proxy_http >> $insl 2>&1 -# a2enmod proxy_wstunnel >> $insl 2>&1 -a2ensite nextcloud.conf >> $insl 2>&1 + a2enmod ssl >> $insl 2>&1 + a2enmod rewrite >> $insl 2>&1 + a2enmod headers >> $insl 2>&1 + a2enmod env >> $insl 2>&1 + a2enmod dir >> $insl 2>&1 + a2enmod mime >> $insl 2>&1 + a2enmod proxy >> $insl 2>&1 + a2enmod http2 >> $insl 2>&1 + # a2enmod proxy_http >> $insl 2>&1 + # a2enmod proxy_wstunnel >> $insl 2>&1 + a2ensite nextcloud.conf >> $insl 2>&1 fi if [ -e $elvf ] then - echo ' + echo ' ServerAdmin webmaster@localhost # ServerName localhost DocumentRoot /var/www/nextcloud Protocols h2 h2c http/1.1 ProtocolsHonorOrder Off H2WindowSize 5242880 - + Require all granted AllowOverride All @@ -2385,9 +2466,9 @@ then Dav off - + LimitRequestBody 0 - + # ProxyPass /push/ws ws://127.0.0.1:7867/ws # ProxyPass /push/ http://127.0.0.1:7867/ # ProxyPassReverse /push/ http://127.0.0.1:7867/ @@ -2399,7 +2480,7 @@ then Protocols h2 h2c http/1.1 ProtocolsHonorOrder Off H2WindowSize 5242880 - + Require all granted AllowOverride All @@ -2409,37 +2490,37 @@ then Dav off - + LimitRequestBody 0 - + # ProxyPass /push/ws ws://127.0.0.1:7867/ws # ProxyPass /push/ http://127.0.0.1:7867/ # ProxyPassReverse /push/ http://127.0.0.1:7867/ - + SSLEngine on SSLCertificateFile /etc/ssl/certs/nextcloud.crt SSLCertificateKeyFile /etc/ssl/private/nextcloud.key ' > /etc/httpd/conf.d/nextcloud.conf -sed -i.bak 's/^DocumentRoot "\/var\/www\/html"/DocumentRoot "\/var\/www\/nextcloud"/g' /etc/httpd/conf/httpd.conf + sed -i.bak 's/^DocumentRoot "\/var\/www\/html"/DocumentRoot "\/var\/www\/nextcloud"/g' /etc/httpd/conf/httpd.conf fi echo "Installing MariaDB database server." echo "!!!!!!! Installing MariaDB database server" >> $insl 2>&1 if [ -e $debvf ] then - apt-get install -y -o DPkg::Lock::Timeout=-1 mariadb-server >> $insl 2>&1 + apt-get install -y -o DPkg::Lock::Timeout=-1 mariadb-server >> $insl 2>&1 fi if [ -e $elvf ] then - dnf install -y -q mariadb-server mariadb >> $insl 2>&1 + dnf install -y -q mariadb-server mariadb >> $insl 2>&1 fi # Adding MariaDB options. if [ -e $debvf ] then - touch /etc/mysql/mariadb.conf.d/70-nextcloud.cnf - echo '[server] + touch /etc/mysql/mariadb.conf.d/70-nextcloud.cnf + echo '[server] skip-name-resolve innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 32M @@ -2462,8 +2543,8 @@ fi if [ -e $elvf ] then - touch /etc/my.cnf.d/nextcloud.cnf - echo '[server] + touch /etc/my.cnf.d/nextcloud.cnf + echo '[server] skip-name-resolve innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 32M @@ -2512,11 +2593,11 @@ mysql -e "FLUSH PRIVILEGES" >> $insl 2>&1 echo "!!!!!!! Installing certbot." >> $insl 2>&1 if [ -e $debvf ] then - apt-get install -y -o DPkg::Lock::Timeout=-1 python3-certbot-apache >> $insl 2>&1 + apt-get install -y -o DPkg::Lock::Timeout=-1 python3-certbot-apache >> $insl 2>&1 fi if [ -e $elvf ] then - dnf install -y -q python3-certbot-apache >> $insl 2>&1 + dnf install -y -q python3-certbot-apache >> $insl 2>&1 fi # Downloading and installing Nextcloud. @@ -2524,77 +2605,77 @@ echo "!!!!!!! Downloading and installing Nextcloud" >> $insl 2>&1 mkdir /var/www/nextcloud mkdir /var/www/nextcloud/data -# Configuring/mounting data directory to specified location +# Configuring/mounting data directory to specified location. echo "!!!!!!! Configuring/mounting data directory to specified location" >> $insl 2>&1 if [ -z "$fdir" ] then - echo "User files directory not configured." >> $insl 2>&1 + echo "User files directory not configured." >> $insl 2>&1 else - cp /etc/fstab /etc/fstab-nc.bak >> $insl 2>&1 - fs_fdir="${fdir// /\\040}" - echo "$fs_fdir /var/www/nextcloud/data none bind 0 0" >> /etc/fstab - mount --bind "$fdir" /var/www/nextcloud/data >> $insl 2>&1 + cp /etc/fstab /etc/fstab-nc.bak >> $insl 2>&1 + fs_fdir="${fdir// /\\040}" + echo "$fs_fdir /var/www/nextcloud/data none bind 0 0" >> /etc/fstab + mount --bind "$fdir" /var/www/nextcloud/data >> $insl 2>&1 fi if [ -e latest.zip ] then - mv latest.zip $(date +"%FT%H%M")-latest.zip >> $insl 2>&1 + mv latest.zip $(date +"%FT%H%M")-latest.zip >> $insl 2>&1 fi if [ "$nv" = "24" ]; then - echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 - wget -q https://download.nextcloud.com/server/releases/nextcloud-24.0.12.zip >> $insl 2>&1 - mv nextcloud-24.0.12.zip latest.zip >> $insl 2>&1 + echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 + wget -q https://download.nextcloud.com/server/releases/nextcloud-24.0.12.zip >> $insl 2>&1 + mv nextcloud-24.0.12.zip latest.zip >> $insl 2>&1 elif [ "$nv" = "25" ]; then - echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 - wget -q https://download.nextcloud.com/server/releases/nextcloud-25.0.13.zip >> $insl 2>&1 - mv nextcloud-25.0.13.zip latest.zip >> $insl 2>&1 + echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 + wget -q https://download.nextcloud.com/server/releases/nextcloud-25.0.13.zip >> $insl 2>&1 + mv nextcloud-25.0.13.zip latest.zip >> $insl 2>&1 elif [ "$nv" = "26" ]; then - echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 - wget -q https://download.nextcloud.com/server/releases/nextcloud-26.0.13.zip >> $insl 2>&1 - mv nextcloud-26.0.13.zip latest.zip >> $insl 2>&1 + echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 + wget -q https://download.nextcloud.com/server/releases/nextcloud-26.0.13.zip >> $insl 2>&1 + mv nextcloud-26.0.13.zip latest.zip >> $insl 2>&1 elif [ "$nv" = "27" ]; then - echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 - wget -q https://download.nextcloud.com/server/releases/nextcloud-27.1.11.zip >> $insl 2>&1 - mv nextcloud-27.1.11.zip latest.zip >> $insl 2>&1 + echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 + wget -q https://download.nextcloud.com/server/releases/nextcloud-27.1.11.zip >> $insl 2>&1 + mv nextcloud-27.1.11.zip latest.zip >> $insl 2>&1 elif [ "$nv" = "28" ]; then - echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 - wget -q https://download.nextcloud.com/server/releases/nextcloud-28.0.14.zip >> $insl 2>&1 - mv nextcloud-28.0.14.zip latest.zip >> $insl 2>&1 + echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 + wget -q https://download.nextcloud.com/server/releases/nextcloud-28.0.14.zip >> $insl 2>&1 + mv nextcloud-28.0.14.zip latest.zip >> $insl 2>&1 elif [ "$nv" = "29" ]; then - echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 - wget -q https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip >> $insl 2>&1 - mv nextcloud-29.0.16.zip latest.zip >> $insl 2>&1 + echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 + wget -q https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip >> $insl 2>&1 + mv nextcloud-29.0.16.zip latest.zip >> $insl 2>&1 elif [ "$nv" = "30" ]; then - echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 - wget -q https://download.nextcloud.com/server/releases/nextcloud-30.0.11.zip >> $insl 2>&1 - mv nextcloud-30.0.11.zip latest.zip >> $insl 2>&1 + echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 + wget -q https://download.nextcloud.com/server/releases/nextcloud-30.0.11.zip >> $insl 2>&1 + mv nextcloud-30.0.11.zip latest.zip >> $insl 2>&1 elif [ "$nv" = "31" ]; then - echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 - wget -q https://download.nextcloud.com/server/releases/nextcloud-31.0.5.zip >> $insl 2>&1 - mv nextcloud-31.0.5.zip latest.zip >> $insl 2>&1 + echo "Downloading and unpacking Nextcloud v$nv." >> $insl 2>&1 + wget -q https://download.nextcloud.com/server/releases/nextcloud-31.0.5.zip >> $insl 2>&1 + mv nextcloud-31.0.5.zip latest.zip >> $insl 2>&1 fi if [ -e latest.zip ] then - unzip -q latest.zip -d /var/www >> $insl 2>&1 + unzip -q latest.zip -d /var/www >> $insl 2>&1 else - wget -q https://download.nextcloud.com/server/releases/latest.zip >> $insl 2>&1 - unzip -q latest.zip -d /var/www >> $insl 2>&1 + wget -q https://download.nextcloud.com/server/releases/latest.zip >> $insl 2>&1 + unzip -q latest.zip -d /var/www >> $insl 2>&1 fi chown -R $websrv_usr:$websrv_usr /var/www/ -# Preparing SELinux permissions +# Preparing SELinux permissions. if [ -e $elvf ] then - echo "!!!!!!! Apply Nextcloud SELinux permissions." >> $insl 2>&1 - semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/data(/.*)?' >> $insl 2>&1 - semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/config(/.*)?' >> $insl 2>&1 - semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/apps(/.*)?' >> $insl 2>&1 - semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/.htaccess' >> $insl 2>&1 - semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/.user.ini' >> $insl 2>&1 - semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?' >> $insl 2>&1 - restorecon -Rv '/var/www/nextcloud/' >> $insl 2>&1 + echo "!!!!!!! Apply Nextcloud SELinux permissions." >> $insl 2>&1 + semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/data(/.*)?' >> $insl 2>&1 + semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/config(/.*)?' >> $insl 2>&1 + semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/apps(/.*)?' >> $insl 2>&1 + semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/.htaccess' >> $insl 2>&1 + semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/.user.ini' >> $insl 2>&1 + semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?' >> $insl 2>&1 + restorecon -Rv '/var/www/nextcloud/' >> $insl 2>&1 fi # Making Nextcloud preconfiguration. @@ -2620,49 +2701,50 @@ sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:install --database \ if [ "$lang" = "ar" ] then - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="ar" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="ar" >> $insl 2>&1 fi if [ "$lang" = "zh" ] then - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="zh" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="zh" >> $insl 2>&1 fi if [ "$lang" = "fr" ] then - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="fr" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="fr" >> $insl 2>&1 fi if [ "$lang" = "hi" ] then - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="hi" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="hi" >> $insl 2>&1 fi if [ "$lang" = "pl" ] then - # Adding default language and locales - # 'default_language' => 'pl', - # 'default_locale' => 'pl', - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="pl" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_locale --value="pl_PL" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_phone_region --value="PL" >> $insl 2>&1 + # Adding default language and locales + # 'default_language' => 'pl', + # 'default_locale' => 'pl', + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="pl" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_locale --value="pl_PL" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_phone_region --value="PL" >> $insl 2>&1 fi if [ "$lang" = "es" ] then - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="es" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="es" >> $insl 2>&1 fi if [ "$lang" = "uk" ] then - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="uk" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set default_language --value="uk" >> $insl 2>&1 fi # Enabling APCu and Redis in config file - default cache engine now. sed -i "/installed' => true,/a\ \ 'memcache.local' => '\\\OC\\\Memcache\\\APCu',\n\ \ 'filelocking.enabled' => true,\n \ 'memcache.locking' => '\\\OC\\\Memcache\\\Redis',\n \ 'memcache.distributed' => '\\\OC\\\Memcache\\\Redis',\n \ 'redis' =>\n \ array (\n \ \ 'host' => '/var/run/redis/redis.sock',\n \ \ 'port' => 0,\n \ \ 'dbindex' => 0,\n \ \ 'timeout' => 600.0,\n \ )," /var/www/nextcloud/config/config.php echo "Tweaking Nextcloud configuration, adding IP's, installing NC apps etc." -# Disabling info about creating free account on shared pages/links when logged out (because it is missleading for private nextcloud instances). +# Disabling info about creating free account on shared pages/links when logged +# out (because it is missleading for private nextcloud instances). sed -i "/installed' => true,/a\ \ 'simpleSignUpLink.shown' => false," /var/www/nextcloud/config/config.php # Setting up maintenance window start time to 1 am (UTC). @@ -2705,8 +2787,10 @@ sudo -u $websrv_usr php /var/www/nextcloud/occ app:install camerarawpreviews >> sudo -u $websrv_usr php /var/www/nextcloud/occ app:enable camerarawpreviews >> $insl 2>&1 sudo -u $websrv_usr php /var/www/nextcloud/occ config:app:set files max_chunk_size --value="20971520" >> $insl 2>&1 -# Import certificate by Nextcloud so it will not cry that it'cant check for mjs support by JavaScript MIME type on server. -# Actually it do not resolve problem with information, so i think it is just another inside error ignored by NC. +# Import certificate by Nextcloud so it will not cry that it can't check for +# mjs support by JavaScript MIME type on server. Actually it does not resolve +# the problem with information, so i think it is just another inside error +# ignored by NC. sudo -u $websrv_usr php /var/www/nextcloud/occ security:certificates:import /etc/ssl/certs/nextcloud.crt >> $insl 2>&1 # Below lines will give more data if something goes wrong! @@ -2714,17 +2798,18 @@ curl -I http://127.0.0.1/ >> $insl 2>&1 echo "!!!!!!!!!!! Copying nextcloud.log file after empty call for future diagnose." >> $insl 2>&1 cat /var/www/nextcloud/data/nextcloud.log >> $insl 2>&1 -# Disable .htaccess blocking because we use nginx that do not use it, also it should be handled by Nextcloud itself! +# Disable .htaccess blocking because we use nginx that do not use it, also it +# should be handled by Nextcloud itself! # sed -i "/CONFIG = array (/a\ \ 'blacklisted_files' => array()," /var/www/nextcloud/config/config.php if [ -e $debvf ] then - systemctl stop apache2 >> $insl 2>&1 + systemctl stop apache2 >> $insl 2>&1 fi if [ -e $elvf ] then - systemctl stop httpd >> $insl 2>&1 + systemctl stop httpd >> $insl 2>&1 fi # Another lines that helped me in the past are here to stay... @@ -2761,7 +2846,8 @@ echo 'WantedBy=timers.target' >> /etc/systemd/system/nextcloudcron.timer systemctl start nextcloudcron.timer >> $insl 2>&1 systemctl enable nextcloudcron.timer >> $insl 2>&1 restart_websrv -# Additional things that may fix some unknown Nextcloud problems (that appeared for me when started using v19). +# Additional things that may fix some unknown Nextcloud problems (that appeared +# for me when started using v19). chown -R $websrv_usr:$websrv_usr /var/www/nextcloud chmod 775 /var/www/nextcloud @@ -2771,7 +2857,7 @@ sudo -u $websrv_usr php /var/www/nextcloud/occ files:scan --all >> $insl 2>&1 sudo -u $websrv_usr php /var/www/nextcloud/occ files:cleanup; >> $insl 2>&1 # sudo -u $websrv_usr php /var/www/nextcloud/occ preview:generate-all -vvv -# hide index.php from urls. +# Hide index.php from urls. sed -i "/installed' => true,/a\ \ 'htaccess.RewriteBase' => '/'," /var/www/nextcloud/config/config.php sudo -u $websrv_usr php /var/www/nextcloud/occ maintenance:update:htaccess >> $insl 2>&1 @@ -2783,62 +2869,61 @@ upnpc -e "Web Server HTTPS" -a $addr1 443 443 TCP >> $insl 2>&1 if [ -z "$dm" ] then - echo "Skipping additional domain configuration." + echo "Skipping additional domain configuration." else - echo "Configuring additional domain name." - echo "!!!!!!! Configuring additional domain name" >> $insl 2>&1 - sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set trusted_domains 96 --value="$dm" >> $insl 2>&1 - if [ -e $debvf ] - then - sed -i '/ServerName localhost/aServerName '"$dm"'' /etc/apache2/sites-available/nextcloud.conf >> $insl 2>&1 - fi - if [ -e $elvf ] - then - sed -i '/ServerName localhost/aServerName '"$dm"'' /etc/httpd/conf.d/nextcloud.conf >> $insl 2>&1 - fi - echo "Configuring Let's encrypt." - if [ -z "$mail" ] - then - echo "Skipping adding email configuration for Let's encrypt." - if [ -e $debvf ] - then - certbot --register-unsafely-without-email --apache --agree-tos -d $dm >> $insl 2>&1 - (crontab -l 2>/dev/null; echo "0 4 1,15 * * /usr/bin/certbot renew") | crontab - - fi - if [ -e $elvf ] - then - certbot-3 --non-interactive --register-unsafely-without-email --apache --agree-tos -d $dm >> $insl 2>&1 - (crontab -l 2>/dev/null; echo "0 4 1,15 * * /usr/bin/certbot-3 renew") | crontab - - fi - else - if [ -e $debvf ] - then - certbot --email $mail --apache --agree-tos -d $dm >> $insl 2>&1 - (crontab -l 2>/dev/null; echo "0 4 1,15 * * /usr/bin/certbot renew") | crontab - - fi - if [ -e $debvf ] - then - certbot-3 --non-interactive --email $mail --apache --agree-tos -d $dm >> $insl 2>&1 - (crontab -l 2>/dev/null; echo "0 4 1,15 * * /usr/bin/certbot-3 renew") | crontab - - fi - - fi + echo "Configuring additional domain name." + echo "!!!!!!! Configuring additional domain name" >> $insl 2>&1 + sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set trusted_domains 96 --value="$dm" >> $insl 2>&1 + if [ -e $debvf ] + then + sed -i '/ServerName localhost/aServerName '"$dm"'' /etc/apache2/sites-available/nextcloud.conf >> $insl 2>&1 + fi + if [ -e $elvf ] + then + sed -i '/ServerName localhost/aServerName '"$dm"'' /etc/httpd/conf.d/nextcloud.conf >> $insl 2>&1 + fi + echo "Configuring Let's encrypt." + if [ -z "$mail" ] + then + echo "Skipping adding email configuration for Let's encrypt." + if [ -e $debvf ] + then + certbot --register-unsafely-without-email --apache --agree-tos -d $dm >> $insl 2>&1 + (crontab -l 2>/dev/null; echo "0 4 1,15 * * /usr/bin/certbot renew") | crontab - + fi + if [ -e $elvf ] + then + certbot-3 --non-interactive --register-unsafely-without-email --apache --agree-tos -d $dm >> $insl 2>&1 + (crontab -l 2>/dev/null; echo "0 4 1,15 * * /usr/bin/certbot-3 renew") | crontab - + fi + else + if [ -e $debvf ] + then + certbot --email $mail --apache --agree-tos -d $dm >> $insl 2>&1 + (crontab -l 2>/dev/null; echo "0 4 1,15 * * /usr/bin/certbot renew") | crontab - + fi + if [ -e $debvf ] + then + certbot-3 --non-interactive --email $mail --apache --agree-tos -d $dm >> $insl 2>&1 + (crontab -l 2>/dev/null; echo "0 4 1,15 * * /usr/bin/certbot-3 renew") | crontab - + fi + fi fi if [ -z "$mail" ] - then - echo "Skipping adding email address as webmaster inside apache configuration." - else - echo "Adding email address as webmaster inside apache configuration." - echo "Adding email address as webmaster inside apache configuration." >> $insl 2>&1 - if [ -e $debvf ] - then - sed -i 's/\bwebmaster@localhost\b/'"$mail"'/g' /etc/apache2/sites-available/nextcloud.conf - fi - if [ -e $elvf ] - then - sed -i 's/\bwebmaster@localhost\b/'"$mail"'/g' /etc/httpd/conf.d/nextcloud.conf - fi + then + echo "Skipping adding email address as webmaster inside apache configuration." + else + echo "Adding email address as webmaster inside apache configuration." + echo "Adding email address as webmaster inside apache configuration." >> $insl 2>&1 + if [ -e $debvf ] + then + sed -i 's/\bwebmaster@localhost\b/'"$mail"'/g' /etc/apache2/sites-available/nextcloud.conf + fi + if [ -e $elvf ] + then + sed -i 's/\bwebmaster@localhost\b/'"$mail"'/g' /etc/httpd/conf.d/nextcloud.conf + fi fi # collab_inst @@ -2851,12 +2936,12 @@ fi # echo '[Unit] # Description = Nextcloud High Performance Backend Push Service # After=redis.service mariadb.service -# +# # [Service] # Environment = PORT=7867 # ExecStart = /var/www/nextcloud/apps/notify_push/bin/x86_64/notify_push /var/www/nextcloud/config/config.php # User=$websrv_usr -# +# # [Install] # WantedBy = multi-user.target # ' >> /etc/systemd/system/nextcloud_hpb.service @@ -2868,9 +2953,9 @@ fi # sudo -u $websrv_usr php /var/www/nextcloud/occ config:system:set trusted_proxies 98 --value="$addr" >> $insl 2>&1 #if [ $# -eq 0 ] #then -# sudo -u $websrv_usr php /var/www/nextcloud/occ notify_push:setup https://$addr/push >> $insl 2>&1 +# sudo -u $websrv_usr php /var/www/nextcloud/occ notify_push:setup https://$addr/push >> $insl 2>&1 #else -# sudo -u $websrv_usr php /var/www/nextcloud/occ notify_push:setup https://$1/push >> $insl 2>&1 +# sudo -u $websrv_usr php /var/www/nextcloud/occ notify_push:setup https://$1/push >> $insl 2>&1 #fi # Finished!!! @@ -2880,14 +2965,14 @@ echo "Use # certbot if You want SSL certificate for domain name." echo "" if [ -z "$dm" ] then - echo "You may access Your Nextcloud instalation using this address: - http://$addr or - https://$addr" + echo "You may access Your Nextcloud instalation using this address: + http://$addr or + https://$addr" else - echo "You may access Your Nextcloud instalation using this address: - http://$addr or - https://$addr or - https://$dm" + echo "You may access Your Nextcloud instalation using this address: + http://$addr or + https://$addr or + https://$dm" fi echo "Try to use httpS - there are known Nextcloud problems with Firefox without SSL." @@ -2924,7 +3009,7 @@ rm -rf $cdir/dbpass rm -rf /var/www/nextcloud/config/autoconfig.php if [ -e $debvf ] then - apt-get autoremove -y >> $insl 2>&1 + apt-get autoremove -y >> $insl 2>&1 fi restart_websrv touch $ver_file