parent
c8442b05fe
commit
a00abc2732
1 changed files with 188 additions and 0 deletions
@ -0,0 +1,188 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
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) |
||||||
|
PHPMYADMINV = "5.0.2" |
||||||
|
VAR_A=`uname -m` |
||||||
|
mkdir /home/tmp |
||||||
|
|
||||||
|
cd "/home/tmp" |
||||||
|
|
||||||
|
show_spinner() |
||||||
|
{ |
||||||
|
spin='-\|/' |
||||||
|
|
||||||
|
i=0 |
||||||
|
while kill -0 $1 2>/dev/null |
||||||
|
do |
||||||
|
i=$(( (i+1) %4 )) |
||||||
|
printf "\r\e[93m[ \e[36m${spin:$i:1} \e[93m] \e[93mPlease wait...\e[39m" |
||||||
|
sleep .1 |
||||||
|
done |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
clean_up(){ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
install_Debian9(){ |
||||||
|
echo -e "\n\e[92mInstalling requirements...\e[39m" |
||||||
|
apt-get install --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" sudo |
||||||
|
apt-get install -y 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[92mDownloading PHPMyAdmin..\e[39m" |
||||||
|
wget -N "https://files.phpmyadmin.net/phpMyAdmin/$PHPMYADMINV/phpMyAdmin-$PHPMYADMINV-all-languages.zip" >/dev/null & |
||||||
|
show_spinner $! |
||||||
|
unzip -o phpMyAdmin-$PHPMYADMINV-all-languages.zip >/dev/null & |
||||||
|
show_spinner $! |
||||||
|
mv phpMyAdmin-$PHPMYADMINV-all-languages /usr/share/phpmyadmin |
||||||
|
chmod -R 0755 /usr/share/phpmyadmin |
||||||
|
wget -N "https://backup.mirror3.deinserverhost.icu/OneClick/phpmyadmin.conf" |
||||||
|
mv phpmyadmin.conf /etc/apache2/conf-available/ |
||||||
|
a2enconf phpmyadmin |
||||||
|
systemctl reload apache2 |
||||||
|
mkdir /usr/share/phpmyadmin/tmp/ |
||||||
|
chown -R www-data:www-data /usr/share/phpmyadmin/tmp/ |
||||||
|
|
||||||
|
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/LAMP.sql |
||||||
|
|
||||||
|
mysql -u root < /home/LAMP.sql |
||||||
|
rm /home/LAMP.sql |
||||||
|
service apache2 restart |
||||||
|
OWNIP = curl ifconfig.me |
||||||
|
|
||||||
|
|
||||||
|
echo -e "\n\e[92mWriting login details into file...\e[39m" |
||||||
|
echo -e "\n |
||||||
|
########## Phpmyadmin ##########\n |
||||||
|
# http://$OWNIP/phpmyadmin/ |
||||||
|
# Username: admin \n |
||||||
|
# Password: $ADMINPASS \n |
||||||
|
########## ## END ## ##########\n |
||||||
|
\n |
||||||
|
########## MySQL ##########\n |
||||||
|
# Username: $DBUSER \n |
||||||
|
# Password: $DBPASS \n |
||||||
|
########## END ##########\n" > /home/LAMP-Login-Details-README.txt |
||||||
|
echo -e "\n\e[92mLogin details written to \e[93m/home/LAMP-Login-Details-README.txt \e[39m" |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
i=0 |
||||||
|
tput sc |
||||||
|
while fuser /var/{lib/{dpkg,apt/lists},cache/apt/archives}/lock >/dev/null 2>&1 ; do |
||||||
|
case $(($i % 4)) in |
||||||
|
0 ) j="-" ;; |
||||||
|
1 ) j="\\" ;; |
||||||
|
2 ) j="|" ;; |
||||||
|
3 ) j="/" ;; |
||||||
|
esac |
||||||
|
tput rc |
||||||
|
echo -en "\r[$j] \e[93mWaiting for another process to finish...\e[39m" |
||||||
|
sleep 0.5 |
||||||
|
((i=i+1)) |
||||||
|
done |
||||||
|
|
||||||
|
echo -e "\n\e[92mPackage manager is done\e[39m" |
||||||
|
echo -e "\e[36mPreparing LAMP installation..\e[39m" |
||||||
|
echo -e "\e[36mChecking Operation system..\e[39m" |
||||||
|
|
||||||
|
|
||||||
|
# CHECK OS |
||||||
|
if [ "$VAR_A" = "x86_64" ]; then |
||||||
|
check=`cat /etc/issue | grep -i 'Debian'` |
||||||
|
if [ -n "$check" ]; then |
||||||
|
apt-get update >/dev/null & |
||||||
|
show_spinner $! |
||||||
|
version=`cat /etc/debian_version | awk -F. '{print $1}'` |
||||||
|
|
||||||
|
if [ $version -eq 10 ]; then |
||||||
|
#Debian 10 |
||||||
|
echo -e "\nDebian $version\e[39m" |
||||||
|
install_Debian9 # Currently it also works for Debian 10 |
||||||
|
clean_up |
||||||
|
|
||||||
|
elif [ $version -eq 9 ]; then |
||||||
|
#Debian 9 Check |
||||||
|
echo -e "\nDebian $version\e[39m" |
||||||
|
install_Debian9 |
||||||
|
clean_up |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
elif [ $version -eq 8 ]; then |
||||||
|
#Debian 8 Check |
||||||
|
echo "Debian $version\e[39m" |
||||||
|
|
||||||
|
|
||||||
|
fi |
||||||
|
fi |
||||||
|
#Debian Check End |
||||||
|
|
||||||
|
|
||||||
|
#Ubuntu |
||||||
|
check=`cat /etc/issue | grep -i 'Ubuntu'` |
||||||
|
if [ -n "$check" ]; then |
||||||
|
apt-get update >/dev/null & |
||||||
|
show_spinner $! |
||||||
|
version=`lsb_release -sr | awk -F. '{print $1}'` |
||||||
|
if [ $version -eq 20 ]; then |
||||||
|
#Ubuntu 20 |
||||||
|
echo "Ubuntu $version" |
||||||
|
|
||||||
|
elif [ $version -eq 18 ]; then |
||||||
|
#Ubuntu 18 |
||||||
|
echo "Ubuntu $version" |
||||||
|
|
||||||
|
elif [ $version -eq 16 ]; then |
||||||
|
#Ubuntu 16 |
||||||
|
echo "Ubuntu $version" |
||||||
|
|
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
#CentOS |
||||||
|
check=`cat /etc/issue | grep -i 'CentOS'` |
||||||
|
if [ -n "$check" ]; then |
||||||
|
echo "CentOS is not supported yet" |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo -e "\e[39mEverything is done.\e[39m" |
Loading…
Reference in new issue