|
|
@ -5,7 +5,7 @@ |
|
|
|
# File Created: Monday, 6th July 2020 11:05:48 am |
|
|
|
# File Created: Monday, 6th July 2020 11:05:48 am |
|
|
|
# Author: Thomas Brinkmann (doyl@dsh.icu) |
|
|
|
# Author: Thomas Brinkmann (doyl@dsh.icu) |
|
|
|
# ----- |
|
|
|
# ----- |
|
|
|
# Last Modified: Monday, 6th July 2020 1:25:29 pm |
|
|
|
# Last Modified: Monday, 6th July 2020 8:19:25 pm |
|
|
|
# Modified By: Thomas Brinkmann (doyl@dsh.icu>) |
|
|
|
# Modified By: Thomas Brinkmann (doyl@dsh.icu>) |
|
|
|
# ----- |
|
|
|
# ----- |
|
|
|
# Copyright 2020 - Thomas Brinkmann. All Rights Reserved. |
|
|
|
# Copyright 2020 - Thomas Brinkmann. All Rights Reserved. |
|
|
@ -19,8 +19,12 @@ |
|
|
|
# ----- |
|
|
|
# ----- |
|
|
|
# ############################################################################### |
|
|
|
# ############################################################################### |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cd "/home" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LATEST_STABLE_RELEASE=19.0.0 #Nextcloud Version |
|
|
|
|
|
|
|
DBPASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) |
|
|
|
|
|
|
|
DBUSER=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1) |
|
|
|
|
|
|
|
ADMINPASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) |
|
|
|
VAR_A=`uname -m` |
|
|
|
VAR_A=`uname -m` |
|
|
|
|
|
|
|
|
|
|
|
show_spinner() |
|
|
|
show_spinner() |
|
|
@ -31,11 +35,120 @@ show_spinner() |
|
|
|
while kill -0 $1 2>/dev/null |
|
|
|
while kill -0 $1 2>/dev/null |
|
|
|
do |
|
|
|
do |
|
|
|
i=$(( (i+1) %4 )) |
|
|
|
i=$(( (i+1) %4 )) |
|
|
|
printf "\r[ \e[36m${spin:$i:1} \e[93m] \e[93mWaiting for another process to finish..." |
|
|
|
printf "\r\e[93m[ \e[36m${spin:$i:1} \e[93m] \e[93mPlease wait...\e[39m" |
|
|
|
sleep .1 |
|
|
|
sleep .1 |
|
|
|
done |
|
|
|
done |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
randpw(){ < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#https://download.nextcloud.com/server/releases/nextcloud- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
download_latestnextcloud(){ |
|
|
|
|
|
|
|
echo -e "\n\e[92mDownloading latest nextcloud version..\e[39m" |
|
|
|
|
|
|
|
wget -q -N -P /home https://download.nextcloud.com/server/releases/nextcloud-$LATEST_STABLE_RELEASE.zip >/dev/null & |
|
|
|
|
|
|
|
show_spinner $! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
install_Debian9(){ |
|
|
|
|
|
|
|
echo -e "\n\e[92mInstalling requirements...\e[39m" |
|
|
|
|
|
|
|
apt-get install -y sudo zip unzip curl wget gnupg2 ca-certificates lsb-release apt-transport-https >/dev/null & |
|
|
|
|
|
|
|
show_spinner $! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo -e "\n\e[92mInstalling public key & source list...\e[39m" |
|
|
|
|
|
|
|
wget -q -N https://packages.sury.org/php/apt.gpg |
|
|
|
|
|
|
|
apt-key add apt.gpg |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php7.list |
|
|
|
|
|
|
|
apt-get update >/dev/null & |
|
|
|
|
|
|
|
show_spinner $! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo -e "\n\e[92mInstalling PHP...\e[39m" |
|
|
|
|
|
|
|
apt-get install -y php7.3 php7.3-cli php7.3-common >/dev/null & |
|
|
|
|
|
|
|
show_spinner $! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo -e "\n\e[92mInstalling Apache2 and MariaDB-Server..\e[39m" |
|
|
|
|
|
|
|
apt-get install -y apache2 mariadb-server libapache2-mod-php7.4 >/dev/null & |
|
|
|
|
|
|
|
show_spinner $! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo -e "\n\e[92mInstallation PHP extentions...\e[39m" |
|
|
|
|
|
|
|
apt-get install -y php7.3-fileinfo php7.3-bz2 php7.3-intl php7.3-ldap php7.3-smbclient php7.3-imap php7.3-bcmath php7.3-gmp php7.3-mysql php7.3-dom php7.3-simplexml php7.3-ssh2 php7.3-xml php7.3-xmlreader php7.3-curl php7.3-xmlwriter php7.3-zip php7.3-exif php7.3-ftp php7.3-gd php7.3-iconv php7.3-imagick php7.3-json php7.3-mbstring php7.3-posix php7.3-sockets php7.3-tokenizer >/dev/null & |
|
|
|
|
|
|
|
show_spinner $! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo -e "\n\e[92mWriting apache vhost config.." |
|
|
|
|
|
|
|
echo "Alias /nextcloud \"/var/www/nextcloud/\" |
|
|
|
|
|
|
|
<Directory /var/www/nextcloud/> |
|
|
|
|
|
|
|
Require all granted |
|
|
|
|
|
|
|
AllowOverride All |
|
|
|
|
|
|
|
Options FollowSymLinks MultiViews |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<IfModule mod_dav.c> |
|
|
|
|
|
|
|
Dav off |
|
|
|
|
|
|
|
</IfModule> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Directory>" >> /etc/apache2/sites-available/nextcloud.conf |
|
|
|
|
|
|
|
a2ensite nextcloud.conf |
|
|
|
|
|
|
|
a2enmod rewrite |
|
|
|
|
|
|
|
a2enmod headers |
|
|
|
|
|
|
|
a2enmod env |
|
|
|
|
|
|
|
a2enmod dir |
|
|
|
|
|
|
|
a2enmod mime |
|
|
|
|
|
|
|
service apache2 restart |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo -e "\n\e[92mConfiguring MariaDB...\e[39m" |
|
|
|
|
|
|
|
echo "CREATE USER '$DBUSER'@'localhost' IDENTIFIED BY '$DBPASS'; |
|
|
|
|
|
|
|
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; |
|
|
|
|
|
|
|
GRANT ALL PRIVILEGES ON nextcloud.* TO '$DBUSER'@'localhost'; |
|
|
|
|
|
|
|
FLUSH PRIVILEGES;" > /home/nextcloudheadless.sql |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mysql -u root < /home/nextcloudheadless.sql |
|
|
|
|
|
|
|
rm /home/nextcloudheadless.sql |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
download_latestnextcloud |
|
|
|
|
|
|
|
echo -e "\n\e[92mExtracting Nextcloud...\e[39m" |
|
|
|
|
|
|
|
cd "/home/" |
|
|
|
|
|
|
|
unzip -o nextcloud-$LATEST_STABLE_RELEASE.zip >/dev/null & |
|
|
|
|
|
|
|
show_spinner $! |
|
|
|
|
|
|
|
echo -e "\n\e[92mMoving nextcloud to the document root..\e[39m" |
|
|
|
|
|
|
|
cp -r nextcloud /var/www >/dev/null & |
|
|
|
|
|
|
|
show_spinner $! |
|
|
|
|
|
|
|
chown -R www-data:www-data /var/www/nextcloud |
|
|
|
|
|
|
|
cd /var/www/nextcloud/ |
|
|
|
|
|
|
|
echo -e "\n\e[92mConfigure Nextcloud..\e[39m" |
|
|
|
|
|
|
|
sudo -u www-data php7.3 occ maintenance:install --database "mysql" --database-name "nextcloud" --database-user "$DBUSER" --database-pass "$DBPASS" --admin-user "admin" --admin-pass "$ADMINPASS" >/dev/null & |
|
|
|
|
|
|
|
show_spinner $! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo -e "\n\e[92mWriting login details into file...\e[39m" |
|
|
|
|
|
|
|
echo -e "\n |
|
|
|
|
|
|
|
########## Nextcloud ##########\n |
|
|
|
|
|
|
|
# Username: admin \n |
|
|
|
|
|
|
|
# Password: $ADMINPASS \n |
|
|
|
|
|
|
|
########## ## END ## ##########\n |
|
|
|
|
|
|
|
\n |
|
|
|
|
|
|
|
########## MySQL ##########\n |
|
|
|
|
|
|
|
# Username: $DBUSER \n |
|
|
|
|
|
|
|
# Password: $DBPASS \n |
|
|
|
|
|
|
|
########## END ##########\n" > /home/Nextclound-Login-Details-README.txt |
|
|
|
|
|
|
|
echo -e "\n\e[92mLogin details written to \e[93m/home/Nextclound-Login-Details-README.txt \e[39m" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# CentOS vHOST |
|
|
|
|
|
|
|
# DocumentRoot /var/www/nextcloud/ |
|
|
|
|
|
|
|
# ServerName your.server.com |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# <Directory /var/www/nextcloud/> |
|
|
|
|
|
|
|
# Require all granted |
|
|
|
|
|
|
|
# AllowOverride All |
|
|
|
|
|
|
|
# Options FollowSymLinks MultiViews |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# <IfModule mod_dav.c> |
|
|
|
|
|
|
|
# Dav off |
|
|
|
|
|
|
|
# </IfModule> |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# </Directory> |
|
|
|
|
|
|
|
#</VirtualHost> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
i=0 |
|
|
|
i=0 |
|
|
@ -48,14 +161,14 @@ while fuser /var/{lib/{dpkg,apt/lists},cache/apt/archives}/lock >/dev/null 2>&1 |
|
|
|
3 ) j="/" ;; |
|
|
|
3 ) j="/" ;; |
|
|
|
esac |
|
|
|
esac |
|
|
|
tput rc |
|
|
|
tput rc |
|
|
|
echo -en "\r[$j] \e[93mWaiting for other software managers to finish..." |
|
|
|
echo -en "\r[$j] \e[93mWaiting for another process to finish...\e[39m" |
|
|
|
sleep 0.5 |
|
|
|
sleep 0.5 |
|
|
|
((i=i+1)) |
|
|
|
((i=i+1)) |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
echo -e "\n\e[92mPackage manager is done" |
|
|
|
echo -e "\n\e[92mPackage manager is done\e[39m" |
|
|
|
echo -e "\e[36mPreparing Nextcloud installation.." |
|
|
|
echo -e "\e[36mPreparing Nextcloud installation..\e[39m" |
|
|
|
echo -e "\e[36mChecking Operation system.." |
|
|
|
echo -e "\e[36mChecking Operation system..\e[39m" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# CHECK OS |
|
|
|
# CHECK OS |
|
|
@ -68,15 +181,19 @@ if [ "$VAR_A" = "x86_64" ]; then |
|
|
|
|
|
|
|
|
|
|
|
if [ $version -eq 10 ]; then |
|
|
|
if [ $version -eq 10 ]; then |
|
|
|
#Debian 10 |
|
|
|
#Debian 10 |
|
|
|
echo -e "\nDebian $version" |
|
|
|
echo -e "\nDebian $version\e[39m" |
|
|
|
|
|
|
|
install_Debian9 # Currently it also works for Debian 10 |
|
|
|
|
|
|
|
|
|
|
|
elif [ $version -eq 9 ]; then |
|
|
|
elif [ $version -eq 9 ]; then |
|
|
|
#Debian 9 Check |
|
|
|
#Debian 9 Check |
|
|
|
echo -e "\nDebian $version" |
|
|
|
echo -e "\nDebian $version\e[39m" |
|
|
|
|
|
|
|
install_Debian9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elif [ $version -eq 8 ]; then |
|
|
|
elif [ $version -eq 8 ]; then |
|
|
|
#Debian 8 Check |
|
|
|
#Debian 8 Check |
|
|
|
echo "Debian $version" |
|
|
|
echo "Debian $version\e[39m" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
@ -119,4 +236,4 @@ fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo -e "\e[39mEverything is done." |
|
|
|
echo -e "\e[39mEverything is done.\e[39m" |