Update 'Main-Installer.sh'

This commit is contained in:
2018-09-07 11:24:50 +00:00
parent af2466c91b
commit 7dbd728fdc

174
Main-Installer.sh Normal file
View File

@@ -0,0 +1,174 @@
#!/bin/bash
# Bash Menu Script Example
#==============================================================================
# UBUNTU 18.04 BASH SCRIPT
#==============================================================================
##R1 V1.1##
#===Changes For V1===#
#Added Variables and executes for them#
#===Chaghes For V1.1===#
# Nginx, apache, certbot, phpmyadmin, php-fpm, postfix, netdata, Memcached, redis, wordpress & opcache#
#install scripts were added#
#==============================================================================
# UNDER DEVELOPMENT
#==============================================================================
# Mailserver -->> EXIM, DOVECOT, SPAMASSASSIN, CLAMAV
# FTP backups -->> VSFTPD
# Secure WP -->> NGINX RULES
# WP backup & restore -->> SHELL or PHP
# LAMP SETUP
# APACHE, NGINX REVERSE PROXY
#==============================================================================
# CHECKEN!
# > Postfix
#==============================================================================
#------#
# Menu #
#------#
echo "UBUNTU 18.04 INSTALLATIE SCRIPT"
echo Welk domein mag gekoppeld worden? Typ domein zonder www
read domain
echo Standaard wachtwoord
read passwd
echo administrator email
read email
echo "Webserver:"
PS3='Keuze:'
options=("Apache" "Apache, Nginx reverse proxy" "Nginx, PHP-FPM" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Apache")
script=https://trans.bprieshof.nl/gitea/ICT-Maatwerk/Vps-UBUNTU-SetupScrips/raw/branch/master/Apache-Installer.sh
break;;
"Apache, Nginx reverse proxy")
script=https://trans.bprieshof.nl/gitea/ICT-Maatwerk/Vps-UBUNTU-SetupScrips/raw/branch/master/Apache-RevProxNGINX-Installer.sh
break;;
"Nginx, PHP-FPM")
script=https://trans.bprieshof.nl/gitea/ICT-Maatwerk/Vps-UBUNTU-SetupScrips/raw/branch/master/NGINX-Installer.sh
break;;
"Quit")
exit;;
*) echo "Fout commando $REPLY";;
esac
done
while true; do
read -p "Installeer Netdata -> yes/no?" yn
case $yn in
[Yy]* ) netdata=1
break;;
[Nn]* ) netdata=0
break;;
* ) echo "Kies yes of no.";;
esac
done
while true; do
read -p "Installeer Memcached -> yes/no?" yn
case $yn in
[Yy]* ) memcached=1
break;;
[Nn]* ) memcached=0
break;;
* ) echo "Kies yes of no.";;
esac
done
while true; do
read -p "Installeer Redis Cache -> yes/no?" yn
case $yn in
[Yy]* ) redis=1
break;;
[Nn]* ) redis=0
break;;
* ) echo "Kies yes of no.";;
esac
done
while true; do
read -p "Installeer Wordpress -> yes/no?" yn
case $yn in
[Yy]* ) wordpress=1
break;;
[Nn]* ) wordpress=0
break;;
* ) echo "Kies yes of no.";;
esac
done
#-------------------#
# Preconfiguration #
#-------------------#
cd /tmp
apt-get update
apt-get upgrade -y
apt-get dist-upgrade -y
apt install rsync grsync sshpass -y
apt-get clean
apt-get autoremove -y
hostnamectl set-hostname $domain
sed -i 's/;preserve_hostname: false/preserve_hostname: true/g' /etc/cloud/cloud.cfg
timedatectl set-timezone Europe/Amsterdam
sed -i 's/#/vm.swappiness=10/g' /etc/sysctl.conf
sed -i 's/#/vm.vfs_cache_pressure=50/g' /etc/sysctl.conf
touch /etc/cron.d/updates
cat <<EOF > /etc/cron.d/updates
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow command
0 0 * * * apt-get update -y && apt-get upgrade -y &&apt-get dist-upgrade -y
EOF
ufw allow OpenSSH
ufw allow 443/tcp
ufw allow 80/tcp
ufw limit ssh
echo "y" | sudo ufw enable
#-------------------#
# Install Phase #
#-------------------#
echo "***************************"
sleep 0.5
echo "INSTALLATIE DUURT 5 Minuten"
sleep 0.5
echo "***************************"
wget $script -O script.sh
source script.sh
#-------------------#
# OPCACHE GUI #
#-------------------#
wget https://raw.githubusercontent.com/amnuts/opcache-gui/master/index.php -O /var/www/"$domain"/public_html/opcache.php
#----------------#
# PHP.info #
#----------------#
cat > /var/www/"$domain"/public_html/info.php <<- "EOF"
<?php
phpinfo();
?>
EOF
#--------------#
# Reboot #
#--------------#
echo "Install Succes"
echo "Reboot system in:"
sleep 1
echo 3
sleep 1
echo 2
sleep 1
echo 1
reboot
exit