diff --git a/installer.sh b/installer.sh index f39ff82..ae95cc9 100644 --- a/installer.sh +++ b/installer.sh @@ -64,22 +64,12 @@ dhparam=1024 ##----------------## # Pre-Config # ##----------------## -{ - for ((i = 0 ; i <= 100 ; i+=5)); do - sleep 0.2 - echo $i +{ for ((i = 0 ; i <= 100 ; i+=5)); do sleep 0.2 + echo $i done } | whiptail --gauge "Pre-configuring the server..." 6 50 0 -hostnamectl set-hostname $domain >/dev/null -$PKGM update -$PKGI software-properties-common -$PKGA universe -y >/dev/null -$PKGA ppa:ondrej/php -y >/dev/null -wget -q -O- https://repo.dovecot.org/DOVECOT-REPO-GPG | sudo apt-key add - -echo "deb https://repo.dovecot.org/ce-2.3-latest/ubuntu/$(lsb_release -cs) $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/dovecot.list -$PKGM update -$PKGM upgrade -y -$PKGM autoremove -y + +hostnamectl set-hostname $domain > $OUTPUT 2>&1 timedatectl set-timezone Europe/Amsterdam >/dev/null adduser --system --no-create-home --disabled-password --disabled-login --shell /bin/false --group --home /var/lib/clamav clamav mkdir -p /var/run/clamav @@ -98,18 +88,28 @@ else fi sed -i 's/#/vm.swappiness=40/g' /etc/sysctl.conf +##----------------------## +# Pre-Requirements # +##----------------------## +$PKGM update +$PKGI software-properties-common +$PKGA universe -y > $OUTPUT 2>&1 +$PKGA ppa:ondrej/php > $OUTPUT 2>&1 +wget -q -O- https://repo.dovecot.org/DOVECOT-REPO-GPG | sudo apt-key add - +echo "deb https://repo.dovecot.org/ce-2.3-latest/ubuntu/$(lsb_release -cs) $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/dovecot.list > $OUTPUT 2>&1 +$PKGM update +$PKGM upgrade -y + +##-----------------------------## +# Installing Requirements # +##-----------------------------## +$PKGI nginx php${phpver} php${phpver}-common php${phpver}-imap php${phpver}-zip php${phpver}-fpm php${phpver}-cli php${phpver}-json php${phpver}-mysql php${phpver}-opcache php${phpver}-mbstring php${phpver}-readline libc-client2007e mlock postfix postfix-mysql dovecot-imapd dovecot-lmtpd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-managesieved spamassassin spamc razor pyzor clamav clamav-daemon clamsmtp libclamunrar7 clamdscan amavisd-new zip lrzip liblz4-tool lhasa arj unzip bzip2 nomarch cpio lzop cabextract arc apt-listchanges libauthen-sasl-perl libdbd-mysql-perl libdbi-perl libmail-dkim-perl ripole p7zip p7zip-full p7zip-rar rpm unrar unrar-free altermime libsnmp-perl libnet-ldap-perl libnet-ph-perl libnet-snpp-perl libnet-telnet-perl unzip fail2ban + ##-------------## # Debloat # ##-------------## $PKGM remove --purge lxcfs lxd lxd-client geoip-database snapd -y - -##--------------------------## -# Install Requirements # -##--------------------------## -$PKGI nginx php${phpver} php${phpver}-common php${phpver}-imap php${phpver}-zip php${phpver}-fpm php${phpver}-cli php${phpver}-json php${phpver}-mysql php${phpver}-opcache php${phpver}-mbstring php${phpver}-readline \ -libc-client2007e mlock postfix postfix-mysql dovecot-imapd dovecot-lmtpd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-managesieved \ -spamassassin spamc razor pyzor clamav clamav-daemon clamsmtp libclamunrar7 clamdscan amavisd-new zip lrzip liblz4-tool lhasa arj unzip bzip2 nomarch cpio lzop cabextract arc \ -apt-listchanges libauthen-sasl-perl libdbd-mysql-perl libdbi-perl libmail-dkim-perl ripole p7zip p7zip-full p7zip-rar rpm unrar unrar-free altermime libsnmp-perl libnet-ldap-perl libnet-ph-perl libnet-snpp-perl libnet-telnet-perl unzip fail2ban +$PKGM autoremove -y ##-----------------------## # Html Folder Perms # @@ -244,14 +244,22 @@ systemctl restart nginx ##-----------------------## # MySQL Installation # ##-----------------------## -whiptail --title "Installing MySQL" --infobox "Busy like a bee" 8 45 +{ for ((i = 0 ; i <= 100 ; i+=5)); do sleep 0.2 + echo $i + done +} | whiptail --gauge "Installing MySQL..." 6 50 0 + wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-MySQL/raw/branch/master/mysql-8.0.sh -O /tmp/mysql-8.0.sh source /tmp/mysql-8.0.sh ##------------------------------## # MySQL_Secure_Installation # ##------------------------------## -whiptail --title "Installing MySQL" --infobox "Busy like a bee" 8 45 +{ for ((i = 0 ; i <= 100 ; i+=5)); do sleep 0.2 + echo $i + done +} | whiptail --gauge "Securing MySQL..." 6 50 0 + mysql -u root -p"$password" -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')" > $OUTPUT 2>&1 mysql -u root -p"$password" -e "DELETE FROM mysql.user WHERE User=''" > $OUTPUT 2>&1 mysql -u root -p"$password" -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'" > $OUTPUT 2>&1 @@ -262,7 +270,10 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1 ##-----------------------------## # MySQL Database Creation # ##-----------------------------## -whiptail --title "Installing MySQL" --infobox "Busy like a bee" 8 45 +{ for ((i = 0 ; i <= 100 ; i+=5)); do sleep 0.2 + echo $i + done +} | whiptail --gauge "Creating MySQL Databases..." 6 50 0 mysql -u root -p"$password" -e "CREATE DATABASE postfixadmin;" > $OUTPUT 2>&1 mysql -u root -p"$password" -e "CREATE USER '"postfixadmin"'@'localhost' IDENTIFIED BY '"$password"';" > $OUTPUT 2>&1 mysql -u root -p"$password" -e "GRANT ALL ON "postfixadmin".* TO "postfixadmin"@'localhost';" > $OUTPUT 2>&1 @@ -273,7 +284,10 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1 ##------------------## #$PKGI php${phpver} php${phpver}-zip php${phpver}-fpm php${phpver}-cli php${phpver}-json php${phpver}-mysql php${phpver}-opcache php${phpver}-mbstring php${phpver}-readline #$PKGI libc-client2007e mlock php${phpver}-common php${phpver}-imap -whiptail --title "Configuring PostfixAdmin" --infobox "Busy like a bee" 8 45 +{ for ((i = 0 ; i <= 100 ; i+=5)); do sleep 0.2 + echo $i + done +} | whiptail --gauge "Configuring PostfixAdmin..." 6 50 0 mkdir -p /var/www/"$domain"/html/postfixadmin/templates_c wget -q -t7 https://git.ictmaatwerk.com/downloads/pfa/postfixadmin-3.1.tar.gz -O /tmp/postfixadmin.tar.gz tar -xf /tmp/postfixadmin.tar.gz -C /var/www/"$domain"/html/postfixadmin --strip-components=1