146 lines
3.9 KiB
Bash
146 lines
3.9 KiB
Bash
#!/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
|
|
#==============================================================================
|
|
|
|
#-------------------#
|
|
# Preconfiguration #
|
|
#-------------------#
|
|
|
|
cd /tmp
|
|
|
|
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
|
|
apt-get update
|
|
apt-get upgrade -y
|
|
apt-get dist-upgrade -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
|
|
apt install rsync grsync sshpass -y
|
|
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
|
|
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_V0.1.sh
|
|
break;;
|
|
"Apache, Nginx reverse proxy")
|
|
script=https://trans.bprieshof.nl/gitea/ICT-Maatwerk/Vps-UBUNTU-SetupScrips/raw/branch/master/Apache-RevProxNGINX-Installer_V0.1.sh
|
|
break;;
|
|
"Nginx, PHP-FPM")
|
|
script=https://trans.bprieshof.nl/gitea/ICT-Maatwerk/Vps-UBUNTU-SetupScrips/raw/branch/master/NGINX-Installer_V0.1.sh
|
|
break;;
|
|
"Quit")
|
|
exit;;
|
|
*) echo "Fout antwoord $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
|
|
|
|
#-------------------#
|
|
# Install Phase #
|
|
#-------------------#
|
|
|
|
echo "***************************"
|
|
sleep 0.5
|
|
echo "INSTALLATIE DUURT 5 Minuten"
|
|
sleep 0.5
|
|
echo "***************************"
|
|
|
|
wget $script -O script.sh
|
|
source script.sh
|
|
|
|
|
|
|
|
echo "Install Succes"
|
|
echo "Reboot system in:"
|
|
sleep 1
|
|
echo "3"a
|
|
sleep 1
|
|
echo "2"
|
|
sleep 1
|
|
echo "1"
|
|
#reboot
|
|
exit |