Add 'installer.sh'
This commit is contained in:
99
installer.sh
Normal file
99
installer.sh
Normal file
@@ -0,0 +1,99 @@
|
||||
#!/bin/bash
|
||||
|
||||
##---------------##
|
||||
# Static-Vars #
|
||||
##---------------##
|
||||
phpver=7.3
|
||||
sqlver=8.0
|
||||
cockpit=1
|
||||
PHPMyadmin=1
|
||||
PKGM="debconf-apt-progress -- apt"
|
||||
PKGA="add-apt-repository"
|
||||
PKGI="${PKGM} install -y"
|
||||
OUTPUT='/dev/null'
|
||||
|
||||
##--------##
|
||||
# Menu #
|
||||
##--------##
|
||||
sed -i -e 's/magenta/blue/g' /etc/newt/palette
|
||||
password=$(whiptail --nocancel --passwordbox "Please enter your password (should contain at least 2 digits and 6 characters)" 11 82 --title "Config" 3>&1 1>&2 2>&3)
|
||||
domain=$(whiptail --nocancel --inputbox " Enter the domain without www or mail." 11 82 --title "Config" 3>&1 1>&2 2>&3)
|
||||
email=$(whiptail --nocancel --inputbox " Enter the administrator e-mail" 11 82 --title "Config" 3>&1 1>&2 2>&3)
|
||||
choice=$(whiptail --nocancel --title "Radio list example" --radiolist "Choose user's permissions" 11 128 5 "Nginx, PHP-FPM" "Allow connections to other hosts" ON "Apache" "Allow connections from other hosts" OFF "Other" "Allow mounting of local devices" OFF 3>&1 1>&2 2>&3)
|
||||
if [[ $choice == *"Other"* ]]; then
|
||||
choice=$(whiptail --nocancel --title "Radio list example" --radiolist "Choose user's permissions" 11 128 5 "Nginx Proxy" "Allow connections to other hosts" ON "Nginx Proxy, standalone" "Allow connections from other hosts" OFF 3>&1 1>&2 2>&3)
|
||||
fi
|
||||
|
||||
if [[ $choice == *"PHP-FPM"* ]]; then
|
||||
echo "nginx netdata mailutils php${phpver}-fpm php${phpver}-imagick php${phpver}-mysql php${phpver}-cgi php${phpver}-common php${phpver}-pear php${phpver}-mbstring php${phpver}-curl php${phpver}-gd php${phpver}-intl php${phpver}-soap php${phpver}-xml php${phpver}-xmlrpc php${phpver}-zip" >> /tmp/install.txt
|
||||
fi
|
||||
if [[ $choice == *"Apache"* ]]; then
|
||||
echo "apache2 netdata mailutils libapache2-mod-php php${phpver}-mysql php${phpver}-cgi php${phpver}-common php${phpver}-pear php${phpver}-mbstring php${phpver}-curl php${phpver}-gd php${phpver}-intl php${phpver}-soap php${phpver}-xml php${phpver}-xmlrpc php${phpver}-zip" >> /tmp/install.txt
|
||||
fi
|
||||
if [[ $choice == "Nginx Proxy" ]]; then
|
||||
echo "nginx apache2 netdata mailutils libapache2-mod-php php${phpver}-mysql php${phpver}-cgi php${phpver}-common php${phpver}-pear php${phpver}-mbstring php${phpver}-curl php${phpver}-gd php${phpver}-intl php${phpver}-soap php${phpver}-xml php${phpver}-xmlrpc php${phpver}-zip" >> /tmp/install.txt
|
||||
fi
|
||||
if [[ $choice == *"standalone"* ]]; then
|
||||
echo "nginx apache2 mailutils phpmyadmin php${phpver}-fpm unzip build-essential apache2-dev php${phpver}-mysql php${phpver}-cgi php${phpver}-common php${phpver}-pear php${phpver}-mbstring php${phpver}-curl php${phpver}-gd php${phpver}-intl php${phpver}-soap php${phpver}-xml php${phpver}-xmlrpc php${phpver}-zip" >> /tmp/install.txt
|
||||
fi
|
||||
##----------##
|
||||
# Addons #
|
||||
##----------##
|
||||
option=$(whiptail --nocancel --title "Which features should be integrated?" --checklist "Features" 11 128 5 "Nextcloud" "Nextcloud is a suite of client-server software for creating and using file hosting services" OFF "Memcached" "Memcached is an open source, high-performance, distributed memory caching system" OFF "Redis Cache" "Redis is an open source BSD licensed, in-memory data structure store" OFF "Wordpress" "WordPress is a content management system based on PHP" OFF "Brotli Precompression" "Brotli is a data format specification for data streams" OFF 3>&1 1>&2 2>&3)
|
||||
if [[ $option == *"Nextcloud"* ]]; then
|
||||
echo "" >> /tmp/install.txt
|
||||
fi
|
||||
if [[ $option == *"Memcached"* ]]; then
|
||||
echo "" >> /tmp/install.txt
|
||||
fi
|
||||
if [[ $option == *"Redis"* ]]; then
|
||||
echo "" >> /tmp/install.txt
|
||||
fi
|
||||
if [[ $option == *"Wordpress"* ]]; then
|
||||
echo "" >> /tmp/install.txt
|
||||
fi
|
||||
if [[ $option == *"Brotli"* ]]; then
|
||||
echo "" >> /tmp/install.txt
|
||||
fi
|
||||
|
||||
##--------------------##
|
||||
# Pre-Requirements #
|
||||
##--------------------##
|
||||
TERM=ansi whiptail --title "Config" --infobox "Preconfiguring." 8 78
|
||||
echo "fail2ban" >> /tmp/install.txt
|
||||
$PKGM update > $OUTPUT 2>&1
|
||||
$PKGI software-properties-common > $OUTPUT 2>&1
|
||||
$PKGA universe -y > $OUTPUT 2>&1
|
||||
$PKGA ppa:ondrej/php -y > $OUTPUT 2>&1
|
||||
$PKGA ppa:certbot/certbot -y > $OUTPUT 2>&1
|
||||
$PKGM update
|
||||
$PKGM upgrade -y
|
||||
|
||||
##-------------##
|
||||
# Installer #
|
||||
##-------------##
|
||||
cat /tmp/install.txt | xargs $PKGI
|
||||
|
||||
##------------##
|
||||
# Fail2Ban #
|
||||
##------------##
|
||||
sed -i 's/root@localhost/'$email'/g' /etc/fail2ban/jail.conf
|
||||
wget -q -t7 http://dynpasloo.ddns.net:3000/brancovandewaal/Ubuntu-Web-v2/raw/branch/master/fail2ban/sshd.local -O /etc/fail2ban/jail.d/sshd.local
|
||||
if [[ $option == *"Nextcloud"* ]]; then
|
||||
wget -q -t7 http://dynpasloo.ddns.net:3000/brancovandewaal/Ubuntu-Web-v2/raw/branch/master/fail2ban/nextcloud.conf -O /etc/fail2ban/filter.d/nextcloud.conf
|
||||
wget -q -t7 http://dynpasloo.ddns.net:3000/brancovandewaal/Ubuntu-Web-v2/raw/branch/master/fail2ban/nextcloud.local -O /etc/fail2ban/jail.d/nextcloud.local
|
||||
fi
|
||||
if [[ $option == *"Wordpress"* ]]; then
|
||||
wget -q -t7 http://dynpasloo.ddns.net:3000/brancovandewaal/Ubuntu-Web-v2/raw/branch/master/fail2ban/wordpress.conf -O /etc/fail2ban/filter.d/wordpress.conf
|
||||
wget -q -t7 http://dynpasloo.ddns.net:3000/brancovandewaal/Ubuntu-Web-v2/raw/branch/master/fail2ban/wordpress.local -O /etc/fail2ban/jail.d/wordpress.local
|
||||
fi
|
||||
|
||||
##-------##
|
||||
# UFW #
|
||||
##-------##
|
||||
sed -i 's/IPV6=yes/IPV6=no/g' /etc/default/ufw
|
||||
ufw default deny incoming > $OUTPUT 2>&1
|
||||
ufw allow 80/tcp > $OUTPUT 2>&1
|
||||
ufw allow 443/tcp > $OUTPUT 2>&1
|
||||
ufw limit 4242/tcp > $OUTPUT 2>&1
|
||||
echo "y" | ufw enable > $OUTPUT 2>&1
|
||||
Reference in New Issue
Block a user